Re: 9.0 RC1 linking problem with i386 libs on amd64

2011-10-28 Thread Dominic Fandrey
On 26/10/2011 16:39, Dimitry Andric wrote:
 On 2011-10-26 15:32, Dominic Fandrey wrote:
 I haven't tried to dig into this. Only unusual properties of the system
 are my non-default MAKEOBJDIRPREFIX and the use of ccache.

 # uname -a
 FreeBSD AryaStark.norad 9.0-RC1 FreeBSD 9.0-RC1 #0: Wed Oct 26 13:46:13 CEST 
 2011 root@AryaStark.norad:/usr/obj/GENERIC/amd64/usr/src/sys/GENERIC  
 amd64

 # make -VCC -VCPUTYPE -VCFLAGS
 /usr/local/bin/ccache clang
 athlon64-sse3
 -O2 -pipe -march=athlon64-sse3
 
 How are you setting CC and/or CFLAGS, precisely?  Depending on how you
 do it, the settings might not be propagated correctly to the build32
 stage.

Like that:
.if ${.CURDIR:M/usr/src} || ${.CURDIR:M/usr/src/*}
CC=clang
CXX=clang++
CPP=clang-cpp
NO_WERROR=
WERROR=
.endif

I had hoped that the .ifdef construction from the wiki was dated. I
suppose it's emulating setting CC in the environment instead of in
the make/src.conf.

  Also, if you force CFLAGS to have -march=athlon64-sse3, I'm not
 sure if the build32 stage can even work correctly.  Just specify
 CPUTYPE, that should be enough.

That's what I do. I don't touch CFLAGS.

 In any case, you can try out the attached patch, which should take care
 of passing CC to the build32 stage correctly.

I tried CC?=, but that doesn't work, because apparently make always
initializes CC before parsing makefiles. I figure that means the
!defined(CC) clause in the .ifdef construction is never true and thus
obsolete.

I didn't try it, though. Your patch works for me.

 I would really like to have this in head, and even stable/9.  It makes
 it possible to just set CC in make.conf, without .ifdef trickery.  Works
 nicely for clang, too. :)

Seconded!


-- 
A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail? 
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: 9.0 RC1 linking problem with i386 libs on amd64

2011-10-28 Thread Dimitry Andric

On 2011-10-28 16:41, Dominic Fandrey wrote:
...

Like that:
.if ${.CURDIR:M/usr/src} || ${.CURDIR:M/usr/src/*}
CC=clang
CXX=clang++
CPP=clang-cpp
NO_WERROR=
WERROR=
.endif

I had hoped that the .ifdef construction from the wiki was dated. I
suppose it's emulating setting CC in the environment instead of in
the make/src.conf.


There are two different problems here.  One is that src.conf is read
relatively late, and only when bsd.own.mk is included.  Therefore,
src.conf is not the right place to put CC, CXX and so on.

The other problem is that the build32 stage uses environment variables
to override CC, CXX, AS and LD for its sub-make (see LIB32WMAKEENV in
Makefile.inc1), adding the necessary flags for 32-bit compilation.

However, since environment variables are in turn overridden by direct
assignments (like via reading make.conf), the 32-bit compilation flags
get lost when you specify any of CC, CXX, AS or LD in make.conf.

This latter problem is what my patch attempts to fix, while changing as
little as possible.

...

I tried CC?=, but that doesn't work, because apparently make always
initializes CC before parsing makefiles.


Yes, that is because make implicitly reads sys.mk, which either defines
CC directly, or through reading make.conf.


...

I didn't try it, though. Your patch works for me.


I would really like to have this in head, and even stable/9.  It makes
it possible to just set CC in make.conf, without .ifdef trickery.  Works
nicely for clang, too. :)


Seconded!


If there aren't any objections, I will commit it this weekend.
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: 9.0 RC1 linking problem with i386 libs on amd64

2011-10-28 Thread Dominic Fandrey
On 28/10/2011 20:19, Dimitry Andric wrote:
 On 2011-10-28 16:41, Dominic Fandrey wrote:
 ...
 ...

 I had hoped that the .ifdef construction from the wiki was dated. I
 suppose it's emulating setting CC in the environment instead of in
 the make/src.conf.
 
 There are two different problems here.  One is that src.conf is read
 relatively late, and only when bsd.own.mk is included.  Therefore,
 src.conf is not the right place to put CC, CXX and so on.

I use buildflags (sysutils/bsdadminscripts), hence all my build
configuration is included from the make.conf.

 The other problem is that the build32 stage uses environment variables
 to override CC, CXX, AS and LD for its sub-make (see LIB32WMAKEENV in
 Makefile.inc1), adding the necessary flags for 32-bit compilation.
 
 However, since environment variables are in turn overridden by direct
 assignments (like via reading make.conf), the 32-bit compilation flags
 get lost when you specify any of CC, CXX, AS or LD in make.conf.
 
 This latter problem is what my patch attempts to fix, while changing as
 little as possible.

An alternative is to pass __MAKE_CONF=/dev/null to the 32-bit stage.
That should also work in the environment, see make.conf(5)
DESCRIPTION§3.

I'm testing it now, just out of curiosity. One would probably have to
add a _WITHOUT_SRCCONF, to be src.conf compatible, too.

--- Makefile.inc1.orig  2011-10-28 22:00:20.0 +0200
+++ Makefile.inc1   2011-10-28 22:00:37.0 +0200
@@ -282,7 +282,8 @@
 LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \
MACHINE_CPU=i686 mmx sse sse2 \
LD=${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32 \
-   AS=${AS} --32
+   AS=${AS} --32 \
+   __MAKE_CONF=/dev/null
 
 .elif ${TARGET_ARCH} == powerpc64
 .if empty(TARGET_CPUTYPE)


 If there aren't any objections, I will commit it this weekend.

Thanks!

-- 
A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail? 
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: 9.0 RC1 linking problem with i386 libs on amd64

2011-10-28 Thread Dimitry Andric

On 2011-10-28 22:15, Dominic Fandrey wrote:
...

This latter problem is what my patch attempts to fix, while changing as
little as possible.


An alternative is to pass __MAKE_CONF=/dev/null to the 32-bit stage.
That should also work in the environment, see make.conf(5)


The problem with this, is that you then skip *all* settings and logic in
make.conf, which might not be what you want...

The only variables that are specifically overridden for the build32
stage are CC, CXX, AS and LD, so those are the only ones whose value
from make.conf needs to be 'ignored' in that stage.
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: 9.0 RC1 linking problem with i386 libs on amd64

2011-10-26 Thread Dimitry Andric

On 2011-10-26 15:32, Dominic Fandrey wrote:

I haven't tried to dig into this. Only unusual properties of the system
are my non-default MAKEOBJDIRPREFIX and the use of ccache.

# uname -a
FreeBSD AryaStark.norad 9.0-RC1 FreeBSD 9.0-RC1 #0: Wed Oct 26 13:46:13 CEST 
2011 root@AryaStark.norad:/usr/obj/GENERIC/amd64/usr/src/sys/GENERIC  amd64

# make -VCC -VCPUTYPE -VCFLAGS
/usr/local/bin/ccache clang
athlon64-sse3
-O2 -pipe -march=athlon64-sse3


How are you setting CC and/or CFLAGS, precisely?  Depending on how you
do it, the settings might not be propagated correctly to the build32
stage.  Also, if you force CFLAGS to have -march=athlon64-sse3, I'm not
sure if the build32 stage can even work correctly.  Just specify
CPUTYPE, that should be enough.

In any case, you can try out the attached patch, which should take care
of passing CC to the build32 stage correctly.

I would really like to have this in head, and even stable/9.  It makes
it possible to just set CC in make.conf, without .ifdef trickery.  Works
nicely for clang, too. :)
Index: Makefile.inc1
===
--- Makefile.inc1	(revision 224934)
+++ Makefile.inc1	(working copy)
@@ -313,7 +313,8 @@
 
 LIB32WMAKE=	${LIB32WMAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \
 		-DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO \
-		-DWITHOUT_HTML -DNO_CTF -DNO_LINT DESTDIR=${LIB32TMP}
+		-DWITHOUT_HTML -DNO_CTF -DNO_LINT -ECC -ECXX -EAS -ELD \
+		DESTDIR=${LIB32TMP}
 LIB32IMAKE=	${LIB32WMAKE:NINSTALL=*:NDESTDIR=*} -DNO_INCS
 .endif
 
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org