LUA fails upgrade on 7.2/amd64

b. f. bf1783 at googlemail.com
Tue Sep 7 21:05:00 UTC 2010


>> So, I've had the following in /etc/make.conf since eons:
>> CFLAGS=-O -pipe
>> COPTFLAGS=-O -pipe
>>
>>
>> Genrally speaking (meaning for any port), is this still useful?
>> Are the above flags deprecated?
>> Will I get optimized code without them?
>
>$ make -V CFLAGS -V COPTFLAGS
>- -O2 -pipe
>- -O2 -pipe
>
>are the defaults for 'eons' now for both /usr/src userland and kernel
>and ports.

This is not quite the whole story -- apart from warnings, and changes
due to debugging or profiling, these flags may also depend on the
architecture, the compiler, and the version of FreeBSD.  Some of the
architectures drop the optimization level in the CFLAGS to -O (arm,
mips), even though they may not do it for COPTFLAGS.  amd64 appends
-frename-registers to COPTFLAGS.  Fortran flags (no longer used by the
base system) are still set at -O.  Some flags are trimmed from CFLAGS
to form CXXFLAGS.  By default, ports append -fno-strict-aliasing in
bsd.port.mk, as does the base system for FreeBSD < 8, but not FreeBSD
>= 8.  And there are still overrides present for icc, which,
seemingly, almost no one uses anymore.  The details are in
/usr/src/sys/conf/kern.pre.mk, the makefiles in /usr/src/share/mk or
/usr/share/mk, and bsd.port.mk.

It seems to be a common mistake, that people do not realize that
make.conf is often parsed a second time for do-build and other ports
targets, after port Makefiles, so that *FLAGS= ... assignments in
make.conf may override the *FLAGS settings from port Makefiles in
MAKE_ENV.  Given the examples in /usr/share/examples/etc/make.conf,
which seem designed for the base system, perhaps we ought to add a
comment explicitly warning people about this.

Also, I am not sure about the test for the addition of -fPIC in the
lang/lua Makefile -- I wonder if the test should be against ARCH, as
requested in bsd.port.mk, rather than MACHINE_ARCH.

Furthermore, this port links the shared library with only an empty
MYLDFLAGS -- this may break builds with certain CFLAGS, or with
compilers from ports.  The following is more appropriate:


--- old.patch-src-Makefile      2010-09-05 08:59:47.000000000 -0400
+++ patch-src-Makefile  2010-09-05 09:02:10.000000000 -0400
@@ -30,7 +30,7 @@
  a:    $(ALL_A)

 +$(LUA_SO):    $(CORE_O) $(LIB_O)
-+      $(CC) -o $@ $(MYLDFLAGS) -shared -Wl,-soname=$(LUA_SONAME) $?
++      $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(MYLDFLAGS) -shared
-Wl,-soname=$(LUA_SONAME) $?
 +
  $(LUA_A): $(CORE_O) $(LIB_O)
 -      $(AR) $@ $?


More information about the freebsd-ports mailing list