Hi everyone, Here is my question: what do I have to do to cross-compile boost with this compiler? Right now, the libraries and files associated with threading are the most important to me. I am starting to work with boost at the behest of a coworker. My goal is to get boost compiled for an embedded linux environment. My current setup includes my desktop running Ubuntu which also hosts the buildroot for the embedded linux environment. I have downloaded boost_1_36_0.tar.bz2 and have extracted it to /usr/local/boost_1_36_0/. For the sake of simplicity, let's say that the compiler for the embedded linux environment resides at .../staging_dir/bin/arm-linux-gcc-4.1.1 Thanks in advance for your help. Rich -- There is nothing more practical than a good theory. James Maxwell
Richard Ketcham wrote:
Hi everyone,
Here is my question: what do I have to do to cross-compile boost with this compiler? Right now, the libraries and files associated with threading are the most important to me.
I am starting to work with boost at the behest of a coworker. My goal is to get boost compiled for an embedded linux environment. My current setup includes my desktop running Ubuntu which also hosts the buildroot for the embedded linux environment. I have downloaded boost_1_36_0.tar.bz2 and have extracted it to /usr/local/boost_1_36_0/.
Putting sources you are about to just build into /usr/local does not seem like a good idea.
For the sake of simplicity, let's say that the compiler for the embedded linux environment resides at .../staging_dir/bin/arm-linux-gcc-4.1.1
Add: using gcc : arm : .../staging_dir/bin/arm-linux-g++-4.1.1 ; to user-config.jam. Run: bjam toolset=gcc-arm - Volodya
Hi, thank you for the reply. I tried what you suggested. I added the using gcc command to the user-config.jam file in tools/build/v2/. I then issued the following command in the boost root directory: ~/boost_1_36_0$ bjam toolset=gcc-arm variant=release threading=multi --with-thread stage and came up with this error: ./boost/config/requires_threads.hpp:29:4: error: #error "Threading support unavaliable: it has been explicitly disabled with BOOST_DISABLE_THREADS" What do I need to do to enable threading? I'm specifically building boost because I'm interested in the threading library. Thanks again, Rich BTW, I moved the boost directory to my home folder. On Tue, Sep 16, 2008 at 1:50 PM, Vladimir Prus <vladimir@codesourcery.com> wrote:
Richard Ketcham wrote:
Hi everyone,
Here is my question: what do I have to do to cross-compile boost with this compiler? Right now, the libraries and files associated with threading are the most important to me.
I am starting to work with boost at the behest of a coworker. My goal is to get boost compiled for an embedded linux environment. My current setup includes my desktop running Ubuntu which also hosts the buildroot for the embedded linux environment. I have downloaded boost_1_36_0.tar.bz2 and have extracted it to /usr/local/boost_1_36_0/.
Putting sources you are about to just build into /usr/local does not seem like a good idea.
For the sake of simplicity, let's say that the compiler for the embedded linux environment resides at .../staging_dir/bin/arm-linux-gcc-4.1.1
Add:
using gcc : arm : .../staging_dir/bin/arm-linux-g++-4.1.1 ;
to user-config.jam. Run:
bjam toolset=gcc-arm
- Volodya
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- There is nothing more practical than a good theory. James Maxwell
Richard Ketcham wrote:
Hi, thank you for the reply.
I tried what you suggested. I added the using gcc command to the user-config.jam file in tools/build/v2/. I then issued the following command in the boost root directory:
~/boost_1_36_0$ bjam toolset=gcc-arm variant=release threading=multi --with-thread stage
and came up with this error:
./boost/config/requires_threads.hpp:29:4: error: #error "Threading support unavaliable: it has been explicitly disabled with BOOST_DISABLE_THREADS"
It means Boost.Config does not think you have threads in your compiler. Does 'your-cross-gcc -v' report any threading been enabled? Here's what I get, for example: $ arm-none-linux-gnueabi-gcc -v Using built-in specs. Target: arm-none-linux-gnueabi Configured with: /scratch/vladimir/arm-linux-preview/src/gcc-trunk-4.3/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi --enable-threads .... Thread model: posix Do you see '--enable-threads' and 'Thread model' in the output of your compiler? - Volodya
Richard Ketcham wrote:
Hi, thank you for the reply.
I tried what you suggested. I added the using gcc command to the user-config.jam file in tools/build/v2/. I then issued the following command in the boost root directory:
~/boost_1_36_0$ bjam toolset=gcc-arm variant=release threading=multi --with-thread stage
and came up with this error:
./boost/config/requires_threads.hpp:29:4: error: #error "Threading support unavaliable: it has been explicitly disabled with BOOST_DISABLE_THREADS"
What do I need to do to enable threading? I'm specifically building boost because I'm interested in the threading library.
Hmm, assuming your compiler is in multithreaded mode, then I'm guessing that libstdc++ was built single threaded? HTH, John.
Oh wow. Yep, that's seems to be exactly what happened. I rebuilt gcc with linuxthreads enabled, here's the output after doing that: rich@rich-desktop:~/gumstix/gumstixLatest/build_arm_nofpu/staging_dir/bin$ ./arm-linux-gcc-4.1.1 -v Using built-in specs. Target: arm-linux-uclibcgnueabi Configured with: /home/rich/gumstix/gumstixLatest/toolchain_build_arm_nofpu/gcc-4.1.1/configure --prefix=/home/rich/gumstix/gumstixLatest/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibcgnueabi --enable-languages=c,c++ --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --enable-threads --disable-multilib --with-float=soft --with-cpu=iwmmxt --with-arch=armv5te --with-tune=iwmmxt --without-fp Thread model: posix gcc version 4.1.1 The thread library seems to compile fine: rich@rich-desktop:~/boost_1_36_0$ bjam --toolset=gcc-arm -sNO_BZIP2=1 --variant=release --with-thread stage warning: Graph library does not contain optional GraphML reader. note: to enable GraphML support, set EXPAT_INCLUDE and EXPAT_LIBPATH to the note: directories containing the Expat headers and libraries, respectively. warning: skipping optional Message Passing Interface (MPI) library. note: to enable MPI support, add "using mpi ;" to user-config.jam. note: to suppress this message, pass "--without-mpi" to bjam. note: otherwise, you can safely ignore this message. Building Boost.Regex with the optional Unicode/ICU support disabled. Please refer to the Boost.Regex documentation for more information (don't panic: this is a strictly optional feature). ...patience... ...found 722 targets... ...updating 25 targets... MkDir1-quick-fix-for-unix stage MkDir1-quick-fix-for-unix stage/lib MkDir1-quick-fix-for-unix bin.v2 MkDir1-quick-fix-for-unix bin.v2/libs MkDir1-quick-fix-for-unix bin.v2/libs/thread MkDir1-quick-fix-for-unix bin.v2/libs/thread/build MkDir1-quick-fix-for-unix bin.v2/libs/thread/build/gcc-arm MkDir1-quick-fix-for-unix bin.v2/libs/thread/build/gcc-arm/release MkDir1-quick-fix-for-unix bin.v2/libs/thread/build/gcc-arm/release/threading-multi gcc.compile.c++ bin.v2/libs/thread/build/gcc-arm/release/threading-multi/thread.o gcc.compile.c++ bin.v2/libs/thread/build/gcc-arm/release/threading-multi/exceptions.o gcc.compile.c++ bin.v2/libs/thread/build/gcc-arm/release/threading-multi/once.o gcc.link.dll bin.v2/libs/thread/build/gcc-arm/release/threading-multi/libboost_thread-gcc-mt-1_36.so.1.36.0 common.copy stage/lib/libboost_thread-gcc-mt-1_36.so.1.36.0 ln-UNIX stage/lib/libboost_thread-gcc-mt-1_36.so ln-UNIX stage/lib/libboost_thread-gcc-mt.so MkDir1-quick-fix-for-unix bin.v2/libs/thread/build/gcc-arm/release/link-static MkDir1-quick-fix-for-unix bin.v2/libs/thread/build/gcc-arm/release/link-static/threading-multi gcc.compile.c++ bin.v2/libs/thread/build/gcc-arm/release/link-static/threading-multi/thread.o gcc.compile.c++ bin.v2/libs/thread/build/gcc-arm/release/link-static/threading-multi/exceptions.o gcc.compile.c++ bin.v2/libs/thread/build/gcc-arm/release/link-static/threading-multi/once.o gcc.archive bin.v2/libs/thread/build/gcc-arm/release/link-static/threading-multi/libboost_thread-gcc-mt-1_36.a common.copy stage/lib/libboost_thread-gcc-mt-1_36.a ln-UNIX stage/lib/libboost_thread-gcc-mt.a ...updated 25 targets... rich@rich-desktop:~/boost_1_36_0$ However, when I go to compile the thread.cpp example (I commented out the other examples in the Jamfile.v2) in ~/boost_1_36_0/libs/thread/example/, it errors out: rich@rich-desktop:~/boost_1_36_0/libs/thread/example$ bjam --toolset=gcc-arm --variant=release warning: Graph library does not contain optional GraphML reader. note: to enable GraphML support, set EXPAT_INCLUDE and EXPAT_LIBPATH to the note: directories containing the Expat headers and libraries, respectively. warning: skipping optional Message Passing Interface (MPI) library. note: to enable MPI support, add "using mpi ;" to user-config.jam. note: to suppress this message, pass "--without-mpi" to bjam. note: otherwise, you can safely ignore this message. Building Boost.Regex with the optional Unicode/ICU support disabled. Please refer to the Boost.Regex documentation for more information (don't panic: this is a strictly optional feature). ...patience... ...found 719 targets... ...updating 1 target... gcc.link ../../../bin.v2/libs/thread/example/gcc-arm/debug/threading-multi/thread ../../../bin.v2/libs/thread/example/gcc-arm/debug/threading-multi/thread.o: In function `__static_initialization_and_destruction_0': /home/rich/gumstix/gumstixLatest/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibcgnueabi/4.1.1/../../../../include/c++/4.1.1/iostream:76: undefined reference to `std::ios_base::Init::Init()' /home/rich/gumstix/gumstixLatest/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibcgnueabi/4.1.1/../../../../include/c++/4.1.1/iostream:76: undefined reference to `std::ios_base::Init::~Init()' ../../../bin.v2/libs/thread/example/gcc-arm/debug/threading-multi/thread.o: In function `main': /home/rich/boost_1_36_0/libs/thread/example/thread.cpp:31: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)' /home/rich/boost_1_36_0/libs/thread/example/thread.cpp:31: undefined reference to `std::basic_ostream<char, std::char_traits<char>
::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))' /home/rich/boost_1_36_0/libs/thread/example/thread.cpp:34: undefined reference to `__cxa_end_cleanup' /home/rich/boost_1_36_0/libs/thread/example/thread.cpp:35: undefined reference to `std::cout' /home/rich/boost_1_36_0/libs/thread/example/thread.cpp:35: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)' ../../../bin.v2/libs/thread/example/gcc-arm/debug/threading-multi/thread.o:(.ARM.extab+0x24): undefined reference to `__gxx_personality_v0' ../../../bin.v2/libs/thread/example/gcc-arm/debug/threading-multi/thread.o: In function `mutex': /home/rich/boost_1_36_0/libs/thread/example/../../../boost/thread/pthread/mutex.hpp:40: undefined reference to `__cxa_allocate_exception' /home/rich/boost_1_36_0/libs/thread/example/../../../boost/thread/pthread/mutex.hpp:40: undefined reference to `__cxa_throw' /home/rich/boost_1_36_0/libs/thread/example/../../../boost/thread/pthread/mutex.hpp:40: undefined reference to `__cxa_free_exception' /home/rich/boost_1_36_0/libs/thread/example/../../../boost/thread/pthread/mutex.hpp:42: undefined reference to `__cxa_end_cleanup' ../../../bin.v2/libs/thread/example/gcc-arm/debug/threading-multi/thread.o:(.ARM.extab.text._ZN5boost5mutexC1Ev[boost::mutex::mutex()]+0x0): undefined reference to `__gxx_personality_v0'
....etc... I didn't think you needed to see the rest of this. What do you think is the problem? It's referencing iostream.h ... my using command is defined as follows: using gcc : arm : /home/rich/gumstix/gumstixLatest/build_arm_nofpu/staging_dir/bin/arm-linux-gcc-4.1.1 : <cxxflags>-I/home/rich/gumstix/gumstixLatest/build_arm_nofpu/staging_dir/usr/include/ ; Thanks again, Rich -- There is nothing more practical than a good theory. James Maxwell
Richard Ketcham wrote:
Oh wow. Yep, that's seems to be exactly what happened. I rebuilt gcc with linuxthreads enabled, here's the output after doing that:
Whew, that was a good guess then :-)
However, when I go to compile the thread.cpp example (I commented out the other examples in the Jamfile.v2) in ~/boost_1_36_0/libs/thread/example/, it errors out:
Those are all C++ std lib symbols.
What do you think is the problem? It's referencing iostream.h ... my using command is defined as follows:
using gcc : arm : /home/rich/gumstix/gumstixLatest/build_arm_nofpu/staging_dir/bin/arm-linux-gcc-4.1.1
<cxxflags>-I/home/rich/gumstix/gumstixLatest/build_arm_nofpu/staging_dir/usr/include/
Ah, you've told bjam to use the gcc C compiler: and while that will correctly compile C++ code, when used as a linker it doesn't know anything about the C++ runtime libraries required, and hence the errors. Use the g++ variant in /home/rich/gumstix/gumstixLatest/build_arm_nofpu/staging_dir/bin/ if you have one, if you don't then I'm at a loss, consult the docs for the ambedded linux version to see how you're supposed to link C++ code I guess ! :-) HTH, John.
Richard Ketcham wrote:
../../../bin.v2/libs/thread/example/gcc-arm/debug/threading-multi/thread.o (.ARM.extab.text._ZN5boost5mutexC1Ev[boost::mutex::mutex()]+0x0): undefined reference to `__gxx_personality_v0'
....etc... I didn't think you needed to see the rest of this.
What do you think is the problem? It's referencing iostream.h ... my using command is defined as follows:
using gcc : arm : /home/rich/gumstix/gumstixLatest/build_arm_nofpu/staging_dir/bin/arm-linux-gcc-4.1.1 : <cxxflags>-I/home/rich/gumstix/gumstixLatest/build_arm_nofpu/staging_dir/usr/include/ ;
You did not follow my instructions in one aspect, it seems. I said: Add: using gcc : arm : .../staging_dir/bin/arm-linux-g++-4.1.1 ; and you added, in effect: using gcc : arm : .../staging_dir/bin/arm-linux-gcc-4.1.1 ; This aspect is covered in the fine Boost.Build manual, the Reference->Builtin tools section. - Volodya
Oh, I'm sorry about that. It's changed now. This is what I'm getting now: rich@rich-desktop:~/boost_1_36_0/libs/thread/example$ bjam --toolset=gcc-arm warning: Graph library does not contain optional GraphML reader. note: to enable GraphML support, set EXPAT_INCLUDE and EXPAT_LIBPATH to the note: directories containing the Expat headers and libraries, respectively. warning: skipping optional Message Passing Interface (MPI) library. note: to enable MPI support, add "using mpi ;" to user-config.jam. note: to suppress this message, pass "--without-mpi" to bjam. note: otherwise, you can safely ignore this message. Building Boost.Regex with the optional Unicode/ICU support disabled. Please refer to the Boost.Regex documentation for more information (don't panic: this is a strictly optional feature). ...patience... ...found 764 targets... ...updating 11 targets... gcc.link ../../../bin.v2/libs/thread/example/gcc-arm/debug/threading-multi/monitor ../../../bin.v2/libs/thread/build/gcc-arm/debug/threading-multi/libboost_thread-gcc-mt-d-1_36.so.1.36.0: undefined reference to `get_nprocs' ../../../bin.v2/libs/thread/build/gcc-arm/debug/threading-multi/libboost_thread-gcc-mt-d-1_36.so.1.36.0: undefined reference to `__sync_add_and_fetch_4' collect2: ld returned 1 exit status The linking continues to fail with the same two errors. -Rich
Richard Ketcham wrote:
Oh, I'm sorry about that. It's changed now. This is what I'm getting now:
rich@rich-desktop:~/boost_1_36_0/libs/thread/example$ bjam --toolset=gcc-arm warning: Graph library does not contain optional GraphML reader. note: to enable GraphML support, set EXPAT_INCLUDE and EXPAT_LIBPATH to the note: directories containing the Expat headers and libraries, respectively. warning: skipping optional Message Passing Interface (MPI) library. note: to enable MPI support, add "using mpi ;" to user-config.jam. note: to suppress this message, pass "--without-mpi" to bjam. note: otherwise, you can safely ignore this message. Building Boost.Regex with the optional Unicode/ICU support disabled. Please refer to the Boost.Regex documentation for more information (don't panic: this is a strictly optional feature). ...patience... ...found 764 targets... ...updating 11 targets... gcc.link ../../../bin.v2/libs/thread/example/gcc-arm/debug/threading-multi/monitor ../../../bin.v2/libs/thread/build/gcc-arm/debug/threading-multi/libboost_thread-gcc-mt-d-1_36.so.1.36.0: undefined reference to `get_nprocs' ../../../bin.v2/libs/thread/build/gcc-arm/debug/threading-multi/libboost_thread-gcc-mt-d-1_36.so.1.36.0: undefined reference to `__sync_add_and_fetch_4' collect2: ld returned 1 exit status
The linking continues to fail with the same two errors.
The second error is caused by shared_ptr using gcc atomic intrinsics that are not actually supported on ARM. This was discussed before on boost mailing lists, the workaround is some define making shared_ptr use pthread's mutexes -- google will tell for sure. I don't know anything about the first error. - Volodya
Vladimir Prus:
Richard Ketcham wrote:
...
../../../bin.v2/libs/thread/build/gcc-arm/debug/threading-multi/libboost_thread-gcc-mt-d-1_36.so.1.36.0: undefined reference to `__sync_add_and_fetch_4' collect2: ld returned 1 exit status
The linking continues to fail with the same two errors.
The second error is caused by shared_ptr using gcc atomic intrinsics that are not actually supported on ARM.
I think that in 1.36, __sync_add_and_fetch is only used by detail::atomic_count, not shared_ptr. The fix in this case would be to add && !defined(__arm__) to the line #elif defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) in boost/detail/atomic_count.hpp.
Richard Ketcham wrote:
../../../bin.v2/libs/thread/example/gcc-arm/debug/threading-multi/monitor ../../../bin.v2/libs/thread/build/gcc-arm/debug/threading-multi/libboost_thread-gcc-mt-d-1_36.so.1.36.0: undefined reference to `get_nprocs'
get_nprocs is a gcc extension: http://www.gnu.org/software/libtool/manual/libc/Processor-Resources.html that seems not to be supported on your platform? Probably some #ifdef logic in the thread lib would fix this one: try grepping for the symbol. HTH, John.
participants (4)
-
John Maddock
-
Peter Dimov
-
Richard Ketcham
-
Vladimir Prus