libtool is ignoring make.conf CFLAGS += -static

Julian H. Stacey jhs at berklix.com
Wed Oct 26 16:56:03 UTC 2011


Hi ports@
libtool is not honouring the -static in my /etc/make.conf

grep CFLAGS /etc/make.conf
	CFLAGS += -DJHSJHSX=JHSJHSX	# Debug
	CFLAGS += -static       # for /usr/ports/sysutils/ntfsprogs
	CFLAGS += -pipe          # Not on hosts with little RAM
	CFLAGS += -static-libgcc	# Debug, do I need this ?
	CFLAGS += -DJHSJHSY=JHSJHSY	# Debug

cd /usr/ports/sysutils/ntfsprogs ; make ; make install 
file `which ntfsresize`
	/usr/local/sbin/ntfsresize: ELF 64-bit LSB executable,
	x86-64, version 1 (FreeBSD), dynamically linked (uses shared
	libs), for FreeBSD 8.2, stripped

uname -a
	FreeBSD fire.js.berklix.net 8.2-RELEASE FreeBSD 8.2-RELEASE
	#0: Thu Jun  2 23:10:13 CEST 2011
	jhs at blak.js.berklix.net:/ad6s4/release/8.2-RELEASE/src/sys/amd64/compile/FIRE64.small amd64

When making, I see
	/bin/sh ../libtool --tag=CC    --mode=link cc  -O2 -pipe \
	-DJHSJHSX=JHSJHSX -static -pipe -static-libgcc -DJHSJHSY=JHSJHSY \
	-DUSE_LOCK -DUSE_UBLIO -fno-strict-aliasing -Wall \
	-L/usr/local/lib -o ntfsresize ntfsresize.o utils.o \
	../libntfs/libntfs.la

	cc -O2 -pipe -DJHSJHSX=JHSJHSX -pipe -static-libgcc \
	-DJHSJHSY=JHSJHSY -DUSE_LOCK -DUSE_UBLIO -fno-strict-aliasing \
	-Wall -o ntfsresize ntfsresize.o utils.o  -L/usr/local/lib \
	../libntfs/.libs/libntfs.a -lublio

One cant ignore that -static is Not there in last line above
	(First I wrongly assumed it didnt matter as libtool was running
	 first, then CC was running, but no, I assume CC is running inside
	 libtool)

cd /usr/ports/sysutils/ntfsprogs/work/ntfsprogs-2.0.0/ntfsprogs
file ntfsresize ntfsresize.o utils.o ../libntfs/libntfs.la
	ntfsresize:                 ELF 64-bit LSB executable, x86-64,  \
		version 1 (FreeBSD), dynamically linked (uses shared libs), \
		for FreeBSD 8.2, not stripped
	ntfsresize.o:               ELF 64-bit LSB relocatable, x86-64,  \
		version 1 (FreeBSD), not stripped
	utils.o:                    ELF 64-bit LSB relocatable, x86-64,  \
		version 1 (FreeBSD), not stripped
	../libntfs/libntfs.la:      libtool library file
	../libntfs/.libs/libntfs.a: current ar archive

Reruning manually, adding -static back:
	cd /usr/ports/sysutils/ntfsprogs/work/ntfsprogs-2.0.0/ntfsprogs 
	cc -O2 -pipe -DJHSJHSX=JHSJHSX -pipe -static  -static-libgcc \
		-DJHSJHSY=JHSJHSY -DUSE_LOCK -DUSE_UBLIO -fno-strict-aliasing \
		-Wall -o ntfsresize ntfsresize.o utils.o -L/usr/local/lib \
		../libntfs/.libs/libntfs.a -lublio
	file ntfsresize
		ntfsresize: ELF 64-bit LSB executable, x86-64,
		version 1 (FreeBSD), statically linked, for FreeBSD
		8.2, not stripped

So how to get libtool to honour the make.conf directive
	CFLAGS += -static
?
PS I'm new to libtool, just skimming `man libtool` now.

PPS I wanted ntfsresive static to graft onto a USB memstick.img,
(which Ive since cludged dynamic, but static could still be handy
for the future).

Cheers,
Julian
-- 
Julian Stacey, BSD Unix Linux C Sys Eng Consultants Munich http://berklix.com
 Reply below, not above;  Indent with "> ";  Cumulative like a play script.
 Format: Plain text. Not HTML, multipart/alternative, base64, quoted-printable.


More information about the freebsd-ports mailing list