I'm building Boost 1.72 on Windows, as part of a product build. I'm trying to build everything /MTd and, except for Boost, I've been successful. Unfortunately, though I've added "link=static" to the b2 command line, b2 insists upon building /MDd. Does anyone have any ideas on how to persuade b2 to build debug/static, rather than debug/dynamic?
Related
I am getting error
Error C1007 unrecognized flag '-Ot' in 'p2'
but unable to find -Ot in the command line string of the project. Googling did not help. Anyone know what does that flag stand for ?
I had a similar issue on a project that I was compiling. It seems to be caused when MSVC 2017 linker tries to link a dependency library ".lib" to your project and it was compiled with Optimization flag /Ot enabled. That is why you can not see it on command line of your own project. You can try one of these actions.
Recompile your libs without /Ot enabled (Properties → C/C++ → Optimization → Favor Size or Speed → Neither), then recompile whole project.
Update MSVC 2017 toolchain to the latest one, which should be 14.14.26428. After updating, recompile your project. It is strange, but in my machine configuration, toolchain 14.13 couldn't link libraries compiled with newer toolchains and /Ot enabled.
Both solutions worked in my case, but I ended up using number 2.
Just for future reference to this error msg:
I got this error with no -Ot option set, the error message was misleading. Turned out that I tried to build a project with a 140 toolset (VS2015 - forgot to upgrade to 141) with .dll and .lib dependencies already built with 141 (VS2017). After updating the toolset to 141 the project could be built.
You should find this flag in the Optimization property page of your project.
-Ot (/Ot) option is the Favor Fast Code flag (Attempts to offer improvements in execution time over space)
According to the Microsoft Visual C++ Documentation (https://learn.microsoft.com/en-us/cpp/build/reference/os-ot-favor-small-code-favor-fast-code),
If you use /Os or /Ot, then you must also specify /Og to optimize the
code.
Happened to me while building nmap. Executables did not have /GL, while libnetutil did. Removing /GL from libnetutil fixed it. Or, if possible (and desired), align /GL to all dependent targets (lib, dll/exe).
I scratched my head hard but could not find someone asks the same question.
I'm building boost 1.66 with VS2017 on my machine, the command I'm using is b2 -a -j6 toolset=msvc-14.1 link=static runtime-link=static,shared address-model=64 architecture=x86 define=BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE --with-math.
I think it should use cl.exe from Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\<version>\bin\Hostx64\x64
However, from the log b2 gives me
It looks really weird to me that it's using cl.exe under arm folder to compile my address-model=64 binaries. My question is, will the binary be the same as what I expected? Could this be a bug in boost build engine, and is there a workaround to make this look right?
P.S.: I've tried editing project-config.jam to hardcode the path of desired location of compiler, but it returns me "could not locate correct compiler cl". What I referenced is: build-boost-with-msvc-14-1-vs2017-rc
I am using Qt version 5.5.1 (but with the 5.6.1 GUI), I am compiling with MSVC++ Compiler 10.0, and I have checked the "Use jom instead of nmake" option in the Options -> Build & Run -> General menu. I am using the latest version of cmake, and the Options -> Build & Run - > Kits -> CMake generator is set to "CodeBlocks - NMake Makefiles". To be honest, I do not know what that last option does, it is just the default.
I am building and running through the QT creator IDE.
If I add -j to the "tool arguments" in Projects -> Build&Run -> Build Steps, then when I try to compile I get the error:
NMAKE:-1: error: U1065: invalid option 'j'
However, I have "Use jom instead of nmake" selected so it should use jom and accept this argument, shouldn't it?
Have I missed out a step?
I cannot find any instructions on how to do this, and the only tutorials I can find to compile using jom are compiling through the command line, which I do not want to do.
edit: This is a different question from How do I utilise all the cores for nmake? as this question is specifically asking why the Jom solution (suggested as an answer in that question) is not working with my set up.
edit 2: I think I may have found out why. This bug report suggests that you need to use the "CodeBlocks - NMake Makefiles JOM" option in the kits -> cmake generator options.This is only supported with QtCreator 4.2.1 and above. However, I have this and it still does not work. I now get the error:
C:\Program Files\CMake\share\cmake-3.8\Modules\CMakeTestCCompiler.cmake:51: error: The C compiler "C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe" is not able to compile a simple test program. It fails with the following output: Change Dir: C:/GIT/CorteX/build/Debug/CMakeFiles/CMakeTmp
Nmake file can be natively used by Jom, thus the cmake generator doesn't not need to be changed from the default nmake generator in the build configuration. The cmake generator is what converts your cmake to your native build system format (e.g. make, or nmake).
(i.e. Projects > Manage Kits ... > Build & Runs > Kits. choose your kit. I have my Cmake generator: set to "CodeBlocks - Nmake Makefiles, Platform: , Toolset: " ).
The only change you then need is to add a custom build step to run jom.exe and disable the default build step, as in Qtcreator JOM setup.
N.b. jom.exe must be in your PATH variable for QtCreator to find it.
jom requires that -j , where you set the number of processes, e.g. jom -j4. You can't use just -j without a count.
I have a requirement of building the boost boost_1_59_0 librabry with /md option instead of /mt.
could anybody here help me. I see there is one file build.jam where /mt is used at many places but not sure replacing /mt with /md in this file will fulfill my requirement.
/MT: b2 runtime-link=static
/MD: b2 runtime-link=shared <= The default value
You can also build all libraries, as Grigoriy suggested. In this case, the output filenames will be different. For example:
/MT: libboost_regex-vc141-mt-s-1_65.lib
/MD: libboost_regex-vc141-mt-1_65.lib
You can run b2 with the option --build-type=complete. It should build all supported variants of the libraries
OR
you can use something like this: b2 variant=release,debug link=static to build just the static version of the required library.
Based on this excellent tutorial, I am able to build the boost library without problems. However, I cannot find any PDB files are generated.
boost_1_49_0>b2 --prefix=c:\temp\boost1.49 --toolset=msvc-10.0
--build-type=complete
Since I have built .lib and .dll files for boost. what else minimum build I should do in order to get all corresponding pdb generated?
From "Built in Features"
When you call b2 try using --debug-symbols=on
You can build pdbs for static libs directly in the necessary directory (which may be needed for the debugger) by a little tweaking of msvc.jam. Find rule archive there and change
PDB_NAME on $(>) = $(<[1]:S=.pdb) ;
to e.g.:
PDB_NAME on $(>) = "c:\\Lib\\boost\\stage\\lib\\$(<[1]:S=.pdb:G=)" ;
(Disclaimer: I have only a vague idea what that cryptic expression means, never saw it documented anywhere, it was a pure guesswork on my part, hence no guarantees, but it works for me).
PDBs for DLLs are built by the linker, so you may set its option in e.g. project-config.jam:
import toolset ;
using msvc ;
toolset.flags msvc.link LINKFLAGS <link>shared : "/PDB:c:\\Lib\\boost\\stage\\lib\\" : unchecked ;
I'm sure there's a way to get the output directory from the system automatically. If anyone figures that out, please update.