Opened 11 years ago
Closed 8 years ago
#41275 closed defect (fixed)
nsis: build failure under 10.9
Reported by: | clemens.lanthaler@… | Owned by: | landonf (Landon Fuller) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.2.1 |
Keywords: | Cc: | steve+macports@… | |
Port: | nsis |
Description
If I try to do "port install nsis" I am getting the error message attached as file. Under OSX 10.8 all was working fine. I can install other packages and therfore my environment should be ok.
Attachments (4)
Change History (19)
Changed 11 years ago by clemens.lanthaler@…
comment:1 Changed 11 years ago by larryv (Lawrence Velázquez)
Owner: | changed from macports-tickets@… to landonf@… |
---|---|
Port: | nsis added |
Summary: | Build of package NSIS under OSX 10.9 not working → nsis: build failure under 10.9 |
This was not a clean build. Please clean, try again, and attach the complete main.log
.
Changed 11 years ago by panayotis@…
Attachment: | main.2.log added |
---|
main.log after a clean attempt to install
comment:2 Changed 11 years ago by panayotis@…
So, any ideas how to solve this? AFAIK homebrew properly installs this port.
comment:3 Changed 11 years ago by panayotis@…
Here is the fix of nsis under homebrew: https://github.com/Homebrew/homebrew/pull/24545
mabe we can recycle this knowledge?
comment:4 Changed 11 years ago by panayotis@…
I found how to solve it. Just need to add
APPEND_CCFLAGS=--stdlib=libstdc++ APPEND_LINKFLAGS=--stdlib=libstdc++
to the scons.args.
comment:6 Changed 11 years ago by clemens.lanthaler@…
I have now found the var in Portfile and appended the scons.args. But without any success.
Here is the actual content of the scons.args:
set scons.args "PREFIX=\"${prefix}\" PREFIX_DEST=\"${destroot}\" SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all APPEND_CCFLAGS=--stdlib=libstdc++ APPEND_LINKFLAGS=--stdlib=libstdc++"
The new error message is:
:info:build scons: Building targets ... :info:build i386-mingw32-gcc -o build/release/ExDLL/pluginapi.o -c --stdlib=libstdc++ -Os -Wall -fno-strict-aliasing "-DNSISCALL= __attribute__((__stdcall__))" -ISource/exehead Contrib/ExDLL/pluginapi.c :info:build cc1: error: unrecognized command line option "-fstdlib=libstdc++" :info:build scons: *** [build/release/ExDLL/pluginapi.o] Error 1 :info:build scons: building terminated because of errors. :info:build Command failed: cd /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_nsis/nsis/work/nsis-2.45-src && scons PREFIX="/opt/local" PREFIX_DEST="/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_nsis/nsis/work/destroot" SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all APPEND_CCFLAGS=--stdlib=libstdc++ APPEND_LINKFLAGS=--stdlib=libstdc++ :info:build Exit code: 2
comment:7 Changed 10 years ago 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
- don't build with clang - in near term at least
finalise patches to set compiler in portpatches attachedsubmit bug report upstream to add CC and CXX optionshttps://sourceforge.net/p/nsis/patches/253/
- don't build ExDLL when passed SKIPPLUGINS=all
finalise patches to prevent cross-compilation in port and remove dependency on i386-mingw32-gccpatches attachedsubmit bug report upstreamhttps://sourceforge.net/p/nsis/patches/254/
- consider creating separate ticket to build all nsis components, using MinGW for cross-compilation
- 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
submit patch to fix build errors against libc++https://sourceforge.net/p/nsis/bugs/1085/- re-enable building with clang for future version of nsis
- add STRIP=no to scons.args
Changed 10 years ago by steve+macports@…
Attachment: | patch-SConstruct.diff added |
---|
Changed 10 years ago by steve+macports@…
Attachment: | Portfile-nsis.diff added |
---|
comment:9 Changed 10 years ago by ari@…
Is there a reason this patch hasn't been committed after 10 months to macports? I've had to spend 3 hours trolling the internet and coming to all the same conclusions the good people above have already solved.
comment:10 follow-up: 12 Changed 10 years ago by ari@…
For anyone else coming to this ticket after me, the solution is even easier than adding the patch above (which also works for me).
Just install homebrew and they have a working nsis package with no dramas.
comment:11 Changed 10 years ago by mf2k (Frank Schima)
When a maintainer does not respond, it usually gums up the works.
comment:12 Changed 10 years ago by landonf (Landon Fuller)
Replying to ari@…:
Is there a reason this patch hasn't been committed after 10 months to macports? I've had to spend 3 hours trolling the internet and coming to all the same conclusions the good people above have already solved.
I didn't apply it because I'm not using NSIS, it didn't come up on my radar, and I couldn't reasonably evaluate the patch's efficacy; the port is marked openmaintainer for those reasons, so I must assume nobody else applied it because they're also not using NSIS.
Replying to ari@…:
For anyone else coming to this ticket after me, the solution is even easier than adding the patch above (which also works for me).
Confirmation that the patch works is helpful.
Just install homebrew and they have a working nsis package with no dramas.
I'm sure nothing frustrating will ever occur when using homebrew, which, like MacPorts, is provided to you at absolutely no cost entirely through the efforts of volunteers.
comment:13 Changed 10 years ago by steve+macports@…
Hi, I just want to reiterate that if you only want to install the nsis port without fiddling around with patches, it should be possible using the following workaround:
- Select a gcc port - anything other than "none" should work, but you are likely to have apple-gcc42 already available from previous failed builds of nsis. The idea is to change what scons finds when it calls out to gcc, so PATH is important here too. By default it will find /usr/bin/gcc, ie clang, which will fail on 10.9+.
$ sudo port select gcc apple-gcc42
- Install nsis
$ sudo port clean nsis $ sudo port install nsis
- Optionally restore the selected gcc port, eg:
$ sudo port select gcc none
I'm glad to hear that the patches are working for someone else. The patches to SConstruct have been accepted upstream, and the other bug has been resolved such that nsis trunk now compiles with clang / libc++. That one's not a simple backport though, so I stand by the currently attached patches for nsis 2. When nsis 3 is released, with a bit of luck it will be possible to simplify the port to build without any patchfiles or compiler constraints.
comment:14 Changed 9 years ago by benedikt.kulmann@…
The patch is working for me. Thanks a lot for your effort.
comment:15 Changed 8 years ago by ryandesign (Ryan Carsten Schmidt)
Resolution: | → fixed |
---|---|
Status: | new → closed |
Superseded by #51934.
Logfile from install command for NSIS