Opened 10 months ago

Closed 10 months ago

Last modified 10 months ago

#14764 closed bug (invalid)

gcc2 cross compiler doesn't build on ubuntu 18.04 x86_64

Reported by: korli Owned by: waddlesplash
Priority: normal Milestone: Unscheduled
Component: Build System Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.1 LTS"
gcc --version
gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
/home/korli/githaiku/haiku/generated_gcc2$ ../configure --build-cross-tools x86_gcc2 /home/korli/githaiku/buildtools
../configure: could not find setfattr, assuming host has no extended attributes
Configuring for a x86_64-unknown-linux-gnu host.
Copying /home/korli/githaiku/haiku/generated_gcc2/cross-tools-x86_gcc2-build/syslibs to /home/korli/githaiku/haiku/generated_gcc2/cross-tools-x86_gcc2/i586-pc-haiku/lib
Copying /home/korli/githaiku/haiku/generated_gcc2/cross-tools-x86_gcc2-build/sysincludes to /home/korli/githaiku/haiku/generated_gcc2/cross-tools-x86_gcc2/i586-pc-haiku/sys-include
Created "Makefile" in /home/korli/githaiku/haiku/generated_gcc2/cross-tools-x86_gcc2-build/gcc using "mt-frag"
/usr/bin/ld: cannot find Scrt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/7/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/7/libgcc_s.so.1 when searching for libgcc_s.so.1
/usr/bin/ld: cannot find libgcc_s.so.1
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/7/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
collect2: error: ld returned 1 exit status
*** The command 'gcc -m32 -o conftest -O2 -U_FORTIFY_SOURCE   conftest.c' failed.
*** You must set the environment variable CC to a working compiler.

workaround:

diff --git a/build/scripts/build_cross_tools b/build/scripts/build_cross_tools
index eed12fea24..9d58717195 100755
--- a/build/scripts/build_cross_tools
+++ b/build/scripts/build_cross_tools
@@ -152,7 +152,7 @@ copy_headers $haikuSourceDir/headers/posix $tmpIncludeDir/posix
 # configure gcc
 cd $gccObjDir
 # GCC 2 compiled for x86_64 on most systems is broken, compile for 32-bit.
-export CC="gcc -m32"
+#export CC="gcc -m32"
 CFLAGS="-O2 -U_FORTIFY_SOURCE" CXXFLAGS="-O2" $buildToolsDir/gcc/configure \
        --prefix=$installDir $buildHostSpec --target=i586-pc-haiku \
        --disable-nls --enable-shared=yes --enable-languages=c,c++ \

Change History (2)

comment:1 by waddlesplash, 10 months ago

Resolution: invalid
Status: assignedclosed

As the comment says, GCC2 compiled for x86_64 is broken on most systems, including Ubuntu (it errors out with the "cast specifies signature type" when built that way.)

The errors are because you didn't install the libc32-devel package on Ubuntu. I think the readme already tells you to have a 32-bit compiler, yes? So thkis is invalid.

comment:2 by korli, 10 months ago

Thanks for the explanation. I don't see which readme you're referring to. At least the issue is here for anyone searching for it.

Note: See TracTickets for help on using tickets.