[MacPorts] #65945: jemalloc fails on 10.5.8: Undefined symbols: _malloc_default_purgeable_zone, __Unwind_Resume

MacPorts noreply at macports.org
Fri Oct 7 12:43:19 UTC 2022


#65945: jemalloc fails on 10.5.8: Undefined symbols:
_malloc_default_purgeable_zone, __Unwind_Resume
---------------------------+-------------------------------------------
  Reporter:  barracuda156  |      Owner:  kencu
      Type:  defect        |     Status:  assigned
  Priority:  Normal        |  Milestone:
 Component:  ports         |    Version:  2.7.2
Resolution:                |   Keywords:  powerpc, leopard, snowleopard
      Port:  jemalloc      |
---------------------------+-------------------------------------------

Comment (by kencu):

 I see you've modified your system, which in your case is probably OK as by
 now you know what might need to be done. Let me just clarify a few points,
 though.

 1. did you make any patches to gcc11/libgcc11 at all?
 2. I presume you have upgraded your default libgcc to libgcc11 as well.
 3. what linker have you set as default? ld64-97? or ld64-127? or something
 from Iain's repo, per the tools PR that catap had generated a while ago
 that has not as yet been merged?

 With all those things clarified, the way that I usually approach a problem
 like this first is to try the link manually.

 Your failing link line is this:
 {{{
 :info:build /opt/local/bin/gcc-mp-11 -shared
 -Wl,-install_name,/opt/local/lib/libjemalloc.2.dylib  -o
 lib/libjemalloc.2.dylib src/jemalloc.pic.o src/arena.pic.o
 src/background_thread.pic.o src/base.pic.o src/bin.pic.o
 src/bin_info.pic.o src/bitmap.pic.o src/buf_writer.pic.o
 src/cache_bin.pic.o src/ckh.pic.o src/counter.pic.o src/ctl.pic.o
 src/decay.pic.o src/div.pic.o src/ecache.pic.o src/edata.pic.o
 src/edata_cache.pic.o src/ehooks.pic.o src/emap.pic.o src/eset.pic.o
 src/exp_grow.pic.o src/extent.pic.o src/extent_dss.pic.o
 src/extent_mmap.pic.o src/fxp.pic.o src/san.pic.o src/san_bump.pic.o
 src/hook.pic.o src/hpa.pic.o src/hpa_hooks.pic.o src/hpdata.pic.o
 src/inspect.pic.o src/large.pic.o src/log.pic.o src/malloc_io.pic.o
 src/mutex.pic.o src/nstime.pic.o src/pa.pic.o src/pa_extra.pic.o
 src/pai.pic.o src/pac.pic.o src/pages.pic.o src/peak_event.pic.o
 src/prof.pic.o src/prof_data.pic.o src/prof_log.pic.o
 src/prof_recent.pic.o src/prof_stats.pic.o src/prof_sys.pic.o
 src/psset.pic.o src/rtree.pic.o src/safety_check.pic.o src/sc.pic.o
 src/sec.pic.o src/stats.pic.o src/sz.pic.o src/tcache.pic.o
 src/test_hooks.pic.o src/thread_event.pic.o src/ticker.pic.o src/tsd.pic.o
 src/witness.pic.o src/zone.pic.o src/jemalloc_cpp.pic.o -L/opt/local/lib
 -Wl,-headerpad_max_install_names -m32 -lstdc++ -pthread
 }}}

 it looks benign enough, ie it looks like it should work. So go into the
 directory where the link is being done, which I think is here:

 {{{
 cd
 /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_jemalloc/jemalloc/work/jemalloc-5.3.0-ppc
 }}}

 and then try the link manually. It may well fail, but we can at least try
 it:
 {{{
 sudo /opt/local/bin/gcc-mp-11 -shared
 -Wl,-install_name,/opt/local/lib/libjemalloc.2.dylib  -o
 lib/libjemalloc.2.dylib src/jemalloc.pic.o src/arena.pic.o
 src/background_thread.pic.o src/base.pic.o src/bin.pic.o
 src/bin_info.pic.o src/bitmap.pic.o src/buf_writer.pic.o
 src/cache_bin.pic.o src/ckh.pic.o src/counter.pic.o src/ctl.pic.o
 src/decay.pic.o src/div.pic.o src/ecache.pic.o src/edata.pic.o
 src/edata_cache.pic.o src/ehooks.pic.o src/emap.pic.o src/eset.pic.o
 src/exp_grow.pic.o src/extent.pic.o src/extent_dss.pic.o
 src/extent_mmap.pic.o src/fxp.pic.o src/san.pic.o src/san_bump.pic.o
 src/hook.pic.o src/hpa.pic.o src/hpa_hooks.pic.o src/hpdata.pic.o
 src/inspect.pic.o src/large.pic.o src/log.pic.o src/malloc_io.pic.o
 src/mutex.pic.o src/nstime.pic.o src/pa.pic.o src/pa_extra.pic.o
 src/pai.pic.o src/pac.pic.o src/pages.pic.o src/peak_event.pic.o
 src/prof.pic.o src/prof_data.pic.o src/prof_log.pic.o
 src/prof_recent.pic.o src/prof_stats.pic.o src/prof_sys.pic.o
 src/psset.pic.o src/rtree.pic.o src/safety_check.pic.o src/sc.pic.o
 src/sec.pic.o src/stats.pic.o src/sz.pic.o src/tcache.pic.o
 src/test_hooks.pic.o src/thread_event.pic.o src/ticker.pic.o src/tsd.pic.o
 src/witness.pic.o src/zone.pic.o src/jemalloc_cpp.pic.o -L/opt/local/lib
 -Wl,-headerpad_max_install_names -m32 -lstdc++ -pthread
 }}}

 when it fails (it will probably fail), try adding some verbosity flags to
 the linker, which look like this {{{-Wl,-v}}}:

 ie:

 {{{
 sudo /opt/local/bin/gcc-mp-11 -Wl,-v -shared
 -Wl,-install_name,/opt/local/lib/libjemalloc.2.dylib  -o
 lib/libjemalloc.2.dylib src/jemalloc.pic.o src/arena.pic.o
 src/background_thread.pic.o src/base.pic.o src/bin.pic.o
 src/bin_info.pic.o src/bitmap.pic.o src/buf_writer.pic.o
 src/cache_bin.pic.o src/ckh.pic.o src/counter.pic.o src/ctl.pic.o
 src/decay.pic.o src/div.pic.o src/ecache.pic.o src/edata.pic.o
 src/edata_cache.pic.o src/ehooks.pic.o src/emap.pic.o src/eset.pic.o
 src/exp_grow.pic.o src/extent.pic.o src/extent_dss.pic.o
 src/extent_mmap.pic.o src/fxp.pic.o src/san.pic.o src/san_bump.pic.o
 src/hook.pic.o src/hpa.pic.o src/hpa_hooks.pic.o src/hpdata.pic.o
 src/inspect.pic.o src/large.pic.o src/log.pic.o src/malloc_io.pic.o
 src/mutex.pic.o src/nstime.pic.o src/pa.pic.o src/pa_extra.pic.o
 src/pai.pic.o src/pac.pic.o src/pages.pic.o src/peak_event.pic.o
 src/prof.pic.o src/prof_data.pic.o src/prof_log.pic.o
 src/prof_recent.pic.o src/prof_stats.pic.o src/prof_sys.pic.o
 src/psset.pic.o src/rtree.pic.o src/safety_check.pic.o src/sc.pic.o
 src/sec.pic.o src/stats.pic.o src/sz.pic.o src/tcache.pic.o
 src/test_hooks.pic.o src/thread_event.pic.o src/ticker.pic.o src/tsd.pic.o
 src/witness.pic.o src/zone.pic.o src/jemalloc_cpp.pic.o -L/opt/local/lib
 -Wl,-headerpad_max_install_names -m32 -lstdc++ -pthread
 }}}

 what you are looking for here is to see if the libraries that you assume
 are being linked in are really being linked in, and what, if any, errors
 are being found by the linker in so doing.

 In particular, you want to see that {{{libgcc_s.10.5.dylib}}} is actually
 being linked in on the link line.

 Once you get that far, you know that things should be working, and that
 all the requested libraries are really being linked in. So that narrows
 down the issue quite a bit.

 If that all works fine, then what I have found usually causes the errors
 you see is that the deployment target is not actually making it through to
 the compiler and linker in all the stages. By default, these tools will
 usually assume a deployment target of 10.6 these days, in particular the
 linker, eg:

 {{{
 "ld: warning: -macosx_version_min not specified, assuming 10.6"
 }}}

 Your build is indeed setting {{{MACOSX_DEPLOYMENT_TARGET='10.5'}}} and
 that does usually work to put the compiler and linker into the proper
 mode, but environment variables don't always make it through to every
 stage of the build like you would like them to.

 Sometimes, you have to pass the deployment target as a configure argument
 instead. That looks like this:

 {{{
 -mmacosx-version-min=10.5
 }}}

 and can be added to the cflags or cxxflags as required. Sometimes you also
 need to pass that to the linker, although the compiler will normally do
 that for you (you can see that with the -Wl,-v link argument again). The
 linker flag is slightly different, eg:

 {{{
 -macosx_version_min 10.5.8
 }}}

 If you want to pass that directly to the linker when doing a manual link,
 you can add it to the gcc11 link line like this:

 {{{
 sudo /opt/local/bin/gcc-mp-11 -Wl,-macosx_version_min,10.5.8 -Wl,-v
 -shared -Wl,-install_name,/opt/local/lib/libjemalloc.2.dylib  -o
 lib/libjemalloc.2.dylib src/jemalloc.pic.o src/arena.pic.o
 src/background_thread.pic.o src/base.pic.o src/bin.pic.o
 src/bin_info.pic.o src/bitmap.pic.o src/buf_writer.pic.o
 src/cache_bin.pic.o src/ckh.pic.o src/counter.pic.o src/ctl.pic.o
 src/decay.pic.o src/div.pic.o src/ecache.pic.o src/edata.pic.o
 src/edata_cache.pic.o src/ehooks.pic.o src/emap.pic.o src/eset.pic.o
 src/exp_grow.pic.o src/extent.pic.o src/extent_dss.pic.o
 src/extent_mmap.pic.o src/fxp.pic.o src/san.pic.o src/san_bump.pic.o
 src/hook.pic.o src/hpa.pic.o src/hpa_hooks.pic.o src/hpdata.pic.o
 src/inspect.pic.o src/large.pic.o src/log.pic.o src/malloc_io.pic.o
 src/mutex.pic.o src/nstime.pic.o src/pa.pic.o src/pa_extra.pic.o
 src/pai.pic.o src/pac.pic.o src/pages.pic.o src/peak_event.pic.o
 src/prof.pic.o src/prof_data.pic.o src/prof_log.pic.o
 src/prof_recent.pic.o src/prof_stats.pic.o src/prof_sys.pic.o
 src/psset.pic.o src/rtree.pic.o src/safety_check.pic.o src/sc.pic.o
 src/sec.pic.o src/stats.pic.o src/sz.pic.o src/tcache.pic.o
 src/test_hooks.pic.o src/thread_event.pic.o src/ticker.pic.o src/tsd.pic.o
 src/witness.pic.o src/zone.pic.o src/jemalloc_cpp.pic.o -L/opt/local/lib
 -Wl,-headerpad_max_install_names -m32 -lstdc++ -pthread
 }}}

-- 
Ticket URL: <https://trac.macports.org/ticket/65945#comment:1>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list