|
Boost Users : |
Subject: [Boost-users] [Regex]static compilation problems
From: Moritz Beber (moritz.beber_at_[hidden])
Date: 2009-02-15 10:47:24
Dear users,
to start using regular expressions I tried a very simple program only
declaring one regular expression.
#include <boost/regex.hpp>
int main(int , char* [])
{
boost::regex re("\\d+");
return 0;
}
Linking and compiling this with the command:
g++ test.cpp -o test -L ~/libs/boost/lib/ -l boost_regex-gcc43-mt
works without problems, but running it then leads to the following:
error while loading shared libraries:
libboost_system-gcc43-mt-1_37.so.1.37.0: cannot open shared object file:
No such file or directory
But the directory clearly shows its existence:
-rw-rw-r-- 1 engineer engineer 1587006 2008-11-21
07:53 /home/engineer/libs/boost/lib/libboost_regex-gcc43-mt-1_37.a
lrwxrwxrwx 1 engineer engineer 38 2008-11-21
07:50 /home/engineer/libs/boost/lib/libboost_regex-gcc43-mt-1_37.so ->
libboost_regex-gcc43-mt-1_37.so.1.37.0
-rwxrwxr-x 1 engineer engineer 722184 2008-11-21
07:50 /home/engineer/libs/boost/lib/libboost_regex-gcc43-mt-1_37.so.1.37.0
lrwxrwxrwx 1 engineer engineer 30 2008-11-21
07:53 /home/engineer/libs/boost/lib/libboost_regex-gcc43-mt.a ->
libboost_regex-gcc43-mt-1_37.a
lrwxrwxrwx 1 engineer engineer 38 2008-11-21
07:52 /home/engineer/libs/boost/lib/libboost_regex-gcc43-mt.so ->
libboost_regex-gcc43-mt-1_37.so.1.37.0
Then I tried doing the same using static libraries:
g++ -static test.cpp -o test -L ~/libs/boost/lib/ -l
boost_regex-gcc43-mt
but got an extremely long list of errors:
/home/engineer/libs/boost/lib//libboost_regex-gcc43-mt.a(static_mutex.o): In function `boost::scoped_static_mutex_lock::unlock()':
static_mutex.cpp:(.text+0x16): undefined reference to
`pthread_mutex_unlock'
/home/engineer/libs/boost/lib//libboost_regex-gcc43-mt.a(static_mutex.o): In function `boost::scoped_static_mutex_lock::lock()':
static_mutex.cpp:(.text+0x46): undefined reference to
`pthread_mutex_lock'
/home/engineer/libs/boost/lib//libboost_regex-gcc43-mt.a(static_mutex.o): In function `boost::scoped_static_mutex_lock::~scoped_static_mutex_lock()':
static_mutex.cpp:(.text+0x76): undefined reference to
`pthread_mutex_unlock'
/home/engineer/libs/boost/lib//libboost_regex-gcc43-mt.a(static_mutex.o): In function `boost::scoped_static_mutex_lock::~scoped_static_mutex_lock()':
static_mutex.cpp:(.text+0xa6): undefined reference to
`pthread_mutex_unlock'
/home/engineer/libs/boost/lib//libboost_regex-gcc43-mt.a(static_mutex.o): In function `boost::scoped_static_mutex_lock::scoped_static_mutex_lock(boost::static_mutex&, bool)':
static_mutex.cpp:(.text+0xdd): undefined reference to
`pthread_mutex_lock'
/home/engineer/libs/boost/lib//libboost_regex-gcc43-mt.a(static_mutex.o): In function `boost::scoped_static_mutex_lock::scoped_static_mutex_lock(boost::static_mutex&, bool)':
static_mutex.cpp:(.text+0x10d): undefined reference to
`pthread_mutex_lock'
/usr/lib/gcc/i386-redhat-linux/4.3.0/libstdc++.a(locale.o): In function
`__gnu_cxx::__scoped_lock::~__scoped_lock()':
(.text._ZN9__gnu_cxx13__scoped_lockD1Ev[__gnu_cxx::__scoped_lock::~__scoped_lock()]+0x18): undefined reference to `pthread_mutex_unlock'
/usr/lib/gcc/i386-redhat-linux/4.3.0/libstdc++.a(locale.o): In function
`std::locale::_Impl::_M_install_cache(std::locale::facet const*,
unsigned int)':
(.text._ZNSt6locale5_Impl16_M_install_cacheEPKNS_5facetEj+0x2d):
undefined reference to `pthread_mutex_lock'
/usr/lib/gcc/i386-redhat-linux/4.3.0/libstdc++.a(locale.o): In function
`std::locale::_Impl::_M_install_cache(std::locale::facet const*,
unsigned int)':
(.text._ZNSt6locale5_Impl16_M_install_cacheEPKNS_5facetEj+0x59):
undefined reference to `pthread_mutex_unlock'
/usr/lib/gcc/i386-redhat-linux/4.3.0/libstdc++.a(locale_init.o): In
function `std::locale::locale()':
(.text._ZNSt6localeC1Ev+0x2a): undefined reference to
`pthread_mutex_lock'
/usr/lib/gcc/i386-redhat-linux/4.3.0/libstdc++.a(locale_init.o): In
function `std::locale::locale()':
(.text._ZNSt6localeC1Ev+0x52): undefined reference to
`pthread_mutex_unlock'
/usr/lib/gcc/i386-redhat-linux/4.3.0/libstdc++.a(locale_init.o): In
function `std::locale::global(std::locale const&)':
(.text._ZNSt6locale6globalERKS_+0x2a): undefined reference to
`pthread_mutex_lock'
/usr/lib/gcc/i386-redhat-linux/4.3.0/libstdc++.a(locale_init.o): In
function `std::locale::global(std::locale const&)':
(.text._ZNSt6locale6globalERKS_+0x9a): undefined reference to
`pthread_mutex_unlock'
/usr/lib/gcc/i386-redhat-linux/4.3.0/libstdc++.a(locale_init.o): In
function `std::locale::locale()':
(.text._ZNSt6localeC2Ev+0x2a): undefined reference to
`pthread_mutex_lock'
/usr/lib/gcc/i386-redhat-linux/4.3.0/libstdc++.a(locale_init.o): In
function `std::locale::locale()':
(.text._ZNSt6localeC2Ev+0x52): undefined reference to
`pthread_mutex_unlock'
/usr/lib/gcc/i386-redhat-linux/4.3.0/libstdc++.a(eh_alloc.o): In
function `__cxa_free_exception':
(.text.__cxa_free_exception+0x6b): undefined reference to
`pthread_mutex_lock'
/usr/lib/gcc/i386-redhat-linux/4.3.0/libstdc++.a(eh_alloc.o): In
function `__cxa_free_exception':
(.text.__cxa_free_exception+0x86): undefined reference to
`pthread_mutex_unlock'
/usr/lib/gcc/i386-redhat-linux/4.3.0/libstdc++.a(eh_alloc.o): In
function `__cxa_allocate_exception':
(.text.__cxa_allocate_exception+0x6f): undefined reference to
`pthread_mutex_lock'
/usr/lib/gcc/i386-redhat-linux/4.3.0/libstdc++.a(eh_alloc.o): In
function `__cxa_allocate_exception':
(.text.__cxa_allocate_exception+0xd7): undefined reference to
`pthread_mutex_unlock'
/usr/lib/gcc/i386-redhat-linux/4.3.0/libgcc_eh.a(unwind-dw2-fde-glibc.o): In function `__register_frame_info_bases':
(.text+0x60): undefined reference to `pthread_mutex_lock'
/usr/lib/gcc/i386-redhat-linux/4.3.0/libgcc_eh.a(unwind-dw2-fde-glibc.o): In function `__register_frame_info_bases':
(.text+0x77): undefined reference to `pthread_mutex_unlock'
/usr/lib/gcc/i386-redhat-linux/4.3.0/libgcc_eh.a(unwind-dw2-fde-glibc.o): In function `__register_frame_info_table_bases':
(.text+0x12a): undefined reference to `pthread_mutex_lock'
/usr/lib/gcc/i386-redhat-linux/4.3.0/libgcc_eh.a(unwind-dw2-fde-glibc.o): In function `__register_frame_info_table_bases':
(.text+0x141): undefined reference to `pthread_mutex_unlock'
/usr/lib/gcc/i386-redhat-linux/4.3.0/libgcc_eh.a(unwind-dw2-fde-glibc.o): In function `_Unwind_Find_FDE':
(.text+0x18a8): undefined reference to `pthread_mutex_lock'
/usr/lib/gcc/i386-redhat-linux/4.3.0/libgcc_eh.a(unwind-dw2-fde-glibc.o): In function `_Unwind_Find_FDE':
(.text+0x18f8): undefined reference to `pthread_mutex_unlock'
/usr/lib/gcc/i386-redhat-linux/4.3.0/libgcc_eh.a(unwind-dw2-fde-glibc.o): In function `__deregister_frame_info_bases':
(.text+0x1aaa): undefined reference to `pthread_mutex_lock'
/usr/lib/gcc/i386-redhat-linux/4.3.0/libgcc_eh.a(unwind-dw2-fde-glibc.o): In function `__deregister_frame_info_bases':
(.text+0x1b2f): undefined reference to `pthread_mutex_unlock'
collect2: ld returned 1 exit status
If anyone could point me to a solution of this problem, or give one here
I'd very much appreciate it. Thank you.
Best,
Moritz
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