Re: Boost linking problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 18 October 2017 at 04:00, Mahmood N via gcc-help
<gcc-help@xxxxxxxxxxx> wrote:
> Hi there,
>
>
> I am using a 2012 code which uses gcc-4.6. I know it is old but I am not testing that with current OS versions due to the dependency problems. So, I have installed a virtual ubuntu-12.04 for this purpose.
>
>
>
>
>
> The following g++ command returns an undefined reference error which is related to boost libraries
>
>
>
> mahmood@vb:AES$ g++ -fPIC -m64 \
>> -o /home/mahmood/gpgpu-sim_distribution/ispass2009-benchmarks/bin/release/AES \
>> obj/x86_64/release/aescuda.cpp.o \
>> obj/x86_64/release/aesCudaUtils.cpp.o \
>> obj/x86_64/release/aesHost.cu.o \
>> -L/usr/local/cuda/lib64 \
>> -L/home/mahmood/NVIDIA_GPU_Computing_SDK/C/lib \
>> -L/home/mahmood/NVIDIA_GPU_Computing_SDK/C/common/lib/linux \
>> -L/home/mahmood/NVIDIA_GPU_Computing_SDK/shared/lib \
>> -lcudart -lcutil_x86_64  -lshrutil_x86_64
> obj/x86_64/release/aescuda.cpp.o: In function `_GLOBAL__sub_I_aescuda.cpp':
> aescuda.cpp:(.text.startup+0x68b): undefined reference to `boost::system::get_system_category()'
> aescuda.cpp:(.text.startup+0x697): undefined reference to `boost::system::get_generic_category()'

That's unsurprising, because you didn't link to any boost libraries.


> ....
>
>
>
> I simply include the required library files, but still get the same error.
>
>
>
> mahmood@vb:AES$ find /home/mahmood/boost_1_54_0/ -name libboost_filesystem*
> /home/mahmood/boost_1_54_0/bin.v2/libs/filesystem/build/gcc-4.6/release/link-static/threading-multi/libboost_filesystem.a
> /home/mahmood/boost_1_54_0/bin.v2/libs/filesystem/build/gcc-4.6/release/threading-multi/libboost_filesystem.so.1.54.0
> /home/mahmood/boost_1_54_0/stage/lib/libboost_filesystem.so.1.54.0
> /home/mahmood/boost_1_54_0/stage/lib/libboost_filesystem.a
>
> /home/mahmood/boost_1_54_0/stage/lib/libboost_filesystem.so
>
>
>
> However
>
>
>
> mahmood@vb:AES$ g++ -fPIC -m64 \
>> -o /home/mahmood/gpgpu-sim_distribution/ispass2009-benchmarks/bin/release/AES \
>> obj/x86_64/release/aescuda.cpp.o \
>> obj/x86_64/release/aesCudaUtils.cpp.o \
>> obj/x86_64/release/aesHost.cu.o \
>> -L/usr/local/cuda/lib64 \
>> -L/home/mahmood/NVIDIA_GPU_Computing_SDK/C/lib \
>> -L/home/mahmood/NVIDIA_GPU_Computing_SDK/C/common/lib/linux \
>> -L/home/mahmood/NVIDIA_GPU_Computing_SDK/shared/lib \
>> -lcudart -lcutil_x86_64  -lshrutil_x86_64 \
>> -L/home/mahmood/boost_1_54_0/stage/lib \
>> -lboost_system -lboost_filesystem
> obj/x86_64/release/aescuda.cpp.o: In function `_GLOBAL__sub_I_aescuda.cpp':
> aescuda.cpp:(.text.startup+0x68b): undefined reference to `boost::system::get_system_category()'
> aescuda.cpp:(.text.startup+0x697): undefined reference to `boost::system::get_generic_category()'



> ....
>
>
>
> I know that the order of those boost libraries are important. But, changing the order has no effect.

Yes, you need to use -lboost_system after -lboost_filesystem, because
libboost_filesystem depends on libboost_system.


> Maybe the problem is with Boost. But I have checked that with the guys and seems to be normal. I think somewhere in the link stage,  g++ forget the library path.

That can't happen.

Use 'nm --demangle
/home/mahmood/boost_1_54_0/stage/lib/libboost_system.so | fgrep
category' to inspect the symbols in the library, does it define the
missing symbols?

Are you sure you're linking to the right libraries that match the
Boost headers you compiled against?



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux