[Boost-users] Static link boost library using arm compiler

570 views
Skip to first unread message

Carlos

unread,
Feb 24, 2010, 8:41:02 AM2/24/10
to boost...@lists.boost.org
Hi

I'm some weeks trying to resolve a problem in static linking a boost library. The compiler finds the library but it says that it is incompatible. I already try to compile boost again with arm compiler, use boost 1_33_1 and boost_1_42_0 but with no results. I think it's missing something but I can't find what.

./configure -host=arm-eabi CC=arm-none-linux-gnueabi-gcc CXX=arm-none-linux-gnueabi-g++ CXXFLAGS=-static --with-boost=/usr/local/boost_1_42_0/

configure: WARNING: If you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used.
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-eabi-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for arm-eabi-gcc... arm-none-linux-gnueabi-gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... yes
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether arm-none-linux-gnueabi-gcc accepts -g... yes
checking for arm-none-linux-gnueabi-gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of arm-none-linux-gnueabi-gcc... gcc3
checking whether we are using the GNU C++ compiler... yes
checking whether arm-none-linux-gnueabi-g++ accepts -g... yes
checking dependency style of arm-none-linux-gnueabi-g++... gcc3
checking for boostlib >= 1.31... yes
checking build system type... i686-pc-linux-gnu
checking whether the Boost::Thread library is available... yes
checking for exit in -lboost_thread... no
checking for exit in -lboost_thread... (cached) no
checking for exit in -lboost_thread... (cached) no
configure: error: Could not link against boost_thread !

Config.log:

configure:4066: checking whether the Boost::Thread library is available
configure:4098: arm-none-linux-gnueabi-g++ -c -pthread -static  -I/usr/local/boost_1_42_0//include conftest.cpp >&5
configure:4098: $? = 0
configure:4113: result: yes
configure:4142: checking for exit in -lboost_thread
configure:4167: arm-none-linux-gnueabi-gcc -o conftest -g -O2  -I/usr/local/boost_1_42_0//include  -L/usr/local/boost_1_42_0//lib conftest.c -lboost_thread   >&5
conftest.c:20: warning: conflicting types for built-in function 'exit'
/home/carlos/arm/arm-2009q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld: skipping incompatible /usr/local/boost_1_42_0//lib/libboost_thread.so when searching for -lboost_thread
/home/carlos/arm/arm-2009q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld: skipping incompatible /usr/local/boost_1_42_0//lib/libboost_thread.a when searching for -lboost_thread
/home/carlos/arm/arm-2009q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld: skipping incompatible /home/carlos/arm/arm-2009q3/bin/../arm-none-linux-gnueabi/libc/usr/lib/libboost_thread.a when searching for -lboost_thread
/home/carlos/arm/arm-2009q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld: skipping incompatible /home/carlos/arm/arm-2009q3/bin/../arm-none-linux-gnueabi/libc/usr/lib/libboost_thread.a when searching for -lboost_thread
/home/carlos/arm/arm-2009q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld: cannot find -lboost_thread
collect2: ld returned 1 exit status



Igor R

unread,
Feb 24, 2010, 9:25:57 AM2/24/10
to boost...@lists.boost.org
> I'm some weeks trying to resolve a problem in static linking a boost
> library. The compiler finds the library but it says that it is incompatible.

Did you try to add architecture=arm to bjam line?
_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Vladimir Prus

unread,
Feb 24, 2010, 9:31:34 AM2/24/10
to boost...@lists.boost.org
Igor R wrote:
>> I'm some weeks trying to resolve a problem in static linking a boost
>> library. The compiler finds the library but it says that it is incompatible.
>
> Did you try to add architecture=arm to bjam line?

I am afraid this will not help, itself. Please see:

http://www.boost.org/boost-build2/doc/html/bbv2/tasks/crosscompile.html

for description how to cross-compile Boost. You might want to first try

bjam ... -n

and double check that command lines use the arm cross compiler before
doing the actual build.

HTH,
Volodya

Carlos

unread,
Feb 24, 2010, 10:27:50 AM2/24/10
to boost...@lists.boost.org
This is how I'm compiling boost:

sudo bjam install --prefix=/usr/local/boost_1_42_0 --layout=system -toolset=gcc-arm link=static runtime-link=static

I still need the arquitecture=arm?

-----||-----
project-config.jam
# Boost.Build Configuration
# Automatically generated by bootstrap.sh

import option ;
import feature ;

# Compiler configuration. This definition will be used unless
# you already have defined some toolsets in your user-config.jam
# file.
if ! gcc in [ feature.values <toolset> ]
{
    using gcc : arm : /home/carlos/arm/arm-2009q3/bin/arm-none-linux-gnueabi-g++  ;
}

project : default-build <toolset>gcc ;

# Python configuration
using python : 2.6 : /usr ;

path-constant ICU_PATH : /usr ;


# List of --with-<library> and --without-<library>
# options. If left empty, all libraries will be built.
# Options specified on the command line completely
# override this variable.
libraries =  ;

# These settings are equivivalent to corresponding command-line
# options.
option.set prefix : /usr/local ;
option.set exec-prefix : /usr/local ;
option.set libdir : /usr/local/lib ;
option.set includedir : /usr/local/include ;


-----||-----

/usr/share/boost-build/user-config.jam

# Copyright 2003, 2005 Douglas Gregor
# Copyright 2004 John Maddock
# Copyright 2002, 2003, 2004 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)

#  This file is used to configure your Boost.Build installation. Please read
#  the user manual to find out where to put it.

#  Toolset declarations are most important in this file. They tell Boost.Build
#  what compilers are available and where to look for them. The first toolset
#  will become "default" one.
#  Some important libraries can also be configured.
#  Uncomment relevant parts to suite your local configuration and preferences.

#  GCC configuration

#  Configure gcc (default version)
#  using gcc ;
using gcc : arm : /home/carlos/arm/arm-2009q3/bin/arm-none-linux-gnueabi-g++  ;


#  Configure specific gcc version, giving alternative name to use
#  using gcc : 3.2 : g++-3.2 ;

#  MSVC configuration

#  Configure msvc (default version, searched in standard location
#  and PATH).
#  using msvc ;

#  Borland configuration
#  using borland ;


#  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 locatioh of both headers and libraries
#  using stlport : : /usr/include/stlport /usr/lib ;


#  QT configuration

#  Configure, assuming QTDIR gives the installation prefix
#  using qt ;

#  Configure with explicit installation prefix
#  using qt : /usr/opt/qt ;

-----||-----

I've doing some testes and if I compile this way he don't complain:
arm-none-linux-gnueabi-gcc -o main -g -O2  -I/usr/local/boost_1_42_0//include  -L/usr/local/boost_1_42_0//lib main.c /usr/local/boost_1_33_1/lib/libboost_thread-mt.a

but if I use the -lboost_thread flag he give the error I told in the first post:
arm-none-linux-gnueabi-gcc -o main -g -O2  -I/usr/local/boost_1_42_0//include  -L/usr/local/boost_1_42_0//lib main.c -lboost_thread

I try to change the ax_boost_thread.m4 so I could give the correct path but with no sucess.
I'm out of ideias to resolve this.....

Vladimir Prus

unread,
Feb 24, 2010, 10:38:26 AM2/24/10
to boost...@lists.boost.org
Carlos wrote:
> This is how I'm compiling boost:
>
> sudo bjam install --prefix=/usr/local/boost_1_42_0 --layout=system
> -toolset=gcc-arm link=static runtime-link=static

If there actually "-" before "toolset"? It should not be there. Please remove
it, add "-n" and "-a" options, run that command again, and post an example
compilation command.

- Volodya

Carlos

unread,
Feb 24, 2010, 10:53:22 AM2/24/10
to boost...@lists.boost.org
I don't know why I put that "-" there...I've compile it so many times already that I'm confused.....

sudo bjam install --prefix=/usr/local/boost_1_42_0 --layout=system toolset=gcc-arm link=static runtime-link=static -n -a

Now it was succeded in all updates! And now I'me rebuild everything with:

sudo bjam install --prefix=/usr/local/boost_1_42_0 --layout=system toolset=gcc-arm link=static runtime-link=static -a

Carlos

unread,
Feb 24, 2010, 11:08:03 AM2/24/10
to boost...@lists.boost.org
...failed updating 1 target...
...skipped 3 targets...
...updated 8079 targets...

but it still don't find the library

root@carlos-laptop:~/odtone# ./configure -host=arm-eabi CC=arm-none-linux-gnueabi-gcc CXX=arm-none-linux-gnueabi-g++ --with-boost=/usr/local/boost_1_42_0/
configure: error: Could not link against boost_thread !


The library exists:
carlos-laptop:~/odtone# find /usr/local/boost_1_42_0//lib/libboost_thread.a
/usr/local/boost_1_42_0//lib/libboost_thread.a

but I continue to get
skipping incompatible /usr/local/boost_1_42_0//lib/libboost_thread.a when searching for -lboost_thread

config.log

configure:4167: arm-none-linux-gnueabi-gcc -o conftest -g -O2  -I/usr/local/boost_1_42_0//include  -L/usr/local/boost_1_42_0//lib conftest.c -lboost_thread   >&5
conftest.c:20: warning: conflicting types for built-in function 'exit'
/home/carlos/arm/arm-2009q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld: skipping incompatible /usr/local/boost_1_42_0//lib/libboost_thread.a when searching for -lboost_thread
/home/carlos/arm/arm-2009q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld: skipping incompatible /home/carlos/arm/arm-2009q3/bin/../arm-none-linux-gnueabi/libc/usr/lib/libboost_thread.a when searching for -lboost_thread
/home/carlos/arm/arm-2009q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld: skipping incompatible /home/carlos/arm/arm-2009q3/bin/../arm-none-linux-gnueabi/libc/usr/lib/libboost_thread.a when searching for -lboost_thread
/home/carlos/arm/arm-2009q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld: cannot find -lboost_thread
collect2: ld returned 1 exit status

If I found some way to change the -lboost_thread to my /usr/local/boost_1_42_0//lib/libboost_thread.a I think it will link but I can't do it in m4 files.

Vladimir Prus

unread,
Feb 24, 2010, 11:15:17 AM2/24/10
to boost...@lists.boost.org
Carlos wrote:
> I don't know why I put that "-" there...I've compile it so many times
> already that I'm confused.....
>
> sudo bjam install --prefix=/usr/local/boost_1_42_0 --layout=system
> toolset=gcc-arm link=static runtime-link=static -n -a
>
> Now it was succeded in all updates! And now I'me rebuild everything with:
>
> sudo bjam install --prefix=/usr/local/boost_1_42_0 --layout=system
> toolset=gcc-arm link=static runtime-link=static -a

And -- just to clarify -- after you rebuild you no longer have a problem?

Carlos

unread,
Feb 24, 2010, 11:18:25 AM2/24/10
to boost...@lists.boost.org
I've already done a post with the results...still the same problem
It still says it's incompatible

Vladimir Prus

unread,
Feb 24, 2010, 2:41:52 PM2/24/10
to boost...@lists.boost.org
Carlos wrote:
> ...failed updating 1 target...
> ...skipped 3 targets...
> ...updated 8079 targets...
>
> but it still don't find the library

I am sorry, but as I've said I need the output that is produced with the -n -a options.

Carlos

unread,
Feb 25, 2010, 1:12:30 PM2/25/10
to boost...@lists.boost.org
I already found the problem for this one, I need to pass the library folder in the ./configure

But now I have other problem:

arm-none-linux-gnueabi-g++  -Wall -Wextra -O0 -ggdb -pipe /usr/local/boost_1_42_0/lib/libboost_system.a /usr/local/boost_1_42_0/lib/libboost_thread.a /usr/local/boost_1_42_0/lib/libboost_program_options.a  -o link link_link.o link_main.o link_netlink.o link_rnetlink.o link_interface.o link_ethernet.o link-if.o ../mi/lib_mi.a ../s/lib.a ../utils/lib_utils.a
/home/carlos/Arm/arm-2009q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld: warning: ../mi/lib_mi.a(archive.o) uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail
/home/carlos/Arm/arm-2009q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld: warning: ../mi/lib_mi.a(config.o) uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail
link-link.o: In function `__static_initialization_and_destruction_0':
/usr/local/boost_1_42_0/include/boost/system/error_code.hpp:208: undefined reference to `boost::system::get_system_category()'
/usr/local/boost_1_42_0/include/boost/system/error_code.hpp:209: undefined reference to `boost::system::get_generic_category()'
/usr/local/boost_1_42_0/include/boost/system/error_code.hpp:214: undefined reference to `boost::system::get_generic_category()'
/usr/local/boost_1_42_0/include/boost/system/error_code.hpp:215: undefined reference to `boost::system::get_generic_category()'
/usr/local/boost_1_42_0/include/boost/system/error_code.hpp:216: undefined reference to `boost::system::get_system_category()

Steven Watanabe

unread,
Feb 26, 2010, 6:01:39 PM2/26/10
to boost...@lists.boost.org
AMDG

Static libraries need to come after anything that uses them on the
command line.

In Christ,
Steven Watanabe

Reply all
Reply to author
Forward
0 new messages