Re: Relocatable linking with relocations from format elf64-x86-64-freebsd (crt1_s.o) to format elf32-i386-freebsd (gcrt1.o) is not supported
On Sun Aug 21 11, Dimitry Andric wrote: On 2011-08-19 10:01, Alexander Best wrote: On Thu Aug 18 11, Dimitry Andric wrote: ... Please use the following fragment instead, which is recommended on http://wiki.freebsd.org/BuildingFreeBSDWithClang: thanks. that fixed the issue. seeing forward to simply setting CC/CXX/CPP to clang or gcc directly and also to using /, so one can use absolute paths. Please try the attached patch, which makes it possible to set CC and CXX in make.conf, while allowing the build32 stage to still override them. Explanation: 1) The build32 stage sets environment variables CC, CXX, AS and LD for its sub-make, to add 32-bit specific flags (-m32 and such). 2) The sub-make reads sys.mk, encounters CC?= and CXX?= assignments, so does not alter them. 3) After some other stuff, sys.mk reads /etc/make.conf. When you have CC=xxx and CXX=yyy statements in there, they will *override* the build32-supplied CC/CXX values, nullifying the 32-bit specific flags. 4) Thus all objects get built as 64-bit anyway, and since LD is usually not set in make.conf, it still has the 32-bit flags! 5) Now, whenever something is linked, you will get a ld: Relocatable linking with relocations from format elf64-x86-64-freebsd (foo.o) to format elf32-i386-freebsd (bar.o) is not supported error. The patch fixes this by adding -ECC -ECXX -EAS -ELD to the build32 sub-make invocation, which forces those environment variables to always override any assignment in makefiles. It makes it possible to simply do: CC=clang CXX=clang++ in your make.conf, or specify a path, even: CC=/usr/local/bin/gcc46 CXX=/usr/local/bin/g++46 Note this was already possible on i386, but not yet on amd64. Also, strange things might happen if you set CC but not CXX, or vice versa... any chance this patch can be committed? cheers. alex 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-toolchain@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain To unsubscribe, send any mail to freebsd-toolchain-unsubscr...@freebsd.org
Re: Relocatable linking with relocations from format elf64-x86-64-freebsd (crt1_s.o) to format elf32-i386-freebsd (gcrt1.o) is not supported
On 2011-08-23 11:23, Alexander Best wrote: ... The patch fixes this by adding -ECC -ECXX -EAS -ELD to the build32 sub-make invocation, which forces those environment variables to always override any assignment in makefiles. It makes it possible to simply do: CC=clang CXX=clang++ in your make.conf, or specify a path, even: CC=/usr/local/bin/gcc46 CXX=/usr/local/bin/g++46 Note this was already possible on i386, but not yet on amd64. Also, strange things might happen if you set CC but not CXX, or vice versa... any chance this patch can be committed? I hope so, but it needs to be reviewed by one or more senior build gurus, before it makes a chance (if any) to get into 9.0-R. It's really just a band-aid now. Obviously, the whole way Makefile.inc1 sets up CC to run the build32 stage should be overhauled, and as Warner said, we really need a (SYSTEM|WORLD|PORTS)_COMPILER global switch (instead of manually setting CC), but that kind of restructuring must be done after the tree is unfrozen, not now. ___ freebsd-toolchain@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain To unsubscribe, send any mail to freebsd-toolchain-unsubscr...@freebsd.org
Re: Relocatable linking with relocations from format elf64-x86-64-freebsd (crt1_s.o) to format elf32-i386-freebsd (gcrt1.o) is not supported
On Thu Aug 18 11, Dimitry Andric wrote: On 2011-08-18 19:35, Alexander Best wrote: ... ld: Relocatable linking with relocations from format elf64-x86-64-freebsd (crt1_s.o) to format elf32-i386-freebsd (gcrt1.o) is not supported Most likely, this is because you are forcing CC=clang, which does not work as expected. Can you please post your /etc/make.conf and /etc/src.conf files, and show us any environment variables related to buildworld? Also, how exactly are you running make buildworld? i've attached my src.conf, my make.conf and the output of 'env'. nothing special, i'm using a simple 'make buildworld'. The problem is in your make.conf. Effectively, you are doing: CC = clang CXX = clang++ which will not work, at least not for the 32-bit compat stage on amd64. Please use the following fragment instead, which is recommended on http://wiki.freebsd.org/BuildingFreeBSDWithClang: .if !defined(CC) || ${CC} == cc CC=clang .endif .if !defined(CXX) || ${CXX} == c++ CXX=clang++ .endif .if !defined(CPP) || ${CPP} == cpp CPP=clang -E .endif thanks. that fixed the issue. seeing forward to simply setting CC/CXX/CPP to clang or gcc directly and also to using /, so one can use absolute paths. cheers. alex ___ freebsd-toolchain@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain To unsubscribe, send any mail to freebsd-toolchain-unsubscr...@freebsd.org
Re: Relocatable linking with relocations from format elf64-x86-64-freebsd (crt1_s.o) to format elf32-i386-freebsd (gcrt1.o) is not supported
On 2011-08-18 07:01, Alexander Best wrote: i'm getting this error, when trying to make target buildwork with clang. You mean with make target buildwork, that you are running make buildworld TARGET=whatever, right? ... this is the error i'm getting: === lib/csu/i386-elf (obj,depend,all,install) ... clang -O2 -pipe -fno-strict-aliasing -fno-omit-frame-pointer -frename-registers -I/usr/git-freebsd-head/lib/csu/i386-elf/../common -I/usr/git-freebsd-head/lib/csu/i386-elf/../../libc/include -DSTRIP_FBSDID -std=gnu99 -Wsystem-headers -Wall -Wno-format-y2k -Wextra -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -c /usr/git-freebsd-head/lib/csu/i386-elf/crt1_s.S clang: warning: argument unused during compilation: '-frename-registers' ld -m elf_i386_fbsd -Y P,/usr/obj/usr/git-freebsd-head/lib32/usr/lib32 -o gcrt1.o -r crt1_s.o gcrt1_c.o ld: Relocatable linking with relocations from format elf64-x86-64-freebsd (crt1_s.o) to format elf32-i386-freebsd (gcrt1.o) is not supported Most likely, this is because you are forcing CC=clang, which does not work as expected. Can you please post your /etc/make.conf and /etc/src.conf files, and show us any environment variables related to buildworld? Also, how exactly are you running make buildworld? ___ freebsd-toolchain@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain To unsubscribe, send any mail to freebsd-toolchain-unsubscr...@freebsd.org
Re: Relocatable linking with relocations from format elf64-x86-64-freebsd (crt1_s.o) to format elf32-i386-freebsd (gcrt1.o) is not supported
On Thu Aug 18 11, Dimitry Andric wrote: On 2011-08-18 07:01, Alexander Best wrote: i'm getting this error, when trying to make target buildwork with clang. You mean with make target buildwork, that you are running make buildworld TARGET=whatever, right? ... this is the error i'm getting: === lib/csu/i386-elf (obj,depend,all,install) ... clang -O2 -pipe -fno-strict-aliasing -fno-omit-frame-pointer -frename-registers -I/usr/git-freebsd-head/lib/csu/i386-elf/../common -I/usr/git-freebsd-head/lib/csu/i386-elf/../../libc/include -DSTRIP_FBSDID -std=gnu99 -Wsystem-headers -Wall -Wno-format-y2k -Wextra -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -c /usr/git-freebsd-head/lib/csu/i386-elf/crt1_s.S clang: warning: argument unused during compilation: '-frename-registers' ld -m elf_i386_fbsd -Y P,/usr/obj/usr/git-freebsd-head/lib32/usr/lib32 -o gcrt1.o -r crt1_s.o gcrt1_c.o ld: Relocatable linking with relocations from format elf64-x86-64-freebsd (crt1_s.o) to format elf32-i386-freebsd (gcrt1.o) is not supported Most likely, this is because you are forcing CC=clang, which does not work as expected. Can you please post your /etc/make.conf and /etc/src.conf files, and show us any environment variables related to buildworld? Also, how exactly are you running make buildworld? i've attached my src.conf, my make.conf and the output of 'env'. nothing special, i'm using a simple 'make buildworld'. i'm now trying to reproduce the issue with a fresh src snapshot cheers. alex # WORLD/KERNEL options KERNCONF = ARUNDEL #KERNCONF = GENERIC #MODULES_OVERRIDE = \ #netgraph/netgraph netgraph/socket netgraph/bluetooth/bluetooth \ #netgraph/bluetooth/hci netgraph/bluetooth/l2cap netgraph/bluetooth/socket \ #netgraph/bluetooth/ubt tmpfs sound/sound sound/driver/hda usb/uhid \ #procfs pseudofs linux linprocfs linsysfs lindev usb/quirk geom \ #MODULES_OVERRIDE = MODULES_WITH_WORLD = yes #opensolaris dtrace cyclic nfsclient krpc nfs_common nfslock usb/quirk geom #CC = /usr/local/bin/clang# -B/usr/bin CC = clang #CC = /usr/bin/clang #CC= /usr/local/bin/pcc #CXX = /usr/local/bin/clang++# -B/usr/bin CXX = clang++ #CC=/usr/bin/cc #CXX=/usr/bin/c++ #CPP=/usr/bin/cpp # compiler flags CPUTYPE ?= core2 #COPTFLAGS = -O2 -pipe -fno-builtin -frename-registers -fno-strict-aliasing #COPTFLAGS = -O3 -pipe -fno-inline-functions# -frename-registers# -fno-builtin -fno-strict-aliasing CFLAGS = -O2 -pipe -fno-strict-aliasing -fno-omit-frame-pointer -frename-registers# -fno-builtin #CFLAGS = -O3 -pipe -fno-inline-functions -fno-omit-frame-pointer -fno-strict-aliasing -fno-builtin -frename-registers # SENDMAIL options SENDMAIL_MC = /etc/mail/freebsd.mc SENDMAIL_SUBMIT_MC = /etc/mail/freebsd.submit.mc # PORTS options OVERRIDE_LINUX_BASE_PORT = f10 OVERRIDE_LINUX_NONBASE_PORTS = f10 DA4 = yes WITH_BSDEL = yes WITH_256_COLOR = yes WITH_LCD_FILTERING = yes GENTOO_OPTIMIZED = i686 # added by use.perl 2011-08-15 19:48:33 PERL_VERSION=5.12.4 # Don't die on warnings NO_WERROR= WERROR= # Don't forget this when using Jails! #NO_FSCHG= #CWARNFLAGS?= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes\ # -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual\ # -Wundef -Wmissing-include-dirs # Enable debugging symbols for world CFLAGS += -DSTRIP_FBSDID BURN_BRIDGES=yes # BUILDWORLD options BOOT2_UFS=UFS2_ONLY # don't need UFS1 support anymore GPTBOOT_UFS=UFS2_ONLY # don't need UFS1 support anymore WITHOUT_ACCT=true #WITHOUT_ACPI=true # needed by VirtualBox WITHOUT_AMD=true WITHOUT_APM=true #WITHOUT_ASSERT_DEBUG=true # broken WITHOUT_AT=true WITHOUT_ATM=true WITHOUT_AUDIT=true WITHOUT_BIND=true WITHOUT_GPIO=true WITH_BSD_GREP=true WITHOUT_BSNMP=true WITHOUT_CALENDAR=true #WITHOUT_CDDL=true # needed for dtrace WITHOUT_CTM=true WITHOUT_CVS=true WITHOUT_FLOPPY=true #WITHOUT_FORTH=true # needed for bootloader WITHOUT_FREEBSD_UPDATE=true WITHOUT_GAMES=true #WITHOUT_GNU=true # no effect WITHOUT_GPIB=true #WITHOUT_GSSAPI=true# needed for md2() WITHOUT_HTML=true WITH_IDEA=true WITHOUT_INET6=true #WITHOUT_INFO=true # needed by ports (`install-info`) #WITHOUT_INSTALLLIB=yes # DON'T USE WITHOUT_IPFILTER=true WITHOUT_IPFW=true WITHOUT_IPX=true WITHOUT_JAIL=true WITHOUT_KERBEROS=true # possible? WITHOUT_KERBEROS_SUPPORT=true WITHOUT_LPR=true WITHOUT_NDIS=true WITHOUT_NETCAT=true WITHOUT_NIS=true WITHOUT_NLS=true WITHOUT_NLS_CATALOGS=true WITHOUT_NS_CACHING=true WITHOUT_PAM_SUPPORT=true WITHOUT_PF=true WITHOUT_PMC=true WITHOUT_PPP=true WITHOUT_PROFILE=true# for using gprof(1) WITHOUT_QUOTAS=true WITHOUT_RCMDS=true
Re: Relocatable linking with relocations from format elf64-x86-64-freebsd (crt1_s.o) to format elf32-i386-freebsd (gcrt1.o) is not supported
On 2011-08-18 19:35, Alexander Best wrote: ... ld: Relocatable linking with relocations from format elf64-x86-64-freebsd (crt1_s.o) to format elf32-i386-freebsd (gcrt1.o) is not supported Most likely, this is because you are forcing CC=clang, which does not work as expected. Can you please post your /etc/make.conf and /etc/src.conf files, and show us any environment variables related to buildworld? Also, how exactly are you running make buildworld? i've attached my src.conf, my make.conf and the output of 'env'. nothing special, i'm using a simple 'make buildworld'. The problem is in your make.conf. Effectively, you are doing: CC = clang CXX = clang++ which will not work, at least not for the 32-bit compat stage on amd64. Please use the following fragment instead, which is recommended on http://wiki.freebsd.org/BuildingFreeBSDWithClang: .if !defined(CC) || ${CC} == cc CC=clang .endif .if !defined(CXX) || ${CXX} == c++ CXX=clang++ .endif .if !defined(CPP) || ${CPP} == cpp CPP=clang -E .endif ___ freebsd-toolchain@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain To unsubscribe, send any mail to freebsd-toolchain-unsubscr...@freebsd.org
Re: Relocatable linking with relocations from format elf64-x86-64-freebsd (crt1_s.o) to format elf32-i386-freebsd (gcrt1.o) is not supported
We really need a 'SYSTEM_COMPILER={gcc,clang,xxx}' sort of knob. Warner On Aug 18, 2011, at 2:04 PM, Kostik Belousov wrote: On Thu, Aug 18, 2011 at 09:54:41PM +0200, Dimitry Andric wrote: The problem is in your make.conf. Effectively, you are doing: CC = clang CXX = clang++ which will not work, at least not for the 32-bit compat stage on amd64. Please use the following fragment instead, which is recommended on http://wiki.freebsd.org/BuildingFreeBSDWithClang: .if !defined(CC) || ${CC} == cc CC=clang .endif .if !defined(CXX) || ${CXX} == c++ CXX=clang++ .endif .if !defined(CPP) || ${CPP} == cpp CPP=clang -E .endif May be, add the commented out lines into share/examples/etc/make.conf ? ___ freebsd-toolchain@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain To unsubscribe, send any mail to freebsd-toolchain-unsubscr...@freebsd.org