#41275: nsis: build failure under 10.9 ----------------------------------+----------------------- Reporter: clemens.lanthaler@… | Owner: landonf@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.1 Resolution: | Keywords: Port: nsis | ----------------------------------+----------------------- Comment (by steve+macports@…): === tl;dr === There are several problems here that involve nsis being built with clang, when it doesn't look like there's much support for doing so upstream. Since scons is just calling gcc / g++ (which is an alias for clang in Xcode >=4.2 - see UsingTheRightCompiler) rather than clang specifically, the quick workaround is to {{{port select gcc llvm-gcc42}}} (or mp-llvm- gcc42 or apple-gcc42, depending on what you have available or are willing to install - anything other than none really) and scons will use that instead. === building with clang === As demonstrated above, nsis must be built with libstdc++, not libc++, which is the default used by clang as of 10.9 (or more specifically for {{{-mmacosx-version-min=10.9}}}). Unfortunately, the {{{APPEND_CCFLAGS}}} option that could be used to configure clang appropriately also applies to cross-compilation with i386-mingw32-gcc, which fails if passed {{{-stdlib=libstc++}}} or {{{-mmacosx-version-min=10.8}}}. The whole point of setting {{{SKIPSTUBS=all}}} etc is so that as much of nsis as necessary can be built //without// using a cross-compiler, and then copied on top of a pre-compiled distribution (see http://nsis.sourceforge.net/Docs/AppendixG.html#G.3). So one possible fix is to ensure that no cross-compilation is in fact done, allowing whatever clang-specific options we like to be included in {{{APPEND_CCFLAGS}}}. It turns out that the only component that is being cross-compiled is ExDLL, an example nsis plugin. I think that is probably an oversight, introduced in http://sourceforge.net/p/nsis/code/5826/#diff-3 when ExDLL was split from the SKIPMISC group. I'm attaching a patch for SConstruct that adds ExDLL to the SKIPPLUGINS group instead, since that's what it's checked against before building. Alternatively, instead of specifying what not to build, we could be more specific about what we do want to build, ie replace: {{{ build: scons SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all destroot: scons SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all install }}} with eg: {{{ build: scons makensis destroot: scons install-compiler install-conf install-doc }}} and then copy the rest from the pre-compiled distribution. I also got a separate error building nsis with clang on 10.8. It builds ok with Xcode 4.6.3, but with Xcode 5.1.1 linking makensis fails. In the log, ld has this to say: {{{ ld: warning: option -s is obsolete and being ignored ld: internal error: atom not found in symbolIndex(__ZN14LangStringListD2Ev) for architecture i386 }}} Nevertheless, this is easily resolved by appending {{{STRIP=no}}} to {{{${scons.args}}}}. This fix also comes courtesy of homebrew: https://github.com/Homebrew/homebrew/issues/28718 === building without clang === The other way to fix these build problems is to avoid using clang, in a cleaner manner than by using {{{port select}}}. My patch for SConstruct also adds CC and CXX options that allow the Portfile to select a compiler by the usual means. The corresponding patch for the Portfile chooses one of llvm-gcc-4.2, gcc-4.2 or apple-gcc-4.2. That list is just out of expediency - if you don't have llvm-gcc-4.2 or gcc-4.2 from Xcode then apple-gcc-4.2 will be used, which is already a build dependency via i386-mingw32-gcc. === proposed steps for resolution === 1. don't build with clang - in near term at least 1. apply patch and set compiler in port 1. submit bug report upstream to add CC and CXX options 1. don't build ExDLL when passed SKIPPLUGINS=all 1. apply patch in port 1. submit bug report upstream 1. choose whether to cross-compile - if not, remove build dependency on i386-mingw32-gcc - pro: it's the normal MacPorts way to build rather than download (except for port binaries). - con: nsis build instructions state that MinGW "results in noticeably larger installers". - all components build for me except 'NSIS Menu' - that complains it's missing wx-config, so it might work with a build dependency on wxWidgets - either way it should be possible to tidy up the invocation of scons a bit 1. submit bugs for clang compatibility upstream 1. set -stdlib=libstdc++ when building with clang or fix build problems against libc++ 1. add separate CCFLAGS etc options for native and cross-compilers 1. re-enable building with clang - add STRIP=no to scons.args -- Ticket URL: <https://trac.macports.org/ticket/41275#comment:7> MacPorts <http://www.macports.org/> Ports system for OS X