|
Boost Users : |
Subject: [Boost-users] compile asio against static boost libs
From: Sergiy Nazarenko (nazarenko.sergiy_at_[hidden])
Date: 2012-07-16 11:50:34
Hi all!
I would like to compile my project against static libraries
If I compile my project in following manner:
c++ -I/usr/local/include/boost/1.49.0/ -c -o azio.o azio.cpp
c++ -L/usr/local/lib64/boost/1.49.0/ azio.o -lboost_system -o bin/azio
It is OK. But if I use static libraries:
c++ -I/usr/local/include/boost/1.49.0/ -c -o azio.o azio.cpp
c++
-L/usr/local/lib64/boost/1.49.0/ azio.o
/usr/local/lib64/boost/1.49.0/libboost_system.a
-o bin/azio
I have got error:
azio.o: In function `boost::asio::detail::posix_tss_ptr_create(unsigned
int&)':
azio.cpp:(.text._ZN5boost4asio6detail20posix_tss_ptr_createERj[boost::asio::detail::posix_tss_ptr_create(unsigned
int&)]+0x19): undefined reference to `pthread_key_create'
azio.o: In function `boost::asio::detail::posix_thread::~posix_thread()':
........
........
boost::asio::detail::task_io_service::thread_info>::context>::operator=(boost::asio::detail::call_stack<boost::asio::detail::task_io_service,
boost::asio::detail::task_io_service::thread_info>::context*)]+0x20):
undefined reference to `pthread_setspecific'
collect2: ld returned 1 exit status
I used strings to know where is function pthread_key_create. I found
in libboost_thread.so. Next my step was:
c++
-L/usr/local/lib64/boost/1.49.0/ azio.o
/usr/local/lib64/boost/1.49.0/libboost_system.a
/usr/local/lib64/boost/1.49.0/libboost_thread.a
-o bin/azio
I've try out to mix up places libraries and object file
c++ .. azio.o libboost_system.a libboost_thread.a -o bin/azio
c++ .. libboost_system.a libboost_thread.a azio.o -o bin/azio
c++ .. libboost_thread.a azio.o libboost_system.a -o bin/azio
But error is still.
Thanx,
Sergiy
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net