Closed travankor closed 5 years ago
I'm working on integrating Ada bootstrapping into the gcc
template for x86_64
and i686
using the https://www.adacore.com/ gnat binaries:
http://mirrors.cdn.adacore.com/art/591c6d80c7a447af2deed1d7>gnat-gpl-2017-x86_64-linux-bin.tar.gz
http://mirrors.cdn.adacore.com/art/564b3e9dc8e196b040fbe248>gnat-gpl-2014-x86-linux-bin.tar.gz
Once this is done and we have a x86_64-unknown-linux-gnu-gcc
which compiles ada source, we can try if and how to also make the cross compilers for *-musl and the other architectures create the cross-xxx-gnat
etc. binaries.
Successfully built gcc-ada
, libada
and libada-devel
for x86_64
and i686
.
Packages can be found at https://repo.voidlinux.de/current in case someone wants to try them.
Now checking whether adding ada to the cross-x86_64-linux-musl template for _gcc_bootstrap()
and _gcc_build()
creates cross gnat*
binaries.
Hmm.. looking at the tests it doesn't seem to make sense to have gcc-ada
not depend on libada-devel
because system.ads
is required when compiling *.adb
files. So perhaps the libada-devel
subpackage is redundant and the files should be contained in gcc-ada
? Can anyone elaborate on this?
Now I got cross-i686-linux-musl
and cross-x86_64-linux-musl
built from a x86_64
environment with gcc-ada-8.2.0_5
and it has the cross-i686-linux-musl-gnat*
files, and the adalib
and adainclude
etc. subdirectories. It is also built with binutils-2.31.1
(pending #2813). The packages are uploaded to my repository.
Next is trying for all the other cross-*
packages. If all succeed, then srcpkgs/gcc/template
needs to be revbumped and modified to detect, if the host's gcc
can also build language ada and, if it does, build ada without the gnatboot
option, just using the host gcc/gnat.
Ok, it seems I have to move the libgnarl-8.so
and libgnat-8.so
files to the cross base usr/lib
directory and create the symlinks libgnarl.so -> libgnarl-8.so
and libgnat.so -> libgnat-8.so
there.
I found this in what Arch package gcc-ada does (see https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/gcc)
The cross-aarch64-linux-gnu
package now works again and I think the others will work as well.
Hmm... it looks as if yet another patch is required for gcc w/ ada on x86_64-musl:
x86_64-linux-musl-gcc -c -O2 -pipe -mtune=generic -I/usr/x86_64-linux-musl/usr/include -gnatpg -gnatwns -W -Wall -nostdinc -I- -I. -Iada/generated -Iada -I/builddir/gcc-8.2.0/gcc/ada -I/builddir/gcc-8.2.0/gcc/ada/gcc-interface -Iada/libgnat -I/builddir/gcc-8.2.0/gcc/ada/libgnat /builddir/gcc-8.2.0/gcc/ada/gnatbind.adb -o ada/gnatbind.o
In file included from /builddir/gcc-8.2.0/gcc/ada/adaint.h:319,
from /builddir/gcc-8.2.0/gcc/ada/exit.c:45:
/usr/x86_64-linux-musl/usr/include/sched.h:76:7: error: attempt to use poisoned "calloc"
void *calloc(size_t, size_t);
^
/usr/x86_64-linux-musl/usr/include/sched.h:116:36: error: attempt to use poisoned "calloc"
#define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n)))
^
x86_64-linux-musl-c++ -fno-PIE -c -O2 -pipe -mtune=generic -I/usr/x86_64-linux-musl/usr/include -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -I. -Iada -I/builddir/gcc-8.2.0/gcc -I/builddir/gcc-8.2.0/gcc/ada -I/builddir/gcc-8.2.0/gcc/../include -I/builddir/gcc-8.2.0/gcc/../libcpp/include -I/builddir/gcc-8.2.0/build/./gmp -I/builddir/gcc-8.2.0/gmp -I/builddir/gcc-8.2.0/build/./mpfr/src -I/builddir/gcc-8.2.0/mpfr/src -I/builddir/gcc-8.2.0/mpc/src -I/builddir/gcc-8.2.0/gcc/../libdecnumber -I/builddir/gcc-8.2.0/gcc/../libdecnumber/bid -I../libdecnumber -I/builddir/gcc-8.2.0/gcc/../libbacktrace -I/builddir/gcc-8.2.0/build/./isl/include -I/builddir/gcc-8.2.0/isl/include -o ada/link.o -MT ada/link.o -MMD -MP -MF ada/.deps/link.TPo /builddir/gcc-8.2.0/gcc/ada/link.c
mkdir -p ada/
x86_64-linux-musl-gcc -c -O2 -pipe -mtune=generic -I/usr/x86_64-linux-musl/usr/include -gnatpg -gnatwns -W -Wall -nostdinc -I- -I. -Iada/generated -Iada -I/builddir/gcc-8.2.0/gcc/ada -I/builddir/gcc-8.2.0/gcc/ada/gcc-interface -Iada/libgnat -I/builddir/gcc-8.2.0/gcc/ada/libgnat /builddir/gcc-8.2.0/gcc/ada/osint-b.adb -o ada/osint-b.o
mkdir -p ada/libgnat/
make[2]: *** [Makefile:1110: ada/exit.o] Error 1
make[2]: *** Waiting for unfinished jobs....
x86_64-linux-musl-gcc -c -O2 -pipe -mtune=generic -I/usr/x86_64-linux-musl/usr/include -gnatpg -gnatwns -W -Wall -nostdinc -I- -I. -Iada/generated -Iada -I/builddir/gcc-8.2.0/gcc/ada -I/builddir/gcc-8.2.0/gcc/ada/gcc-interface -Iada/libgnat -I/builddir/gcc-8.2.0/gcc/ada/libgnat /builddir/gcc-8.2.0/gcc/ada/libgnat/s-resfil.adb -o ada/libgnat/s-resfil.o
rm gcc.pod gfortran.pod
make[2]: Leaving directory '/builddir/gcc-8.2.0/build/gcc'
make[1]: *** [Makefile:4284: all-gcc] Error 2
make[1]: Leaving directory '/builddir/gcc-8.2.0/build'
make: *** [Makefile:915: all] Error 2
=> ERROR: gcc-8.2.0_5: do_build: 'make ${makejobs}' exited with 2
=> ERROR: in do_build() at srcpkgs/gcc/template:287
The problem with this issue is that Musl libc's sched.h
locally defines void *calloc(size_t, size_t);
and thus makes it impossible to replace it with xcalloc()
. Trying to #define calloc xcalloc
also triggers the poisoning error. :-1:
Using a patch from Alpine Linux for gcc-ada improves things, however...
Cross compiling gcc
for x86_64-musl
fails with:
GNATLINK 8.2.0
Copyright (C) 1995-2018, Free Software Foundation, Inc.
x86_64-linux-musl-gcc -c -O2 -Wextra -Wall -mtune=generic -gnatA -gnatWb -gnatiw -I/usr/lib/gcc/x86_64-linux-musl/8.2.0/adalib/../adainclude -I/usr/lib/gcc/x86_64-linux-musl/8.2.0/adalib -I. -I/builddir/gcc-8.2.0/gcc/ada -gnatws /builddir/gcc-8.2.0/build/gcc/ada/tools/b~gnatmake.adb
/builddir/.xbps-gcc/wrappers/x86_64-linux-musl-c++ b~gnatmake.o ../link.o ../targext.o ../../ggc-none.o ./debug.o ./types.o ./alloc.o ./gnatvsn.o ./hostparm.o ./krunch.o ./output.o ./rident.o ./sfn_scan.o ./tree_io.o ./opt.o ./csets.o ./stylesw.o ./table.o ./elists.o ./stand.o ./uintp.o ./urealp.o ./widechar.o ./namet.o ./butil.o ./binderr.o ./casing.o ./err_vars.o ./fmap.o ./osint.o ./targparm.o ./sdefault.o ./fname.o ./ali.o ./osint-m.o ./snames.o ./scans.o ./sinfo.o ./nlists.o ./einfo.o ./aspects.o ./atree.o ./sinput.o ./sem_aux.o ./sinput-c.o ./stringt.o ./erroutc.o ./lib.o ./uname.o ./errout.o ./fname-uf.o ./fname-sf.o ./restrict.o ./styleg.o ./errutil.o ./make_util.o ./scng.o ./ali-util.o ./switch.o ./switch-m.o ./tempdir.o ./usage.o ./makeusg.o ./make.o ./gnatmake.o ../../libcommon-target.a ../../libcommon.a ../../../libcpp/libcpp.a ../../../libbacktrace/.libs/libbacktrace.a ../../../libiberty/libiberty.a -no-pie -o ../../gnatmake -L./ -L/usr/lib/gcc/x86_64-linux-musl/8.2.0/adalib/../adainclude/ -L/usr/lib/gcc/x86_64-linux-musl/8.2.0/adalib/ -L./ -L/builddir/gcc-8.2.0/gcc/ada/ /usr/lib/gcc/x86_64-linux-musl/8.2.0/adalib/libgnat.a -ldl -static-libstdc++ -static-libgcc -static-libstdc++ -static-libgcc -Wl,--as-needed -L/usr/x86_64-linux-musl/usr/lib
/usr/lib/gcc/x86_64-linux-musl/8.2.0/../../../../x86_64-linux-musl/bin/ld: /usr/lib/gcc/x86_64-linux-musl/8.2.0/adalib/libgnat.a(s-trasym.o): in function `system__traceback__symbolic__module_name__build_cache_for_all_modulesXnn':
(.text+0x7a8): undefined reference to `_r_debug'
collect2: error: ld returned 1 exit status
x86_64-linux-musl-gnatlink: error when calling /builddir/.xbps-gcc/wrappers/x86_64-linux-musl-c++
make[3]: *** [../gcc-interface/Makefile:2251: gnatmake-re] Error 4
make[3]: Leaving directory '/builddir/gcc-8.2.0/build/gcc/ada/tools'
make[2]: *** [Makefile:210: gnattools-cross] Error 2
make[2]: Leaving directory '/builddir/gcc-8.2.0/build/gnattools'
make[1]: *** [Makefile:10774: all-gnattools] Error 2
make[1]: Leaving directory '/builddir/gcc-8.2.0/build'
make: *** [Makefile:915: all] Error 2
=> ERROR: gcc-8.2.0_5: do_build: 'make ${makejobs}' exited with 2
=> ERROR: in do_build() at srcpkgs/gcc/template:288
Even though it seems I'm the only one trying and fixing, ideas are very welcome.
All cross builds work now. Pending issue: cross build gcc for x86_64-musl from x86_64.
GNAT - GNAT is a free, high-quality, complete compiler for Ada95, integrated into the GCC compiler system. -> https://www.gnu.org/software/gnat/
continuation of https://github.com/voidlinux/void-packages/issues/4703