<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">I have successfully self-bootstrapped ghc 9.4.2 by hand.</div><div class=""><br class=""></div><div class="">I now believe that the build failures are caused by some default MacPorts setting.</div><div class=""><br class=""></div><div class="">Is someone able to suggest a Portfile setting that can recreate this successful build? I set (by hand) these basic MacPorts environment variables:</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class="">export CLANG=/usr/bin/clang<br class="">export CXX=/usr/bin/clang++<br class="">export CPATH='/opt/local/include'<br class="">export LIBRARY_PATH='/opt/local/lib'<br class="">export LDFLAGS='-L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -arch x86_64'<br class="">export CPPFLAGS='-I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk'</blockquote></div><div class=""><br class=""></div><div><br class=""><blockquote type="cite" class=""><div class="">On Aug 28, 2022, at 7:34 PM, Steven Smith <<a href="mailto:steve.t.smith@gmail.com" class="">steve.t.smith@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Also, I’m perplexed with this doesn’t just work with the default MacPorts compiler.cpath and compiler.library_path settings.<div class=""><br class=""></div><div class="">The file iconv.c has a straightforward <span style="caret-color: rgb(36, 41, 47); color: rgb(36, 41, 47); font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 248, 197);" class="">#</span><span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword); font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 248, 197);">include</span><span style="caret-color: rgb(36, 41, 47); color: rgb(36, 41, 47); font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 248, 197);" class=""> </span><span class="pl-s" style="box-sizing: border-box; color: var(--color-prettylights-syntax-string); font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 248, 197);"><span class="pl-pds" style="box-sizing: border-box; color: var(--color-prettylights-syntax-string);"><</span>iconv.h<span class="pl-pds" style="box-sizing: border-box; color: var(--color-prettylights-syntax-string);">></span></span> from </div><div class=""><br class=""></div><div class=""><a href="https://github.com/ghc/ghc/blob/161a6f1fd62e797e978e7808a5f567fefa123f16/libraries/base/cbits/iconv.c#L4" class="">https://github.com/ghc/ghc/blob/161a6f1fd62e797e978e7808a5f567fefa123f16/libraries/base/cbits/iconv.c#L4</a></div><div class=""><br class=""></div><div class="">this should just use these:</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class="">CPATH='/opt/local/include'</div><div class="">LIBRARY_PATH='/opt/local/lib'</div></blockquote></div><div class=""><div class=""><br class=""></div></div><div class=""><br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Aug 28, 2022, at 3:01 PM, Steven Smith <<a href="mailto:steve.t.smith@gmail.com" class="">steve.t.smith@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Thanks.<div class=""><br class=""></div><div class=""><blockquote type="cite" class="">you probably want to be using the libiconv port anyway?<br class=""></blockquote><br class=""></div><div class="">Unfortunately, that won’t work without some hackery. Note the different symbol names in MacPorts:</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div style="margin: 0px; font-stretch: normal; font-size: 24px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">nm -gC /opt/local/var/macports/build/_opt_local_ports_lang_ghc/ghc/work/bootstrap/opt/local//lib/ghc-9.4.2/lib/x86_64-osx-ghc-9.4.2/base-4.17.0.0/libHSbase-4.17.0.0.a /opt/local/lib/libiconv.dylib | grep iconv_open</span></div><div style="margin: 0px; font-stretch: normal; font-size: 24px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">0000000000000000 T _hs_iconv_open</span></div><div style="margin: 0px; font-stretch: normal; font-size: 24px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> U _iconv_open</span></div><div style="margin: 0px; font-stretch: normal; font-size: 24px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> U _hs_iconv_open</span></div><div style="margin: 0px; font-stretch: normal; font-size: 24px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">0000000000003e02 T _libiconv_open</span></div><div style="margin: 0px; font-stretch: normal; font-size: 24px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">0000000000005375 T _libiconv_open_into</span></div></blockquote></div><div class=""><div class=""><br class=""></div>Is there a way to hack this out to transform _iconv_open to _libiconv_open in the .a file?</div><div class=""><br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Aug 28, 2022, at 2:57 PM, Joshua Root <<a href="mailto:jmr@macports.org" class="">jmr@macports.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">On 2022-8-29 04:42 , Steven Smith wrote:<br class=""><blockquote type="cite" class="">Re: <a href="https://gitlab.haskell.org/ghc/ghc/-/issues/22118" class="">https://gitlab.haskell.org/ghc/ghc/-/issues/22118</a> <<a href="https://gitlab.haskell.org/ghc/ghc/-/issues/22118" class="">https://gitlab.haskell.org/ghc/ghc/-/issues/22118</a>><br class="">I'm self-bootstrapping ghc 9.4.2 using hadrian for deployment on MacPorts.<br class="">Running hadrian -f binary-dist throws this error:<br class=""><blockquote type="cite" class="">:info:build "_iconv_close", referenced from:<br class="">:info:build _hs_iconv_close in libHSbase-4.17.0.0.a(iconv.o)<br class="">:info:build (maybe you meant: _hs_iconv_close)<br class="">:info:build "_iconv", referenced from:<br class="">:info:build _hs_iconv in libHSbase-4.17.0.0.a(iconv.o)<br class=""></blockquote>The archive file libHSbase-4.17.0.0.a in the ghc install uses the undefined symbol _iconv_close; however, macOS 12.5.1 no longer appears to provide a system libiconv:<br class=""><blockquote type="cite" class="">ls /usr/lib/libiconv*<br class="">ls: /usr/lib/libiconv*: No such file or directory<br class=""></blockquote>And port iconv provides the _libiconv_open symbol, not the _iconv_open symbol.<br class="">Is anyone aware of a solution to a missing libconv.dylib on recent macOS?<br class=""></blockquote><br class="">It's not actually missing, it just doesn't exist as a file in the filesystem. All OS-supplied libraries now exist only in the shared dyld cache. (The SDK, as you discovered, contains text-based stubs with just enough information about exported symbols and whatnot to allow linking.)<br class=""><br class="">That does mean that all build systems that check for the existence of a .dylib file to see if a library is available are broken. If checking is really necessary, they need to check if they can link with the library instead.<br class=""><br class="">For deployment in MacPorts though, you probably want to be using the libiconv port anyway?<br class=""><br class="">- Josh<br class=""></div></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></body></html>