Opened 13 years ago
Closed 13 years ago
#3424 closed Bugs (fixed)
cflags don't affect C++ compiler
Reported by: | Andrey Semashev | Owned by: | Vladimir Prus |
---|---|---|---|
Milestone: | Boost 1.41.0 | Component: | build |
Version: | Boost 1.40.0 | Severity: | Problem |
Keywords: | Cc: |
Description
According to this page, the cflags should affect both C and C++ compilers. However, that isn't true, cflags are not passed to the C++ compiler, only cxxflags are.
Change History (6)
comment:1 by , 13 years ago
Component: | Building Boost → build |
---|---|
Owner: | set to |
comment:2 by , 13 years ago
I'm using MSVC 7.1 with STLPort. I don't have a minimal example, I was just trying to build Boost 1.40 with the following script (I used Cygwin to run it):
export HAVE_ICU=1 export ICU_PATH="$ROOT_DIR/ThirdParty/icu" export ICU_LINK="/LIBPATH:$ROOT_DIR/ThirdParty/icu/win32/lib icuuc.lib icuin.lib icudt.lib" export ZLIB_BINARY=zlib export ZLIB_INCLUDE=$ROOT_DIR/ThirdParty/ZLib/inc export ZLIB_LIBPATH=$ROOT_DIR/ThirdParty/ZLib/lib/win32 tools/jam/src/bin.ntx86/bjam.exe -d+2 -j 2 --stagedir=stage.vc7 toolset=msvc stdlib=stlport variant=release link=shared runtime-link=shared threading=multi optimization=speed inlining=full rtti=on exception-handling=on debug-symbols=on "cflags=-G7 -arch:SSE2 -Oi -GL" "linkflags=/LTCG /OPT:REF,ICF $ICU_LINK" --without-python --without-wave --without-mpi stage
The user-config.jam is in the tools/build/v2 directory (excessive commented lines stripped):
# ------------------- # MSVC configuration. # ------------------- # Configure msvc (default version, searched for in standard locations and PATH). using msvc ; # ---------------------- # STLPort configuration. # ---------------------- # Configure specifying location of STLPort headers. Libraries must be either # not needed or available to the compiler by default. # using stlport : : /usr/include/stlport ; # Configure specifying location of both headers and libraries explicitly. using stlport : : "<absolute_path_to_ThirdParty>/ThirdParty/STLport/stlport" : "<absolute_path_to_ThirdParty>/ThirdParty/STLport/lib/win32" ;
The resulting build log contains compiler flags, and "-G7 -arch:SSE2 -Oi -GL" are missing. When cflags are changed to cxxflags it works as expected.
BTW, it's not mentioned in the initial posting, but I had another problem with user-config.jam. You see these "<absolute_path_to_ThirdParty>" parts? I had to write a perl script to fill these in, based on my current path configuration in the ROOT_DIR environment variable. When I tried to specify "$(ROOT_DIR)/ThirdParty/STLport/stlport" I got build errors that basically said that there were too many arguments for stlport rule. Apparently, it took the colon after the drive letter as a delimiter between rule parameters. I failed to work it around except to write a perl script that would substitute the <absolute_path_to_ThirdParty> placeholder with the expanded value of ROOT_DIR, then it worked (even though the colon is still there).
follow-up: 4 comment:3 by , 13 years ago
This appears to be msvc-specific bug, I'll fix that. As for your second problem, not that
- "$(ROOT_DIR)" is not automatically expanded, see FAQ for explanation how to get environment variables
- Many users are passing full windows paths without issues. If the path contain spaces -- did you quote it?
If the above suggestions do no work, can you file a separate bug report so as not to confuse different things.
Thanks, Volodya
comment:4 by , 13 years ago
Replying to vladimir_prus:
As for your second problem, not that
- "$(ROOT_DIR)" is not automatically expanded, see FAQ for explanation how to get environment variables
That helped, thanks a lot.
comment:6 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Merged to release branch in r57406.
Note that there are two things called cflags. The parameter passed to the toolset initialization is different from the feature and only affects the C compiler, not the C++ compiler. It appears to me that the values of the feature cflags are passed to the C++ compiler. What toolset are you using? Do you have a minimal example?