folly icon indicating copy to clipboard operation
folly copied to clipboard

Can't link folly, "undefined reference to `boost::re_detail_106400::cpp_regex_traits_implementation<char>::transform"

Open louwers opened this issue 8 years ago • 11 comments

Whenever I try to link folly I get the following error:

/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/../../../../lib/libfolly.so: undefined reference to `boost::re_detail_106400::cpp_regex_traits_implementation<char>::transform(char const*, char const*) const'
/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/../../../../lib/libfolly.so: undefined reference to `boost::re_detail_106400::cpp_regex_traits_implementation<char>::transform_primary(char const*, char const*) const'
collect2: error: ld returned 1 exit status

In installed folly on an unsupported distribution (Arch Linux), but still I wonder if anyone knows what the cause could be. Maybe it's the fact that boost was compiled with (I believe) g++ 7 and folly with g++ 5 (since folly doesn't compile with g++ 7).

louwers avatar Jun 15 '17 14:06 louwers

Yes, your symbols don't match any more, as far as I know. You would have to build boost (and potentially every other dependent library) yourself using g++5 and link that version when building folly.

I gave up on that and am currently running my builds in a ubuntu docker container that uses docker -v to just mount the folders (compared to having a COPY or ADD in a Dockerfile). It's hacky but allows me to develop on my arch box while building in a supported target system without any copying or remote building.

mmlac avatar Jun 23 '17 00:06 mmlac

Yes, your symbols don't match any more, as far as I know.

With the release 5.1, GCC broke ABI compatibility because it started using a conforming implementation of std::string/std::list instead of copy-on-write. If you had a version of Boost compiled with libc++ and tried to use it with a program compiled with libstdc++, for example, you would get the exact same problem.

ghost avatar Jun 23 '17 21:06 ghost

I am also seeing the similar error undefined reference to `boost::re_detail_106501::perl_matcher<char const*, std::allocator<boost::sub_match<char const*> >, boost::regex_traits<char, boost::cpp_regex_traits > >::match()'

I am using gcc 5.4.0 for both boost and folly

mittalrishabh avatar Mar 08 '18 22:03 mittalrishabh

@mittalrishabh which Boost version and which compiler was used to build that Boost version? I've run into Boost.Regex bugs with certain tuples of {Boost version, GCC version} at my employer. I think, in particular, I recall Boost 1.61 not playing nicely with GCC 5.1 or GCC 6.3

JoeLoser avatar Mar 09 '18 00:03 JoeLoser

boost_1_66_0 , gcc 5.4 and with std = c++14

mittalrishabh avatar Mar 09 '18 20:03 mittalrishabh

I get the same errors only if folly is built with O3 flag. Otherwise, it builds successfully.

  • My boost is 1.58 and compiler 7.2.0
  • I did not build boost myself, it is default installed through apt.
  • OS: ubuntu 1604

prasad-joshi avatar Mar 21 '18 09:03 prasad-joshi

Hi @louwers Are you fixed the error ?

khalilo avatar Jul 29 '18 19:07 khalilo

@mittalrishabh Did you solve your problem ?

Brandewijn avatar Mar 11 '19 05:03 Brandewijn

I met the same link error, and it turns out to be the problem of inconsistent version of headers and libraries. I carefully checked the information output by configure scripts. The Boost version that folly find on my Ubuntu is 1.70.0, but actually I build the Boost 1.69.0 to my LD_LIBRARY_PATH. So I removed the wrong header files, and it compiled.

konigsberg avatar Nov 07 '19 14:11 konigsberg

I met the same link error, and it turns out to be the problem of inconsistent version of headers and libraries. I carefully checked the information output by configure scripts. The Boost version that folly find on my Ubuntu is 1.70.0, but actually I build the Boost 1.69.0 to my LD_LIBRARY_PATH. So I removed the wrong header files, and it compiled.

How do you removed the wrong header files? I run locate libboost | grep '\.so\.' and find there are two versions of libboost(1.65 and 1.58). I removed all the files of 1.58 version, and when I run locate libboost | grep '\.so\.' again, it just shows the same. When I look into the /usr/local/lib/, there is no libboost files.

/usr/local/lib/libboost_graph.so.1.58.0 /usr/local/lib/libboost_iostreams.so.1.58.0 /usr/local/lib/libboost_prg_exec_monitor.so.1.58.0 /usr/local/lib/libboost_regex.so.1.58.0 /usr/local/lib/libboost_system.so.1.58.0 /usr/local/lib/libboost_thread.so.1.58.0 /usr/local/lib/libboost_unit_test_framework.so.1.58.0

skyelves avatar Oct 10 '21 20:10 skyelves

I fixed mine by removing extra boost header files in /usr/local/include

/usr/local/include $ sudo rm -r boost

I found that the correct boost header files exist in /usr/include/boost

amraboelela avatar Jan 20 '22 23:01 amraboelela