Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
05-25-2012, 11:06 PM
|
#1
|
|
Senior Member
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,888
Rep:
|
compiling phc - ld doesn't want to see a library that's in front of it
Hi!
I think I'm very close to finishing compiling phc on kubuntu precise (I've spent a good couple of hours fighting with this compilation process).
Now I've hit a brick wall where ld doesn't want to see a so that's (I think) right in front of it.
The command in question and the output error is like this:
Code:
$ LANG=en g++ -Wextra -Wno-unused-parameter -Wno-write-strings -Wno-deprecated -g -O2 -o src/.libs/phc phc.o -Wl,--export-dynamic /home/antoranz/Downloads/phc/phc-0.3.0.1/libltdl/./.libs/dlopen.a libltdl/.libs/libltdlc.a -lboost_regex ./.libs/libphc.so -L/usr/local/boost/lib -L/usr/local/php/lib -lgccpp -lgc -lphp5 -ldl -Wl,-rpath -Wl,/usr/local/phc/lib
./.libs/libphc.so: undefined reference to `boost::re_detail::raise_runtime_error(std::runtime_error const&)'
./.libs/libphc.so: undefined reference to `boost::re_detail::perl_matcher<char const*, std::allocator<boost::sub_match<char const*> >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::construct_init(boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags)'
./.libs/libphc.so: undefined reference to `boost::cpp_regex_traits<char>::toi(char const*&, char const*, int) const'
./.libs/libphc.so: undefined reference to `boost::re_detail::put_mem_block(void*)'
./.libs/libphc.so: undefined reference to `boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >::maybe_assign(boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > > const&)'
./.libs/libphc.so: undefined reference to `boost::match_results<char const*, std::allocator<boost::sub_match<char const*> > >::maybe_assign(boost::match_results<char const*, std::allocator<boost::sub_match<char const*> > > const&)'
./.libs/libphc.so: undefined reference to `boost::re_detail::get_mem_block()'
./.libs/libphc.so: undefined reference to `boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::construct_init(boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags)'
./.libs/libphc.so: undefined reference to `boost::re_detail::verify_options(unsigned int, boost::regex_constants::_match_flags)'
./.libs/libphc.so: undefined reference to `boost::re_detail::get_default_error_string(boost::regex_constants::error_type)'
./.libs/libphc.so: undefined reference to `boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::do_assign(char const*, char const*, unsigned int)'
./.libs/libphc.so: undefined reference to `boost::re_detail::cpp_regex_traits_implementation<char>::transform(char const*, char const*) const'
./.libs/libphc.so: undefined reference to `boost::re_detail::cpp_regex_traits_implementation<char>::transform_primary(char const*, char const*) const'
collect2: ld returned 1 exit status
The symbols are in libboost_regex:
Code:
$ nm -gC /usr/local/boost/lib/libboost_regex.so | grep raise_runtime_error
0007f250 T boost::re_detail::raise_runtime_error(std::runtime_error const&)
So, it's a linker problem. I have tried adding this options when calling g++:
-Wl,-rpath -Wl,/usr/local/boost/lib
-Wl,-L -Wl,/usr/local/boost/lib
Also setting LD_LIBRARY_PATH or (logical or) LD_RUN_PATH to /usr/local/boost/lib to no avail. ld refuses to use the libboost_regex library:
Code:
$ ls /usr/local/boost/lib/libboost_regex.so -l
lrwxrwxrwx 1 root root 24 may 25 20:31 /usr/local/boost/lib/libboost_regex.so -> libboost_regex.so.1.46.1
How can I force ld to see it? Thanks in advance.
Last edited by eantoranz; 05-25-2012 at 11:56 PM.
Reason: typo
|
|
|
|
05-26-2012, 03:55 PM
|
#2
|
|
Senior Member
Registered: May 2005
Posts: 4,396
|
Try using
-l:libboost_regex.so
instead of '-lboost_regex' which you have; pay attention to ':' and to full file name.
This approach sometimes helps to resolve linking issues - I never digged why.
|
|
|
1 members found this post helpful.
|
05-26-2012, 03:59 PM
|
#3
|
|
Senior Member
Registered: May 2005
Posts: 4,396
|
Also, read about LD_DEBUG, LD_DEBUG_OUTPUT in http://linux.die.net/man/8/ld-linux - I used the environment variable to debug linker failures.
I think you need LD_LIBRARY_PATH to be set.
|
|
|
1 members found this post helpful.
|
05-26-2012, 04:05 PM
|
#4
|
|
Senior Member
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 2,793
|
you need to use -L <path> to define directories where the libraries located, and -l<libname> to use the lib (libname will not contain the word lib at the beginning and .so at the end), so -lboost_regex would be fine). The problem is that the -L should come first before -l.
|
|
|
1 members found this post helpful.
|
05-26-2012, 04:10 PM
|
#5
|
|
Senior Member
Registered: May 2005
Posts: 4,396
|
Quote:
|
Originally Posted by pan64;4688385... The problem is that the -L should come first [I
before[/I] -l.
|
I don't think it matters:
Code:
-Lsearchdir
--library-path=searchdir
Add path searchdir to the list of paths that ld will search for archive libraries and ld control scripts. You may use this option any number of times. The directo-
ries are searched in the order in which they are specified on the command line. Directories specified on the command line are searched before the default directories.
All -L options apply to all -l options, regardless of the order in which the options appear.
|
|
|
|
05-27-2012, 06:46 PM
|
#6
|
|
Senior Member
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,888
Original Poster
Rep:
|
I think the problem is in the ./configure script that is not setting things right. Based on all the information you provided I was able to finish the compilation process.
First I tried adding this to the g++ calls:
Code:
-Wl,-L/usr/local/boost/lib -Wl,-lboost_regex
Thas was enough to make it move ahead. But ultimately it can be hacked on the Makefile.
On LIBS add -lboost_regex
On LDFLAGS add -L/usr/local/boost/lib
Or according to your environment. With that I was able to resume "making" and finish the compilation process.
Thank you all for your kind help.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 04:18 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|