Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#65834 closed defect (fixed)

ghc: ld: symbol(s) not found for architecture x86_64

Reported by: dbl001 (dbl) Owned by: essandess (Steve Smith)
Priority: Normal Milestone:
Component: ports Version: 2.7.2
Keywords: Cc:
Port: ghc

Description

I'm on MacOS Catalina

:info:build Undefined symbols for architecture x86_64:
:info:build   "_iconv_close", referenced from:
:info:build       _hs_iconv_close in libHSbase-4.16.0.0.a(iconv.o)
:info:build      (maybe you meant: _hs_iconv_close)
:info:build   "_iconv", referenced from:
:info:build       _hs_iconv in libHSbase-4.16.0.0.a(iconv.o)
:info:build      (maybe you meant: _base_GHCziIOziEncodingziIconv_iconvEncoding_closure, _base_GHCziIOziEncodingziIconv_iconvEncoding1_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding1_info , _base_GHCziIOziEncodingziIconv_iconvEncoding4_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding8_info , _base_GHCziIOziEncodingziIconv_iconvEncoding13_info , _base_GHCziIOziEncodingziIconv_iconvEncoding12_info , _base_GHCziIOziEncodingziIconv_iconvEncoding9_info , _base_GHCziIOziEncodingziIconv_iconvEncoding4_info , _base_GHCziIOziEncodingziIconv_iconvEncoding15_bytes , _base_GHCziIOziEncodingziIconv_iconvEncoding6_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding6_info , _base_GHCziIOziEncodingziIconv_iconvEncoding16_info , _base_GHCziIOziEncodingziIconv_iconvEncoding12_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding7_info , _base_GHCziIOziEncodingziIconv_iconvEncoding11_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding2_info , _base_GHCziIOziEncodingziIconv_iconvEncoding10_bytes , _hs_iconv , _base_GHCziIOziEncodingziIconv_iconvEncoding_info , _base_GHCziIOziEncodingziIconv_iconvEncoding7_closure , _hs_iconv_close , _base_GHCziIOziEncodingziIconv_iconvEncoding13_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding9_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding3_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding5_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding14_bytes , _base_GHCziIOziEncodingziIconv_iconvEncoding16_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding2_closure , _hs_iconv_open , _base_GHCziIOziEncodingziIconv_iconvEncoding8_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding11_info )
:info:build   "_iconv_open", referenced from:
:info:build       _hs_iconv_open in libHSbase-4.16.0.0.a(iconv.o)
:info:build      (maybe you meant: _hs_iconv_open)
:info:build ld: symbol(s) not found for architecture x86_64
:in

Attachments (2)

main.log (126.2 KB) - added by dbl001 (dbl) 2 years ago.
main.2.log (697.1 KB) - added by dbl001 (dbl) 2 years ago.

Download all attachments as: .zip

Change History (12)

Changed 2 years ago by dbl001 (dbl)

Attachment: main.log added

comment:1 Changed 2 years ago by jmroot (Joshua Root)

Keywords: gch iconv removed
Owner: set to essandess
Status: newassigned

Missing libiconv dependency?

comment:2 Changed 2 years ago by kencu (Ken)

it's probably actually finding the libiconv in MacPorts prefix instead of the system one it wants, but that one has the wrong symbols.

See many recent mailing list posts for this recurring problem, eg this one:

https://lists.macports.org/pipermail/macports-dev/2022-August/044677.html

Steve thought this was fixed...

Last edited 2 years ago by kencu (Ken) (previous) (diff)

comment:3 Changed 2 years ago by essandess (Steve Smith)

I'm pretty sure this one is my fault and that @jmroot is barking up the right tree. I'm looking into other missing dependencies that I see in trace builds of downstream projects and am thinking about where to stick in the dependencies—cabal or ghc. PR soon…

comment:4 Changed 2 years ago by essandess (Steve Smith)

Please see https://github.com/macports/macports-ports/pull/16115.

Also please note that I bootstrapped the entire dependency tree in trace mode. I observe several trace mode outputs that to the best of my knowledge are false alerts, either because the ports are explicitly listed as dependencies (e.g. wget, importlib_metadata), or because the ports are confirmed not to be used as dependencies (e.g. libunwind). I know very little of how trace mode works, but fwiw, here are the trace mode comments. Trace mode builds successfully with these comments.

ghc

Warning: The following existing files were hidden from the build system by trace mode:
  /opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/PIL/__init__.py
  /opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/chardet/__init__.py
  /opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/colorama/__init__.py
  /opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/importlib_metadata/__init__.py
  /opt/local/bin/gawk
  /opt/local/bin/gfind
  /opt/local/bin/ghc-pkg
  /opt/local/bin/git
  /opt/local/bin/gmake
  /opt/local/bin/gnutar
  /opt/local/bin/gsed
  /opt/local/bin/gtar
  /opt/local/bin/makeinfo
  /opt/local/lib/libunwind.dylib
  /private/var/select/sh

cabal

Warning: The following existing files were hidden from the build system by trace mode:
  /opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/PIL/__init__.py
  /opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/chardet/__init__.py
  /opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/colorama/__init__.py
  /opt/local/bin/cpphs
  /opt/local/bin/ggrep
  /opt/local/lib/libunwind.dylib
  /private/var/select/sh

lhs2tex (built using cabal)

Warning: The following existing files were hidden from the build system by trace mode:
  /opt/local/bin/wget
  /opt/local/lib/libunwind.dylib

comment:5 Changed 2 years ago by mouse07410 (Mouse)

Well, that sure is one ugly problem. Caused by Macports having to have its own libiconv.dylib.

My workaround, which is equally ugly, was to create a directory /opt/local/lib/liconv/ and copy (or symlink) to it /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libiconv.tbd. Then, the obvious

 .  .  . -L/opt/local/lib/liconv -liconv -L/opt/local/lib -lwhatever -lwhatever2

Note: copying or symlinking /usr/lib/libiconv.dylib is hopeless now, because recent Xcode versions do not provide that file in a visible/usable form.

Last edited 2 years ago by mouse07410 (Mouse) (previous) (diff)

comment:6 Changed 2 years ago by essandess (Steve Smith)

To be clear, we have a working ghc bootstrap that correctly links itself and things it builds to MacPorts libraries including libiconv.

The issue is just setting the depends_* settings correctly so that the builds work across a variety of initial states.

port contents ghc | egrep -e '\.dylib$' | xargs otool -L | egrep -E -e '^[[:space:]]+/opt/local' | sort -u
	/opt/local/lib/libgmp.10.dylib (compatibility version 15.0.0, current version 15.1.0)
	/opt/local/lib/libiconv.2.dylib (compatibility version 9.0.0, current version 9.1.0)
	/opt/local/lib/libncurses.6.dylib (compatibility version 6.0.0, current version 6.0.0)
find /opt/local/lib/ghc-9.4.2/bin -type f | xargs otool -L | egrep -E -e '^[[:space:]]+/opt/local' | sort -u
	/opt/local/lib/libgmp.10.dylib (compatibility version 15.0.0, current version 15.1.0)
	/opt/local/lib/libiconv.2.dylib (compatibility version 9.0.0, current version 9.1.0)
	/opt/local/lib/libncurses.6.dylib (compatibility version 6.0.0, current version 6.0.0)

comment:7 Changed 2 years ago by essandess (Steve Smith)

Resolution: fixed
Status: assignedclosed

In 7662717e6352937e40c4cb3d2ae25d1fa08ff6fb/macports-ports (master):

ghc: Bugfix dependencies

comment:8 Changed 2 years ago by essandess (Steve Smith)

In 71aa6fb9aad5a98810b65bb0c611014777100be5/macports-ports (master):

cabal: Bugfix dependencies

Changed 2 years ago by dbl001 (dbl)

Attachment: main.2.log added

comment:9 Changed 2 years ago by dbl001 (dbl)

I got the same error. I removed 'ghc' and tried to reinstall it.

comment:10 in reply to:  9 Changed 2 years ago by essandess (Steve Smith)

Replying to dbl001:

I got the same error. I removed 'ghc' and tried to reinstall it.

Wrong version:

Starting logging for ghc @9.4.2_0
Note: See TracTickets for help on using tickets.