<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="">I see that my build environment does not include some of these variables (CC, CFLAGS, LDFLAGS, etc.). It sets:<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="">:debug:build Environment:</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="">:debug:build CC_PRINT_OPTIONS='YES'</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="">:debug:build CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_opt_local_ports_lang_ghc/ghc/work/.CC_PRINT_OPTIONS'</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="">:debug:build CPATH='/opt/local/include'</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="">:debug:build DEVELOPER_DIR='/Library/Developer/CommandLineTools'</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="">:debug:build LIBRARY_PATH='/opt/local/lib'</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="">:debug:build MACOSX_DEPLOYMENT_TARGET='12.0'</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="">:debug:build MACPORTS_LEGACY_SUPPORT_DISABLED='1'</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="">:debug:build SDKROOT='/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk'</span></div></blockquote><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><br class=""></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">This may be the cause of the build failure. How do I set the build environment variables CC, CFLAGS, etc.?</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><br class=""></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">I’ve added this command to the Portfile, but it doesn’t change the build environment,</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><br class=""></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" 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="">        build.env-append </span><span style="font-variant-ligatures: no-common-ligatures; color: #9d206f" class="">\</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="">                    </span><span style="font-variant-ligatures: no-common-ligatures; color: #9d206f" class="">"CC=${<a href="http://configure.cc" class="">configure.cc</a>}"</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #9d206f" class="">\</span></div><div style="margin: 0px; font-stretch: normal; font-size: 24px; line-height: normal; font-family: Menlo; color: rgb(157, 32, 111);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">                    </span><span style="font-variant-ligatures: no-common-ligatures" class="">"CFLAGS=${configure.cflags}"</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures: no-common-ligatures" class="">\</span></div><div style="margin: 0px; font-stretch: normal; font-size: 24px; line-height: normal; font-family: Menlo; color: rgb(157, 32, 111);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">                    </span><span style="font-variant-ligatures: no-common-ligatures" class="">"CPATH=${compiler.cpath}"</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures: no-common-ligatures" class="">\</span></div><div style="margin: 0px; font-stretch: normal; font-size: 24px; line-height: normal; font-family: Menlo; color: rgb(157, 32, 111);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">                    </span><span style="font-variant-ligatures: no-common-ligatures" class="">"CPPFLAGS=${configure.cppflags}"</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures: no-common-ligatures" class="">\</span></div><div style="margin: 0px; font-stretch: normal; font-size: 24px; line-height: normal; font-family: Menlo; color: rgb(157, 32, 111);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">                    </span><span style="font-variant-ligatures: no-common-ligatures" class="">"CXX=${configure.cxx}"</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures: no-common-ligatures" class="">\</span></div><div style="margin: 0px; font-stretch: normal; font-size: 24px; line-height: normal; font-family: Menlo; color: rgb(157, 32, 111);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">                    </span><span style="font-variant-ligatures: no-common-ligatures" class="">"CXXFLAGS=${configure.cxxflags}"</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures: no-common-ligatures" class="">\</span></div><div style="margin: 0px; font-stretch: normal; font-size: 24px; line-height: normal; font-family: Menlo; color: rgb(157, 32, 111);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">                    </span><span style="font-variant-ligatures: no-common-ligatures" class="">"LDFLAGS=${configure.ldflags}"</span></div></blockquote><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 24px; line-height: normal; font-family: Menlo; color: rgb(157, 32, 111);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div></div></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><br class=""></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><br class=""></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><br class=""></span></div><div><br class=""><blockquote type="cite" class=""><div class="">On Aug 30, 2022, at 9:05 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=""><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 class=""><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=""></div></div></blockquote></div><br class=""></div></body></html>