[MacPorts] #51451: gnutls @3.4.12: build fails on 10.6, undefined symbol strndup.
#51451: gnutls @3.4.12: build fails on 10.6, undefined symbol strndup. ----------------------+-------------------- Reporter: devans@… | Owner: mps@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: Keywords: | Port: gnutls ----------------------+-------------------- Build fails as follows on 10.6: {{{ /bin/sh ../libtool --tag=CC --mode=link /usr/bin/gcc-4.2 -W -Wabi -Waddress -Wall -Wattributes -Wbad-function-cast -Wcast-align -Wchar- subscripts -Wcomment -Wcomments -Wdeprecated -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wempty-body -Wendif-labels -Wextra -Wformat-extra-args -Wformat-security -Wformat-zero-length -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Winit-self -Wint-to- pointer-cast -Winvalid-pch -Wmain -Wmissing-braces -Wmissing-declarations -Wmissing-field-initializers -Wmissing-include-dirs -Wmissing-prototypes -Wmultichar -Wnested-externs -Wnonnull -Wold-style-definition -Woverflow -Woverride-init -Wpacked -Wparentheses -Wpointer-arith -Wpointer-sign -Wpointer-to-int-cast -Wpragmas -Wreturn-type -Wsequence-point -Wshadow -Wstrict-aliasing -Wstrict-prototypes -Wswitch -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunsafe-loop-optimizations -Wunused -Wunused-function -Wunused-label -Wunused-macros -Wunused-parameter -Wunused-value -Wunused- variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wnormalized=nfc -Wno-missing-field-initializers -Wno-missing-field- initializers -Wno-format-y2k -Wno-unused-value -Wno-unused-parameter -Wno- stack-protector -Wno-int-to-pointer-cast -fdiagnostics-show-option -pipe -Os -arch x86_64 -module -no-undefined -avoid-version -L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 -o libpkcs11mock1.la -rpath /opt/local/lib/gnutls pkcs11/pkcs11-mock.lo -lintl libtool: warning: '-no-install' is ignored for x86_64-apple-darwin10 libtool: warning: assuming '-no-fast-install' instead libtool: link: ar cru .libs/libutils.a .libs/utils.o libtool: link: ranlib .libs/libutils.a libtool: link: ( cd ".libs" && rm -f "libutils.la" && ln -s "../libutils.la" "libutils.la" ) libtool: link: /usr/bin/gcc-4.2 -o .libs/libpkcs11mock1.so -bundle pkcs11/.libs/pkcs11-mock.o -L/opt/local/lib /opt/local/lib/libintl.dylib -Os -arch x86_64 -Wl,-headerpad_max_install_names -arch x86_64 Undefined symbols: "_strndup", referenced from: _C_FindObjectsInit in pkcs11-mock.o ld: symbol(s) not found collect2: ld returned 1 exit status make[3]: *** [libpkcs11mock1.la] Error 1 make[3]: Leaving directory `/opt/local/var/macports/build/_opt_mports_dports_devel_gnutls/gnutls/work/gnutls-3.4.12/tests' }}} This is a common error on 10.6 -- strndup was not introduced to OS X until 10.7. A typical fix is to provide a static replacement function that is only used on 10.6 or earlier. See [https://trac.macports.org/browser/trunk/dports/multimedia/libmms/files/strnd... this patch in libmms] for one way to accomplish this. Needless to say this blocks the build on 10.6 of any port that depends on gnutls. -- Ticket URL: <https://trac.macports.org/ticket/51451> MacPorts <https://www.macports.org/> Ports system for OS X
#51451: gnutls @3.4.12: build fails on 10.6, undefined symbol strndup. -----------------------+------------------- Reporter: devans@… | Owner: mps@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: gnutls | -----------------------+------------------- Comment (by mps@…): Sorry about that. I was off-line this morning, and had put together a patch, but had no way of testing it. This patch is a better solution. Thanks David! Fixed in r148866. -- Ticket URL: <https://trac.macports.org/ticket/51451#comment:2> MacPorts <https://www.macports.org/> Ports system for OS X
#51451: gnutls @3.4.12: build fails on 10.6, undefined symbol strndup. -----------------------+-------------------- Reporter: devans@… | Owner: mps@… Type: defect | Status: closed Priority: Normal | Milestone: Component: ports | Version: Resolution: fixed | Keywords: Port: gnutls | -----------------------+-------------------- Changes (by devans@…): * status: new => closed * resolution: => fixed Comment: Thanks for the quick fix! -- Ticket URL: <https://trac.macports.org/ticket/51451#comment:3> MacPorts <https://www.macports.org/> Ports system for OS X
#51451: gnutls @3.4.12: build fails on 10.6, undefined symbol strndup. -----------------------+-------------------- Reporter: devans@… | Owner: mps@… Type: defect | Status: closed Priority: Normal | Milestone: Component: ports | Version: Resolution: fixed | Keywords: Port: gnutls | -----------------------+-------------------- Comment (by braumann@…): Fix works, thanks. -- Ticket URL: <https://trac.macports.org/ticket/51451#comment:4> MacPorts <https://www.macports.org/> Ports system for OS X
#51451: gnutls @3.4.12: build fails on 10.6, undefined symbol strndup. -----------------------+---------------------- Reporter: devans@… | Owner: mps@… Type: defect | Status: reopened Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: gnutls | -----------------------+---------------------- Changes (by Peter_Dyballa@…): * status: closed => reopened * resolution: fixed => -- Ticket URL: <https://trac.macports.org/ticket/51451#comment:5> MacPorts <https://www.macports.org/> Ports system for OS X
#51451: gnutls @3.4.12: build fails on 10.6, undefined symbol strndup. -----------------------+---------------------- Reporter: devans@… | Owner: mps@… Type: defect | Status: reopened Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: gnutls | -----------------------+---------------------- Comment (by Peter_Dyballa@…): A similar error happens on PPC Tiger, Mac OS X 10.4.11: {{{ :info:build mv -f $depbase.Tpo $depbase.Plo :info:build libtool: compile: /opt/local/bin/gcc-apple-4.2 -DHAVE_CONFIG_H -I. -I.. -I/opt/local/include/p11-kit-1 -I../lib/includes -I../lib/includes -I../libdane/includes -I../libdane/includes -I../extra/includes -I../extra/includes -I../lib -I../doc/examples -I/opt/local/include -W -Wabi -Waddress -Wall -Wattributes -Wbad-function- cast -Wcast-align -Wchar-subscripts -Wcomment -Wcomments -Wdeprecated -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wempty- body -Wendif-labels -Wextra -Wformat-extra-args -Wformat-security -Wformat-zero-length -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmain -Wmissing-braces -Wmissing-declarations -Wmissing-field-initializers -Wmissing-include-dirs -Wmissing-prototypes -Wmultichar -Wnested-externs -Wnonnull -Wold-style-definition -Woverflow -Woverride-init -Wpacked -Wparentheses -Wpointer-arith -Wpointer-sign -Wpointer-to-int-cast -Wpragmas -Wreturn-type -Wsequence-point -Wshadow -Wstrict-aliasing -Wstrict-prototypes -Wswitch -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunsafe-loop-optimizations -Wunused -Wunused-function -Wunused-label -Wunused-macros -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wnormalized=nfc -Wno-missing-field-initializers -Wno-missing-field-initializers -Wno- format-y2k -Wno-unused-value -Wno-unused-parameter -Wno-stack-protector -Wno-int-to-pointer-cast -fdiagnostics-show-option -pipe -Os -arch ppc -MT pkcs11/pkcs11-mock.lo -MD -MP -MF pkcs11/.deps/pkcs11-mock.Tpo -c pkcs11/pkcs11-mock.c -fno-common -DPIC -o pkcs11/.libs/pkcs11-mock.o :info:build cc1: warning: command line option "-Wabi" is valid for C++/ObjC++ but not for C :info:build cc1: warning: command line option "-Wdeprecated" is valid for C++/ObjC++ but not for C :info:build pkcs11/pkcs11-mock.c:21:26: error: Availability.h: No such file or directory :info:build pkcs11/pkcs11-mock.c:23: warning: declaration of 'strndup' shadows a built-in function [-Wshadow] :info:build make[3]: *** [pkcs11/pkcs11-mock.lo] Error 1 :info:build make[3]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_gnutls/gnutls/work/gnutls-3.4.12/tests' :info:build make[2]: *** [all-recursive] Error 1 :info:build make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_gnutls/gnutls/work/gnutls-3.4.12/tests' :info:build make[1]: *** [all-recursive] Error 1 :info:build make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_gnutls/gnutls/work/gnutls-3.4.12' :info:build make: *** [all] Error 2 :info:build make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_gnutls/gnutls/work/gnutls-3.4.12' :info:build Command failed: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_gnutls/gnutls/work/gnutls-3.4.12" && /usr/bin/make -w all }}} Another port is being built so I have to wait until I can check whether the patch would work. -- Ticket URL: <https://trac.macports.org/ticket/51451#comment:7> MacPorts <https://www.macports.org/> Ports system for OS X
#51451: gnutls @3.4.12: build fails on 10.6, undefined symbol strndup. -----------------------+---------------------- Reporter: devans@… | Owner: mps@… Type: defect | Status: reopened Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: gnutls | -----------------------+---------------------- Comment (by mps@…): Replying to [comment:7 Peter_Dyballa@…]:
A similar error happens on PPC Tiger, Mac OS X 10.4.11:
Did you run {{{sudo port sync}}} after the patch was committed? The patch should work for all versions of OS X, Snow Leopard and older. If not do that and then rub {{{sudo port clean gnutls}}} before {{{sudo port upgrade gnutls}}}. -- Ticket URL: <https://trac.macports.org/ticket/51451#comment:8> MacPorts <https://www.macports.org/> Ports system for OS X
#51451: gnutls @3.4.12: build fails on 10.6, undefined symbol strndup. -----------------------+---------------------- Reporter: devans@… | Owner: mps@… Type: defect | Status: reopened Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: gnutls | -----------------------+---------------------- Comment (by Peter_Dyballa@…): Replying to [comment:8 mps@…]:
Replying to [comment:7 Peter_Dyballa@…]:
A similar error happens on PPC Tiger, Mac OS X 10.4.11:
Did you run {{{sudo port sync}}} after the patch was committed?
No. I ran the regular `port selfupdate`. And only one patch file appeared: {{{ -rw-r--r-- 1 root wheel 1036 20 Mai 20:30 patch-tests- pkcs11-pkcs11-mock.c.diff }}} which has the correct contents. I can see that patch being applied: {{{ DEBUG: patch phase started at Sun May 22 14:59:40 CEST 2016 DEBUG: Executing org.macports.patch (gnutls) ---> Applying patches to gnutls ---> Applying patch-tests-pkcs11-pkcs11-mock.c.diff }}} But I think this line {{{ +#include <Availability.h> }}} introduces the actual error, which is: {{{ pkcs11/pkcs11-mock.c:21:26: error: Availability.h: No such file or directory }}} -- Ticket URL: <https://trac.macports.org/ticket/51451#comment:9> MacPorts <https://www.macports.org/> Ports system for OS X
#51451: gnutls @3.4.12: build fails on 10.6, undefined symbol strndup. -----------------------+---------------------- Reporter: devans@… | Owner: mps@… Type: defect | Status: reopened Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: gnutls | -----------------------+---------------------- Comment (by Peter_Dyballa@…): PPC Tiger, Mac OS X 10.4.11 has only these C header files with Availability in the name: {{{ /Developer/SDKs/MacOSX10.3.9.sdk/Developer/Headers/CFMCarbon/AvailabilityMacros.h /Developer/SDKs/MacOSX10.3.9.sdk/usr/include/AvailabilityMacros.h /Developer/SDKs/MacOSX10.3.9.sdk/usr/lib/gcc/powerpc-apple- darwin7/4.0.0/include/AvailabilityMacros.h /Developer/SDKs/MacOSX10.4u.sdk/Developer/Headers/CFMCarbon/AvailabilityMacros.h /Developer/SDKs/MacOSX10.4u.sdk/usr/include/AvailabilityMacros.h }}} -- Ticket URL: <https://trac.macports.org/ticket/51451#comment:10> MacPorts <https://www.macports.org/> Ports system for OS X
#51451: gnutls @3.4.12: build fails on 10.6, undefined symbol strndup. -----------------------+---------------------- Reporter: devans@… | Owner: mps@… Type: defect | Status: reopened Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: gnutls | -----------------------+---------------------- Comment (by mps@…): Peter, My original patch would have worked, but would have made for a messy Portfile (patching as a function of the Darwin version #), so I opted for David's approach. As I no longer have a Tiger machine (I do have a Leopard G5 iMac, where this update build correctly), nor do the build bots build anything older than Snow Leopard, so I have no way of testing on older, unsupported, systems. The best approach is to make a local build tree and modify the patch file by removing {{{ #ifdef __APPLE__ #include <Availability.h> #if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060 }}} and {{{ #endif #endif }}} which was my original patch. -- Ticket URL: <https://trac.macports.org/ticket/51451#comment:11> MacPorts <https://www.macports.org/> Ports system for OS X
#51451: gnutls @3.4.12: build fails on 10.6, undefined symbol strndup. -----------------------+---------------------- Reporter: devans@… | Owner: mps@… Type: defect | Status: reopened Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: gnutls | -----------------------+---------------------- Comment (by Peter_Dyballa@…): Replying to [comment:11 mps@…]:
The best approach is to make a local build tree and modify the patch
file by removing
Or trying that? {{{ #ifdef __APPLE__ #if __MAC_OS_X_VERSION_MIN_REQUIRED => 1050 #include <Availability.h> #endif #if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060 }}} -- Ticket URL: <https://trac.macports.org/ticket/51451#comment:12> MacPorts <https://www.macports.org/> Ports system for OS X
#51451: gnutls @3.4.12: build fails on 10.6, undefined symbol strndup. -----------------------+---------------------- Reporter: devans@… | Owner: mps@… Type: defect | Status: reopened Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: gnutls | -----------------------+---------------------- Comment (by Peter_Dyballa@…): GnuTLS builds this corrected patch file. I am not sure whether I can test it on PPC Leopard, Mac OS X 10.5.8, tonight… -- Ticket URL: <https://trac.macports.org/ticket/51451#comment:13> MacPorts <https://www.macports.org/> Ports system for OS X
#51451: gnutls @3.4.12: build fails on 10.6, undefined symbol strndup. -----------------------+---------------------- Reporter: devans@… | Owner: mps@… Type: defect | Status: reopened Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: gnutls | -----------------------+---------------------- Comment (by devans@…): This latest proposed fix will break builds where strndup DOES exist (10.7+). I committed a tentative fix in r149004 that updates this patch to test for 10.4 and earlier and include AvailabilityMacros.h rather than Availability.h if that's the case. Please test and advise. -- Ticket URL: <https://trac.macports.org/ticket/51451#comment:14> MacPorts <https://www.macports.org/> Ports system for OS X
#51451: gnutls @3.4.12: build fails on 10.6, undefined symbol strndup. -----------------------+---------------------- Reporter: devans@… | Owner: mps@… Type: defect | Status: reopened Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: gnutls | -----------------------+---------------------- Comment (by Peter_Dyballa@…): Replying to [comment:14 devans@…]:
Please test and advise.
On the weekend when I'll be home again! -- Ticket URL: <https://trac.macports.org/ticket/51451#comment:15> MacPorts <https://www.macports.org/> Ports system for OS X
#51451: gnutls @3.4.12: build fails on 10.6, undefined symbol strndup. -----------------------+---------------------- Reporter: devans@… | Owner: mps@… Type: defect | Status: reopened Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: gnutls | -----------------------+---------------------- Comment (by Peter_Dyballa@…): Replying to [comment:14 devans@…]: GnuTLS @3.4.11_1 built on PPC Leopard, Mac OS X 10.5.8. -- Ticket URL: <https://trac.macports.org/ticket/51451#comment:16> MacPorts <https://www.macports.org/> Ports system for OS X
#51451: gnutls @3.4.12: build fails on 10.6, undefined symbol strndup. -----------------------+---------------------- Reporter: devans@… | Owner: mps@… Type: defect | Status: reopened Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: gnutls | -----------------------+---------------------- Comment (by help@…): Compilation is broken on OSX 10.10 when macosx_deployment_target is set to 10.6 (reason being weak-linking): {{{ :info:build pkcs11/pkcs11-mock.c:29:15: error: static declaration of 'strndup' follows non-static declaration :info:build static char * strndup (char const *s, size_t n); :info:build ^ :info:build /usr/include/string.h:132:7: note: previous declaration is here :info:build char *strndup(const char *, size_t) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); :info:build ^ :info:build pkcs11/pkcs11-mock.c:30:15: error: static declaration of 'strnlen' follows non-static declaration :info:build static size_t strnlen (const char *string, size_t maxlen); :info:build ^ :info:build /usr/include/string.h:133:10: note: previous declaration is here :info:build size_t strnlen(const char *, size_t) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); :info:build ^ :info:build pkcs11/pkcs11-mock.c:33:1: error: static declaration of 'strnlen' follows non-static declaration :info:build strnlen (const char *string, size_t maxlen) :info:build ^ :info:build /usr/include/string.h:133:10: note: previous declaration is here :info:build size_t strnlen(const char *, size_t) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); :info:build ^ :info:build pkcs11/pkcs11-mock.c:40:1: error: static declaration of 'strndup' follows non-static declaration :info:build strndup (char const *s, size_t n) :info:build ^ :info:build /usr/include/string.h:132:7: note: previous declaration is here :info:build char *strndup(const char *, size_t) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); :info:build ^ :info:build 4 errors generated. }}} I suggest alternative fix (attached) which is less pretty (uses #defines) but seems to work. -- Ticket URL: <https://trac.macports.org/ticket/51451#comment:17> MacPorts <https://www.macports.org/> Ports system for OS X
#51451: gnutls @3.4.12: build fails on 10.6, undefined symbol strndup. -----------------------+---------------------- Reporter: devans@… | Owner: mps@… Type: defect | Status: reopened Priority: Normal | Milestone: Component: ports | Version: Resolution: | Keywords: Port: gnutls | -----------------------+---------------------- Comment (by Peter_Dyballa@…): Replying to [comment:14 devans@…]: It was of course GnuTLS @3.4.12 that built on PPC Leopard, Mac OS X 10.5.8. And the same version also built on PPC Tiger, Mac OS X 10.4.11. -- Ticket URL: <https://trac.macports.org/ticket/51451#comment:19> MacPorts <https://www.macports.org/> Ports system for OS X
#51451: gnutls @3.4.12: build fails on 10.6, undefined symbol strndup. -----------------------+-------------------- Reporter: devans@… | Owner: mps@… Type: defect | Status: closed Priority: Normal | Milestone: Component: ports | Version: Resolution: fixed | Keywords: Port: gnutls | -----------------------+-------------------- Changes (by devans@…): * status: reopened => closed * resolution: => fixed -- Ticket URL: <https://trac.macports.org/ticket/51451#comment:20> MacPorts <https://www.macports.org/> Ports system for OS X
participants (1)
-
MacPorts