tst2005googlecode / re2

Automatically exported from code.google.com/p/re2
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Darwin shared library doesn't work #25

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. make
2. make install
3. make testinstall

What is the expected output? What do you see instead?

Expected:
$ make testinstall
cp testinstall.cc obj
(cd obj && g++ -I/usr/local/include -L/usr/local/lib testinstall.cc -lre2 
-pthread -o testinstall)
obj/testinstall
PASS

Instead:
$ make testinstall
cp testinstall.cc obj
(cd obj && g++ -I/usr/local/include -L/usr/local/lib testinstall.cc -lre2 
-pthread -o testinstall)
Undefined symbols:
  "re2::RE2::FullMatchN(re2::StringPiece const&, re2::RE2 const&, re2::RE2::Arg const* const*, int)", referenced from:
      re2::VariadicFunction2<bool, re2::StringPiece const&, re2::RE2 const&, re2::RE2::Arg, &(re2::RE2::FullMatchN(re2::StringPiece const&, re2::RE2 const&, re2::RE2::Arg const* const*, int))>::operator()(re2::StringPiece const&, re2::RE2 const&) constin ccwkiBmD.o
  "re2::RE2::RE2(char const*)", referenced from:
      _main in ccwkiBmD.o
  "re2::RE2::~RE2()", referenced from:
      _main in ccwkiBmD.o
      _main in ccwkiBmD.o
  "re2::RE2::FullMatch", referenced from:
      _main in ccwkiBmD.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [testinstall] Error 1

What version of the product are you using? On what operating system?

$ hg identify
7898bbcaf58f tip

$ uname -rs
Darwin 10.2.0

Please provide any additional information below.

I believe the problem was introduced by changeset 22:532397377870, which limits 
the visible symbols in the shared library.  I was able to workaround the 
problem by removing "-exported_symbols_list libre2.symbols.darwin" from the 
linker flags.

I noticed that the tests link with "-Lobj/so -lre2 obj/libre2.a", which links 
against both the static and shared library.  Is that intended to be a 
workaround to this problem as well?

Original issue reported on code.google.com by dadk...@gmail.com on 12 Jul 2010 at 10:41

GoogleCodeExporter commented 9 years ago
Could this be a Darwin linker problem with -exported_symbols_list?  None of the 
unmangled wildcards from libre2.symbols.darwin survived as globals in the 
object.  Only the mangled __ZeqRKN3re211StringPieceES2_ and 
__ZlsRSoRKN3re211StringPieceE are there.

$ nm -g obj/so/libre2.so
                 U __DefaultRuneLocale
                 U __Unwind_Resume
                 U __ZNKSs4findEPKcmm
                 U __ZNSo5writeEPKcl
                 U __ZNSo9_M_insertIPKvEERSoT_
                 U __ZNSo9_M_insertIbEERSoT_
                 U __ZNSo9_M_insertImEERSoT_
                 U __ZNSolsEi
                 U __ZNSs12_M_leak_hardEv
                 U __ZNSs14_M_replace_auxEmmmc
                 U __ZNSs4_Rep10_M_destroyERKSaIcE
                 U __ZNSs4_Rep20_S_empty_rep_storageE
                 U __ZNSs4swapERSs
                 U __ZNSs6appendEPKcm
                 U __ZNSs6appendERKSs
                 U __ZNSs6appendEmc
                 U __ZNSs6assignEPKcm
                 U __ZNSs6assignERKSs
                 U __ZNSs6resizeEmc
                 U __ZNSs7replaceEmmPKcm
                 U __ZNSs7reserveEm
                 U __ZNSs9_M_mutateEmmm
                 U __ZNSsC1EPKcRKSaIcE
                 U __ZNSsC1EPKcmRKSaIcE
                 U __ZNSsC1ERKSs
                 U __ZNSsC1ERKSsmm
                 U __ZNSt8ios_base4InitC1Ev
                 U __ZNSt8ios_base4InitD1Ev
                 U __ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
                 U __ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
                 U __ZSt17__throw_bad_allocv
                 U __ZSt18_Rb_tree_decrementPSt18_Rb_tree_node_base
                 U __ZSt18_Rb_tree_incrementPKSt18_Rb_tree_node_base
                 U __ZSt18_Rb_tree_incrementPSt18_Rb_tree_node_base
                 U __ZSt20__throw_length_errorPKc
                 U __ZSt20__throw_out_of_rangePKc
                 U __ZSt28_Rb_tree_rebalance_for_erasePSt18_Rb_tree_node_baseRS_
                 U __ZSt29_Rb_tree_insert_and_rebalancebPSt18_Rb_tree_node_baseS0_RS_
                 U __ZSt4cerr
                 U __ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
                 U __ZTVN10__cxxabiv117__class_type_infoE
                 U __ZTVN10__cxxabiv120__si_class_type_infoE
                 U __ZdaPv
                 U __ZdlPv
00000000000029e0 T __ZeqRKN3re211StringPieceES2_
00000000000028d0 T __ZlsRSoRKN3re211StringPieceE
                 U __Znam
                 U __Znwm
                 U ___cxa_atexit
                 U ___cxa_begin_catch
                 U ___cxa_end_catch
                 U ___cxa_pure_virtual
                 U ___cxa_rethrow
                 U ___error
                 U ___gxx_personality_v0
                 U ___maskrune
                 U ___stack_chk_fail
                 U ___stack_chk_guard
                 U _abort
                 U _free
                 U _malloc
                 U _memchr
                 U _memcmp
                 U _memcpy
                 U _memmove
                 U _memset
                 U _pthread_rwlock_destroy
                 U _pthread_rwlock_init
                 U _pthread_rwlock_rdlock
                 U _pthread_rwlock_unlock
                 U _pthread_rwlock_wrlock
                 U _snprintf
                 U _sprintf
                 U _strchr
                 U _strlen
                 U _strtod
                 U _strtol
                 U _strtoll
                 U _strtoul
                 U _strtoull
                 U _vsnprintf
                 U dyld_stub_binder

Original comment by dadk...@gmail.com on 13 Jul 2010 at 8:14

GoogleCodeExporter commented 9 years ago
Looks like mangling all the names makes it work.  Will do that.

Original comment by rsc@swtch.com on 16 Jul 2010 at 5:17

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 8b066f89c3.

Original comment by rsc@swtch.com on 16 Jul 2010 at 6:18