简体   繁体   中英

building boost with custom compiler in support of rose compiler infrastructure

I am attempting to install rose compiler infrastructure on a Centos 7 box. Normally I would pester people on the rose compiler mailing list, but I believe the problem lies with the boost libraries.

First, rose has some strict build requirements

  • gcc, version 4.0 through 4.4.x (inclusive)
  • gfortran, version 4.2.x through 4.4.x (inclusive)
  • boost, version 1.36.0 through 1.45.0 (inclusive)

The issue, is that the normal version of gcc that ships with Centos 7 is version 4.8.2 and normal version of boost libraries is 1.53 .... so it is recompile hell for me :).

So, I downloaded the source for gcc-4.4.7 and compiled it /opt/gcc447. I did run the test-suit and got the expected number of passes and fails so I am confident that the compiler tool chain is working.

I also downloaded the source for boost-1.45, built and installed it into /opt/boost-1.45.

Now, running the configure script for rose I get this error:

CC=gcc44 CXX=g++44 ../rose/configure --prefix=/home/******/bin/rose --with-boost=/opt/boost-1.45.0
checking for ROSE Git version information in '../rose'...  9a977c899a09c17903dd3005b88ae7d2c06bfacf 1377627277

Configuring ROSE, version 0.9.5a (9a977c899a09c17903dd3005b88ae7d2c06bfacf)
....
In ROSE/configure: ac_boost_path = /opt/boost-1.45.0
checking for GraphViz's dot program in path... yes
checking whether the Boost::Thread library is available... no
checking whether the Boost::Date_Time library is available... yes
checking for toupper in -lboost_date_time... no
checking for toupper in -lboost_date_time... (cached) no
checking for toupper in -lboost_date_time... (cached) no
configure: error: Could not link against boost_date_time !

Doing the normal checks, I make sure that libboost_data_time.so.1.45.0 exists (it does), it is the correct file type and permissions are not wonky. Looking at the config.log, I find this:

configure:13690: g++44 -o conftest   -I/opt/boost-1.45.0/include   -L/opt/boost-1.45.0/lib conftest.cpp -lboost_date_time   >&5
/opt/boost-1.45.0/lib/libboost_date_time.so: undefined reference to `std::out_of_range::~out_of_range()@GLIBCXX_3.4.15'
collect2: ld returned 1 exit status
configure:13690: $? = 1
configure: failed program was:
| #ifdef __cplusplus
| extern "C"
| #endif
| char toupper ();
| int main ()
| {
|     return toupper ();
|     ;
|   return 0;
| }

So, I copy the program that failed (named it to toupper_test.cpp) and tried compiling first with the default compiler:

[******@broadsword rose-build]$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) 
[******@broadsword rose-build]$ g++ -o toupper1 -I/opt/boost-1.45.0/include -L/opt/boost-1.45.0/lib toupper_test.cpp -lboost_date_time
[******@broadsword rose-build]$ 

and the test progam compiles successfully, however attempting to compiler with the 4.4.7 version of gcc yields:

[******@broadsword rose-build]$ /opt/gcc447/bin/g++44 -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.4.7/configure --prefix=/opt/gcc447 --program-suffix=44 --enable-languages=c,c++,objc,java,fortran --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable--libunwind-exceptions
Thread model: posix
gcc version 4.4.7 (GCC) 
[******@broadsword rose-build]$ /opt/gcc447/bin/g++ -o toupper2 -I/opt/boost-1.45.0/include -L/opt/boost-1.45.0/lib toupper_test.cpp -lboost_date_time
bash: /opt/gcc447/bin/g++: No such file or directory
[******@broadsword rose-build]$ /opt/gcc447/bin/g++44 -o toupper2 -I/opt/boost-1.45.0/include -L/opt/boost-1.45.0/lib toupper_test.cpp -lboost_date_time
/opt/boost-1.45.0/lib/libboost_date_time.so: undefined reference to `std::out_of_range::~out_of_range()@GLIBCXX_3.4.15'
collect2: ld returned 1 exit status

and the compilation fails.

So, after I realized that I compiled boost with the default compiler, I wasn't too surprised, but I can't seem to get boost compiled with the 4.4 version of the compiler..I've tried a number of things;

  • setting the version of gcc in the user configuration file
  • setting the version of gcc in the project configuration file
  • trying to set the environmental variables CC and CXX on the command line (ok..i was getting desperate here)
  • making sym-links from /opt/gcc447/bin/gcc47 to /opt/gcc47/bin/gcc (as the other programs as well) and making sure /opt/gcc447/bin/ was first in the path

Nothing to date has worked.

I am out of ideas to try here...anyone got a suggestion or hint?

Thanks!

Working for me solution. My default compiler is gcc 4.9, but I want compile with /usr/bin/gcc-4.7.3

I use boost_1_45_0.

I put such config file into my home directory:

cat /home/evgeniy/user-config.jam 

using gcc : : /usr/bin/g++-4.7.3 ;

Note: it should be in home directory, not in boost source tree

then I run

./bootstrap.sh
./bjam toolset=gcc-4.7.3

to check that all things works as expected you can try:

strace -f ./bjam toolset=gcc-4.7.3 > /tmp/log 2>&1 &
grep execve /tmp/log

if all right you see something like:

execve("/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/...

PS

The first time I put user-config.jam into root of boost source tree, and saw:

execve("/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.0/...

after moving user-config.jam all works as expected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM