lowdown not helped by snowleopardfixes

Ken Cunningham ken.cunningham.webuse at gmail.com
Wed Feb 21 16:46:21 UTC 2018

lowdown uses it's own completely unique methods for configure and library function replacements, I see.

It clears out the LDFLAGS during the build, ergo the -lsnowleopardfixes not being honoured

it also replaces some functions on it's own, so there might be collisions if -lsnowleopardfixes was patched into the build script link flags.

For a port like this, the best I could offer would be to patch in the missing strndup definition into compats.c

the author probably wouldn't mind adding strndup to the other functions he tests for -- he already checks for lots of them.

a definition for strndup.c is here <https://github.com/kencu/snowleopardfixes/blob/master/strndup.c> but requires strnlen as well to function.

Sorry this is not one of the "drop in" fixes that the PG usually offers...


On 2018-02-21, at 5:40 AM, Jan Stary wrote:

> Hi Ken,
> when I created the textproc/lowdown port not long ago
> https://github.com/macports/macports-ports/pull/1241
> you kindly advised me to use
> 	PortGroup snowleopard_fixes 1.0
> so that older MacOS sysem without e.g. strndup(3)
> can still compile lowdown.
> However, it seems that the compilation still fails,
> at least on my 10.5.8 and 10.6.8. The snowleopardfixes port
> compiles and installs just fine, providing
> $ nm /opt/local/lib/libsnowleopardfixes.dylib
> 0000000000001d46 s  stub helpers
>                 U ___error
> 0000000000000000 t __mh_dylib_header
>                 U _getc
> 0000000000001ad9 T _getdelim
> 0000000000001ac7 T _getline
>                 U _malloc
>                 U _memchr
>                 U _memcmp
>                 U _memcpy
> 0000000000001c1c T _memmem
>                 U _realloc
> 0000000000001bca T _strndup
> 0000000000001a8c T _strnlen
> 0000000000001cbc T _wcsdup
>                 U _wcslen
>                 U _wmemcpy
>                 U dyld_stub_binder
> But when building lowdown itself (full log below)
> it fails on a missing strndup(3). The failing line is
> 	/usr/bin/gcc-4.2 -o lowdown main.o liblowdown.a -lm
> 	Undefined symbols:
> 	"_strndup", referenced from:
> 	_xstrndup in liblowdown.a(xmalloc.o)
> 	ld: symbol(s) not found
> 	collect2: ld returned 1 exit status
> The installed snowleopardfixes library doesn't seem
> to even enter into it at all. Am I missing something
> obvious about how the snowleopard_fixes portgroup
> is supposed to work?
> 	Jan
> hans at mac:~$ sudo port -vs install lowdown
> --->  Computing dependencies for lowdown.
> --->  Fetching distfiles for lowdown
> --->  Verifying checksums for lowdown
> --->  Checksumming lowdown-0.3.1.tar.gz
> --->  Extracting lowdown
> --->  Extracting lowdown-0.3.1.tar.gz
> Executing:  cd "/opt/local/var/macports/build/_opt_mports_macports-ports_textproc_lowdown/lowdown/work" && /usr/bin/gzip -dc '/opt/local/var/macports/distfiles/lowdown/lowdown-0.3.1.tar.gz' | /usr/bin/gnutar --no-same-owner -xf - 
> --->  Configuring lowdown
> Executing:  cd "/opt/local/var/macports/build/_opt_mports_macports-ports_textproc_lowdown/lowdown/work/lowdown-0.3.1" && ./configure  PREFIX=/opt/local 
> config.log: writing...
> configure.local: no (fully automatic configuration)
> arc4random: yes
> capsicum: no
> err: yes
> explicit_bzero: no
> getprogname: yes
> INFTIM: no
> md5: no
> memmem: no
> memrchr: no
> memset_s: no
> PATH_MAX: yes
> pledge: no
> program_invocation_short_name: no
> reallocarray: no
> recallocarray: no
> sandbox_init: no
> seccomp-filter: no
> strlcat: yes
> strlcpy: yes
> strtonum: no
> systrace: no
> zlib: yes
> __progname: yes
> config.h: written
> Makefile.configure: written
> --->  Building lowdown
> Executing:  cd "/opt/local/var/macports/build/_opt_mports_macports-ports_textproc_lowdown/lowdown/work/lowdown-0.3.1" && /usr/bin/make -w all 
> make: Entering directory `/opt/local/var/macports/build/_opt_mports_macports-ports_textproc_lowdown/lowdown/work/lowdown-0.3.1'
> /usr/bin/gcc-4.2 -pipe -Os -arch x86_64 -g -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter   -c -o autolink.o autolink.c
> /usr/bin/gcc-4.2 -pipe -Os -arch x86_64 -g -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter   -c -o buffer.o buffer.c
> /usr/bin/gcc-4.2 -pipe -Os -arch x86_64 -g -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter   -c -o diff.o diff.c
> /usr/bin/gcc-4.2 -pipe -Os -arch x86_64 -g -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter   -c -o document.o document.c
> /usr/bin/gcc-4.2 -pipe -Os -arch x86_64 -g -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter   -c -o html.o html.c
> /usr/bin/gcc-4.2 -pipe -Os -arch x86_64 -g -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter   -c -o html_escape.o html_escape.c
> /usr/bin/gcc-4.2 -pipe -Os -arch x86_64 -g -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter   -c -o html_smartypants.o html_smartypants.c
> /usr/bin/gcc-4.2 -pipe -Os -arch x86_64 -g -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter   -c -o library.o library.c
> /usr/bin/gcc-4.2 -pipe -Os -arch x86_64 -g -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter   -c -o log.o log.c
> /usr/bin/gcc-4.2 -pipe -Os -arch x86_64 -g -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter   -c -o nroff.o nroff.c
> /usr/bin/gcc-4.2 -pipe -Os -arch x86_64 -g -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter   -c -o nroff_escape.o nroff_escape.c
> /usr/bin/gcc-4.2 -pipe -Os -arch x86_64 -g -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter   -c -o nroff_smartypants.o nroff_smartypants.c
> /usr/bin/gcc-4.2 -pipe -Os -arch x86_64 -g -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter   -c -o tree.o tree.c
> /usr/bin/gcc-4.2 -pipe -Os -arch x86_64 -g -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter   -c -o util.o util.c
> /usr/bin/gcc-4.2 -pipe -Os -arch x86_64 -g -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter   -c -o xmalloc.o xmalloc.c
> xmalloc.c: In function ‘xstrndup’:
> xmalloc.c:94: warning: implicit declaration of function ‘strndup’
> xmalloc.c:94: warning: incompatible implicit declaration of built-in function ‘strndup’
> /usr/bin/gcc-4.2 -pipe -Os -arch x86_64 -g -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter   -c -o compats.o compats.c
> ar rs liblowdown.a autolink.o buffer.o diff.o document.o html.o html_escape.o html_smartypants.o library.o log.o nroff.o nroff_escape.o nroff_smartypants.o tree.o util.o xmalloc.o compats.o
> ar: creating archive liblowdown.a
> /usr/bin/gcc-4.2 -pipe -Os -arch x86_64 -g -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter   -c -o main.o main.c
> main.c:128:2: warning: #warning Compiling without sandbox support.
> /usr/bin/gcc-4.2 -o lowdown main.o liblowdown.a -lm
> Undefined symbols:
>  "_strndup", referenced from:
>      _xstrndup in liblowdown.a(xmalloc.o)
> ld: symbol(s) not found
> collect2: ld returned 1 exit status
> make: *** [lowdown] Error 1
> make: Leaving directory `/opt/local/var/macports/build/_opt_mports_macports-ports_textproc_lowdown/lowdown/work/lowdown-0.3.1'
> Command failed:  cd "/opt/local/var/macports/build/_opt_mports_macports-ports_textproc_lowdown/lowdown/work/lowdown-0.3.1" && /usr/bin/make -w all 
> Exit code: 2
> Error: Failed to build lowdown: command execution failed
> Error: See /opt/local/var/macports/logs/_opt_mports_macports-ports_textproc_lowdown/lowdown/main.log for details.
> Error: Follow https://guide.macports.org/#project.tickets to report a bug.
> Error: Processing of port lowdown failed

More information about the macports-users mailing list