Boost C++ Libraries: Ticket #573: How to pass CXXFLAGS & LDFLAGS https://svn.boost.org/trac10/ticket/573 <pre class="wiki">Hi, I have been trying to build the boost libraries on a Fedora Core 4 machine. I want to build a specific gcc334 version of the libraries that is 64-bit. I have followed the instructions on the Boost web site on how to configure boost specifically to pass CXXFLAGS and LDFLAGS. I shall run through what I have done: I am trying to build boost v1.33.1 1) I cd to BOOST_ROOT/libs/config 2) I run: sh ./configure CC=gcc334 CXX=g++334 CXXFLAGS="-m64 -fPIC" LDFLAGS="-m64 -Wl,-rpath /apps/Linux64/gcc402/lib64 -fPIC" 3) This creates a user.hpp that I copy to BOOST_ROOT/boost/config 4) I cd to BOOST_ROOT 5) I run: bjam -sTOOLS=gcc --builddir=./boost_1_33_1-objdir stage I then find that any compiler flags that I specified are simply ignored. Not only that but checking top I find that the libraries are being built with the default compiler instead of the one I specified. So I then tried the following command instead as the docs aren't clear what you need to specify to bjam after doing a specific configuration as above. bjam -sGCC_ROOT_DIRECTORY=/apps/Linux64/gcc334 -sGCC=gcc334 -sGXX=g++334 -sTOOLS=gcc --builddir=./boost_1_33_1-objdir stage This at least makes the correct compiler be used but still the CXXFLAGS and LDFLAGS are ignored. I notice there are other posts in this group where people have asked similar questions. Surely passing CXXFLAGS and LDFLAGS should be quite a simple thing to be able to do. I too am confused by the user.hpp containing the following which is commented: // // Use this file to define a site and compiler specific // configuration policy, this version was auto-generated by // configure on Tue Feb 28 16:06:50 GMT 2006 // With the following options: // CXX = g++334 // CXXFLAGS = -I./../.. -I./../../libs/config/test -m64 -fPIC -DBOOST_NO_CONFIG // LDFLAGS = -m64 -Wl,-rpath /apps/Linux64/gcc402/lib64 -fPIC // LIBS = -lrt -lm -lpthread // Are these options passed to some other file when the configure script is run? They don't seem to be; in which case is there some macro that holds these values. I have checked the docs but can't find a macro relating to these and checking the gcc.hpp file etc doesn't give any clues. I'd be really grateful if anyone can point to what I'm doing wrong and how I can get my desired build done. A specific example of how to do this in the boost documentation would be ideal. Many thanks, Jeff Clifford. </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/573 Trac 1.4.3 jeffclifford Mon, 06 Mar 2006 11:41:08 GMT <link>https://svn.boost.org/trac10/ticket/573#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/573#comment:1</guid> <description> <pre class="wiki">Logged In: YES user_id=1463920 Well I sorted it myself in the end. Got lucky with a google post on how to use -sBUILD option with some other options. The following worked - note the syntax is for tcsh. Also needed to specifically specify the lib64 dir with a -L flag otherwise boost tries to use ther 32-bit lib dir. There is also some horridness with having to split the -Wl,-rpath /apps/Linux64/gcc334/lib64 option with two separate &lt;linkflags&gt; due to the space. The -d2 flag is useful for seeing the debug output for the gcc command only. bjam -sGCC_ROOT_DIRECTORY=/apps/Linux64/gcc334 -sGCC=gcc334 -sGXX=g++334 -sTOOLS=gcc --builddir=./boost_1_33_1-objdir '-sBUILD=&lt;cxxflags&gt;-m64 &lt;cxxflags&gt;-fPIC &lt;linkflags&gt;-m64 &lt;linkflags&gt;-fPIC &lt;linkflags&gt;-L/apps/Linux64/gcc334/lib64 &lt;linkflags&gt;-Wl,-rpath &lt;linkflags&gt;/apps/Linux64/gcc334/lib64' -d2 stage I hope this helps anyone else trying something similar... Jeff. </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>René Rivera</dc:creator> <pubDate>Mon, 18 Sep 2006 15:07:51 GMT</pubDate> <title>status changed https://svn.boost.org/trac10/ticket/573#comment:2 https://svn.boost.org/trac10/ticket/573#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> </ul> Ticket anonymous Sun, 07 Oct 2012 13:55:41 GMT severity set https://svn.boost.org/trac10/ticket/573#comment:3 https://svn.boost.org/trac10/ticket/573#comment:3 <ul> <li><strong>severity</strong> → <span class="trac-field-new">Problem</span> </li> </ul> Ticket