Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

Segmentation fault at startup when mixing gcc-built Boost C++ libraries with an icpc-built program

Jason_R
Beginner
475 Views

I've run into a problem recently with the v13.x series of the Intel C++ compiler. I previously documented the problem in some more detail at the following Stack Overflow post;

http://stackoverflow.com/questions/18927939/segfault-during-static-initi...

In short: if I have a system with a version of the Boost C++ libraries installed that was built using gcc, and I try to build a program using icpc that links to the Boost.Thread library, the resulting program yields a segmentation fault during static/global object initialization. Only this permutation of compilers causes a problem. If I build Boost using icpc, then I can build programs successfully using gcc or icpc. If I build Boost with gcc and build a test program using gcc, it also works just fine. I have duplicated this behavior on Ubuntu 12.04 and Ubuntu 13.04; the former should at least be a supported platform for this release of the compiler.

I haven't had the chance to try a newer version of the compiler, as my support period has expired. For this reason, I've also been unable to submit the issue to Intel's support, but I thought I would try here to see if any more information was available. It appears to be a bug in the Intel toolchain of some kind.

Steps to reproduce:

1. Start with an Ubuntu 12.04 system.

2. Download the latest version of the Boost C++ libraries: http://sourceforge.net/projects/boost/files/latest/download?source=files (note that I've been able to duplicate the problem using a few different versions of Boost, including 1.41, 1.53, 1.54, and the latest SVN version)

3. Extract the archive: tar xjf boost_1_54_0.tar.bz2

4. Build the library; it should default to the gcc toolset on Linux;
    cd boost_1_54_0
    ./bootstrap.sh
    ./b2 debug-symbols=on

5. After the build is complete, the resulting libraries are located in the ./stage/lib subdirectory. Save the following test program to the file "test.cc":
    #include <boost/version.hpp>
    #include <boost/thread.hpp>
    int main()
    {
        boost::this_thread::sleep(boost::posix_time::seconds(1));
    }

6. Now, build the program using icpc:
    icpc test.cc -o test -Lstage/lib -lboost_thread -lboost_system

7. Run the resulting program:
    ./test
    The program should die with a segmentation fault immediately. If you use a debugger, you can see that the fault occurs during static initialization.

8. Verify that the program should work using g++:
    g++ test.cc -o test -Lstage/lib -lboost_thread -lboost_system
    ./test
    The program should pause for one second and then exit successfully.

If anyone has any recommendations on how I should proceed, I would appreciate it. Thank you.

0 Kudos
0 Replies
Reply