#60773: chez-scheme @9.5.2: ld: warning: unexpected dylib (/opt/local/lib/libz.dylib) on link line

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

#60773: chez-scheme @9.5.2: ld: warning: unexpected dylib (/opt/local/lib/libz.dylib) on link line

macports-4
#60773: chez-scheme @9.5.2: ld: warning: unexpected dylib
(/opt/local/lib/libz.dylib) on link line
------------------------+-------------------------
 Reporter:  ryandesign  |      Owner:  mohd-akram
     Type:  defect      |     Status:  assigned
 Priority:  Normal      |  Milestone:
Component:  ports       |    Version:  2.6.2
 Keywords:              |       Port:  chez-scheme
------------------------+-------------------------
 [https://build.macports.org/builders/ports-10.7_x86_64-builder/builds/25770/steps
 /install-port/logs/stdio chez-scheme fails to build] on 10.7 at least:

 {{{
 /usr/bin/clang -I/opt/local/include -m64 -Wpointer-arith -Wall -Wextra
 -Wno-implicit-fallthrough -Werror -O2 -pipe -Os -arch x86_64 -static
 -nostdlib -o ../boot/ta6osx/kernel.o statics.o segment.o alloc.o symbol.o
 intern.o gcwrapper.o gc-ocd.o gc-oce.o number.o schsig.o io.o new-io.o
 print.o fasl.o stats.o foreign.o prim.o prim5.o flushcache.o schlib.o
 thread.o expeditor.o scheme.o i3le.o -L/opt/local/lib
 -Wl,-headerpad_max_install_names -arch x86_64 -lz -Wl,-r
 ld: warning: unexpected dylib (/opt/local/lib/libz.dylib) on link line
 0  0x104151098  __assert_rtn + 144
 1  0x10419c682  std::__1::map<ld::File const*, ld::File::Ordinal,
 std::__1::less<ld::File const*>,
 std::__1::allocator<std::__1::pair<ld::File const* const,
 ld::File::Ordinal> > >::operator[](ld::File const* const&) + 0
 2  0x10419c35f  ld::tool::SectionRelocationsAtom<x86_64>::sectSymNum(bool,
 ld::Atom const*) + 45
 3  0x104191abb
 ld::tool::SectionRelocationsAtom<x86_64>::encodeSectionReloc(ld::Internal::FinalSection*,
 ld::tool::SectionRelocationsAtom<x86_64>::Entry const&,
 std::__1::vector<macho_relocation_info<Pointer64<LittleEndian> >,
 std::__1::allocator<macho_relocation_info<Pointer64<LittleEndian> > > >&)
 + 77
 4  0x1041b30a2  ld::tool::SectionRelocationsAtom<x86_64>::encode() + 62
 5  0x104197340
 ld::tool::OutputFile::updateLINKEDITAddresses(ld::Internal&) + 420
 6  0x104193030  ld::tool::OutputFile::write(ld::Internal&) + 136
 7  0x1041514d7  main + 713
 A linker snapshot was created at:
         /tmp/kernel.o-2020-06-03-134001.ld-snapshot
 ld: Assertion failed: (_machoSection != 0), function machoSection, file
 /SourceCache/ld64/ld64-136/src/ld/ld.hpp, line 641.
 clang: error: linker command failed with exit code 1 (use -v to see
 invocation)
 }}}

 The problem is it's trying to make a statically-linked
 `../boot/ta6osx/kernel.o` using `-static`, but then it asks to link with
 zlib using `-L/opt/local/lib` and `-lz`, which ends up finding libz.dylib;
 you can't link a static object with a dynamic library. If you want to
 embed a copy of the zlib static library instead, use
 `/opt/local/lib/libz.a` instead of `-L/opt/local/lib -lz`. We frown upon
 linking with static libraries in a port, but I'm not sure if there's a
 better way given how this is building.

--
Ticket URL: <https://trac.macports.org/ticket/60773>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: #60773: chez-scheme @9.5.2: ld: warning: unexpected dylib (/opt/local/lib/libz.dylib) on link line

macports-4
#60773: chez-scheme @9.5.2: ld: warning: unexpected dylib
(/opt/local/lib/libz.dylib) on link line
--------------------------+------------------------
  Reporter:  ryandesign   |      Owner:  mohd-akram
      Type:  defect       |     Status:  assigned
  Priority:  Normal       |  Milestone:
 Component:  ports        |    Version:  2.6.2
Resolution:               |   Keywords:
      Port:  chez-scheme  |
--------------------------+------------------------

Comment (by ryandesign):

 For comparison,
 [https://build.macports.org/builders/ports-10.8_x86_64-builder/builds/20861/steps
 /install-port/logs/stdio it did build on 10.8] and later. Maybe the
 compiler or linker got smarter and realized that `-L/opt/local/lib -lz`
 should refer to the static library not the dynamic library if you're
 trying to build statically. So just making the change I suggested above
 may be all we need to do to get it to build on 10.7 like it does on later
 systems.

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