D.gnu - cross-GDC for tiny embedded Linux
- Dmitry Ponyatov (36/36) Oct 21 2023 I'm trying to build a tiny Linux system with cross-compiling GDB:
- Dmitry Ponyatov (6/6) Oct 21 2023 ```sh
- Iain Buclaw (3/9) Oct 22 2023 You'll need at least gcc-9/gdc-9 to build gcc-13.
- Dmitry Ponyatov (30/31) Oct 22 2023 Version problem was fixed by building `gcc-12.3.0` with `gdc`
- Dmitry Ponyatov (67/67) Oct 22 2023 Here the next problem of building `gcc-12.3.0` with
- Dmitry Ponyatov (11/13) Oct 22 2023 fixed by moving to `musl` usage -- not a surprise that `uClibc`
- Imperatorn (3/9) Oct 22 2023 How/where are you referencing mmap64? Could some include be
- Dmitry Ponyatov (4/6) Oct 25 2023 ref/gcc-12.3.0/libphobos/libdruntime/core/internal/gc/os.d:145
- Imperatorn (3/9) Oct 30 2023 Did you solve it?
- Dmitry Ponyatov (2/3) Nov 25 2023 No, project delayed until I'll have enough deep qualification in
I'm trying to build a tiny Linux system with cross-compiling GDB: https://github.com/ponyatov/player/blob/shadow/Makefile ``` BINUTILS_VER = 2.41 GCC_VER = 13.2.0 ``` ```sh cat /etc/os-release ``` ``` PRETTY_NAME="Debian GNU/Linux 10 (buster)" NAME="Debian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/" ``` ```sh gdb --version ``` ``` GNU gdb (Debian 8.2.1-2+b3) 8.2.1 ``` I've got this error: ``` /home/ponyatov/player/ref/gcc-13.2.0/gcc/d/dmd/root/file.d: In function ‘read’: /home/ponyatov/player/ref/gcc-13.2.0/gcc/d/dmd/root/file.d:81:5: error: exception handling disabled, use -fexceptions to enable ``` It looks like my local host `gdb` has too old version. Or maybe is there some another problem in `dmd` frontend on the modern `gcc13` distro?
Oct 21 2023
```sh gdc --version ``` ``` gdc (Debian 8.3.0-6) 8.3.0 ```
Oct 21 2023
On Saturday, 21 October 2023 at 23:13:57 UTC, Dmitry Ponyatov wrote:```sh gdc --version ``` ``` gdc (Debian 8.3.0-6) 8.3.0 ```You'll need at least gcc-9/gdc-9 to build gcc-13.
Oct 22 2023
You'll need at least gcc-9/gdc-9 to build gcc-13.Version problem was fixed by building `gcc-12.3.0` with `gdc` enabled on local host, and using it for the whole build in place of system-provided `gcc` toolchain. ```Makefile GCC_VER = 12.3.0 ``` ```Makefile GDCH = /usr/local/bin/gdc-12 CCH = /usr/local/bin/gcc-12 CXXH = /usr/local/bin/g++-12 ``` ```Makefile GCC_HOST = GDC=$(GDCH) CC=$(CCH) CXX=$(CXXH) ``` ```Makefile CFG_GCCH = --prefix=/usr/local $(WITH_GCCLIBS) --enable-languages="c,c++,d" \ --program-suffix="-12" $(OPT_HOST) \ $(GCC_DISABLE) $(GCC_ENABLE) ``` ```Makefile CFG_GCC1 = $(CFG_BINUTILS1) $(WITH_GCCLIBS) --enable-languages="c,c++,d" \ --with-headers=$(ROOT)/usr/include $(GCC_HOST) \ $(GCC_DISABLE) $(GCC_ENABLE) ```
Oct 22 2023
Here the next problem of building `gcc-12.3.0` with `uClibc-ng-1.0.44` (i386 target): ``` libtool: compile: /home/ponyatov/player/tmp/gcc-12.3.0-1/./gcc/gdc -B/home/ponyatov/player/tmp/gcc-12.3.0-1/./gcc/ -B/home/ponyatov/player/host/i686-linux-uclibc/bin/ -B/home/ponyatov/player/host/i686-linux-uclibc/lib/ -isystem /home/ponyatov/player/host/i686-linux-uclibc/include -isystem /home/ponyatov/player/host/i686-linux-uclibc/sys-include -Wall -frelease -ffunction-sections -fdata-sections -O2 -g -fpreview=dip1000 -fpreview=fieldwise -fpreview=dtorfields -nostdinc -I /home/ponyatov/player/ref/gcc-12.3.0/libphobos/libdruntime -I . -c /home/ponyatov/player/ref/gcc-12.3.0/libphobos/libdruntime/core/exception.d -o core/exception.o /home/ponyatov/player/ref/gcc-12.3.0/libphobos/libdruntime/core/sys/posix/ ys/types.d:1227:40: error: undefined identifier '__SIZEOF_PTHREAD_MUTEX_T' 1227 | byte[__SIZEOF_PTHREAD_MUTEX_T] __size; | ^ /home/ponyatov/player/ref/gcc-12.3.0/libphobos/libdruntime/core/sys/posix/ ys/types.d:1175:39: error: undefined identifier '__SIZEOF_PTHREAD_ATTR_T' 1175 | byte[__SIZEOF_PTHREAD_ATTR_T] __size; | ^ /home/ponyatov/player/ref/gcc-12.3.0/libphobos/libdruntime/core/sys/posix/ ys/types.d:1192:39: error: undefined identifier '__SIZEOF_PTHREAD_COND_T' 1192 | byte[__SIZEOF_PTHREAD_COND_T] __size; | ^ /home/ponyatov/player/ref/gcc-12.3.0/libphobos/libdruntime/core/sys/posix/ ys/types.d:1198:43: error: undefined identifier '__SIZEOF_PTHREAD_CONDATTR_T' 1198 | byte[__SIZEOF_PTHREAD_CONDATTR_T] __size; | ^ /home/ponyatov/player/ref/gcc-12.3.0/libphobos/libdruntime/core/sys/posix/ ys/types.d:1233:44: error: undefined identifier '__SIZEOF_PTHREAD_MUTEXATTR_T' 1233 | byte[__SIZEOF_PTHREAD_MUTEXATTR_T] __size; | ^ /home/ponyatov/player/ref/gcc-12.3.0/libphobos/libdruntime/core/sys/posix/ ys/types.d:1265:41: error: undefined identifier '__SIZEOF_PTHREAD_RWLOCK_T' 1265 | byte[__SIZEOF_PTHREAD_RWLOCK_T] __size; | ^ /home/ponyatov/player/ref/gcc-12.3.0/libphobos/libdruntime/core/sys/posix/ ys/types.d:1271:45: error: undefined identifier '__SIZEOF_PTHREAD_RWLOCKATTR_T' 1271 | byte[__SIZEOF_PTHREAD_RWLOCKATTR_T] __size; | ^ /home/ponyatov/player/ref/gcc-12.3.0/libphobos/libdruntime/core/sys/posix/ ys/types.d:1375:42: error: undefined identifier '__SIZEOF_PTHREAD_BARRIER_T' 1375 | byte[__SIZEOF_PTHREAD_BARRIER_T] __size; | ^ /home/ponyatov/player/ref/gcc-12.3.0/libphobos/libdruntime/core/sys/posix/ ys/types.d:1381:46: error: undefined identifier '__SIZEOF_PTHREAD_BARRIERATTR_T' 1381 | byte[__SIZEOF_PTHREAD_BARRIERATTR_T] __size; | ^ /home/ponyatov/player/ref/gcc-12.3.0/libphobos/libdruntime/core/internal/arr y/capacity.d:64:37: error: template instance 'core.internal.array.utils._d_HookTraceImpl!(char[], _d_arraysetlengthT, "Cannot resize arrays if compiling without support for runtime type information!")' error instantiating 64 | alias _d_arraysetlengthTTrace = _d_HookTraceImpl!(Tarr, _d_arraysetlengthT, errorMessage); | ^ /home/ponyatov/player/ref/gcc-12.3.0/libphobos/libdruntime/cor /demangle.d:226:17: note: instantiated from here: '_d_arraysetlengthTImpl!(char[], char)' 226 | dst.length = minBufSize; | ^ /home/ponyatov/player/ref/gcc-12.3.0/libphobos/libdruntime/core demangle.d:2111:14: note: instantiated from here: 'Demangle!(NoHooks)' 2111 | auto d = Demangle!()(buf, dst); | ^ /home/ponyatov/player/ref/gcc-12.3.0/libphobos/libdruntime/core demangle.d:2087:16: error: template instance 'core.demangle.Demangle!(PrependHooks).Demangle.doDemangle!(parseMangledName)' error instantiating 2087 | return doDemangle!parseMangledName(); | ^ /home/ponyatov/player/ref/gcc-12.3.0/libphobos/libdruntime/core demangle.d:2172:26: note: instantiated from here: 'Demangle!(PrependHooks)' 2172 | alias Remangle = Demangle!(PrependHooks); | ^ /home/ponyatov/player/ref/gcc-12.3.0/libphobos/libdruntime/core demangle.d:2156:16: error: template instance 'object.RTInfo!(Replacement)' error instantiating 2156 | static struct Replacement | ^ make[4]: *** [Makefile:2477: core/demangle.lo] Ошибка 1 make[4]: *** Ожидание завершения заданий… make[4]: выход из каталога «/home/ponyatov/player/tmp/gcc-12.3.0-1/i686-linux-uclibc/libphobos/libdruntime» ```
Oct 22 2023
Here the next problem of building `gcc-12.3.0` with `uClibc-ng-1.0.44` (i386 target):fixed by moving to `musl` usage -- not a surprise that `uClibc` becomes obsoleted libc comparing their compilation time, configuration complexity, and incompatibility with modern toolchains But the next linking error, what is going to be? ``` /home/ponyatov/player/host/lib/gcc/i686-linux-musl/12.3.0/../../../../i68 -linux-musl/bin/ld: /home/ponyatov/player/host/lib/gcc/i686-linux-musl/12.3.0/../../../../i686-linux-musl/lib libgphobos.a(os.o): in function `_D4core8internal2gc2os10os_mem_mapFNbNikbZPv': /home/ponyatov/player/ref/gcc-12.3.0/libphobos/libdruntime/core/internal/gc/os.d:145:(.text._D4core8internal2gc2os10os_mem_ apFNbNikbZPv+0x22): undefined reference to `mmap64' /home/ponyatov/player/host/lib/gcc/i686-linux-musl/12.3.0/../../../../i68 -linux-musl/bin/ld: /home/ponyatov/player/host/lib/gcc/i686-linux-musl/12.3.0/../../../../i686-linux-musl/lib/libgphobos.a(fiber.o):/home/ponyatov/player/ref/gcc-12.3.0/libphobos/libdruntime/core/ hread/fiber.d:1050: more undefined references to `mmap64' follow collect2: error: ld returned 1 exit status ```
Oct 22 2023
On Sunday, 22 October 2023 at 21:52:18 UTC, Dmitry Ponyatov wrote:How/where are you referencing mmap64? Could some include be missing or path issue?[...]fixed by moving to `musl` usage -- not a surprise that `uClibc` becomes obsoleted libc comparing their compilation time, configuration complexity, and incompatibility with modern toolchains [...]
Oct 22 2023
How/where are you referencing mmap64? Could some include be missing or path issue?ref/gcc-12.3.0/libphobos/libdruntime/core/internal/gc/os.d:145 ref/gcc-12.3.0/libphobos/libdruntime/core/thread/fiber.d:1050 host/lib/gcc/i686-linux-musl/12.3.0/../../../../i686-linux-musl/lib/libgphobos.a(os.o) etc
Oct 25 2023
On Wednesday, 25 October 2023 at 17:11:11 UTC, Dmitry Ponyatov wrote:Did you solve it?How/where are you referencing mmap64? Could some include be missing or path issue?ref/gcc-12.3.0/libphobos/libdruntime/core/internal/gc/os.d:145 ref/gcc-12.3.0/libphobos/libdruntime/core/thread/fiber.d:1050 host/lib/gcc/i686-linux-musl/12.3.0/../../../../i686-linux-musl/lib/libgphobos.a(os.o) etc
Oct 30 2023
Did you solve it?No, project delayed until I'll have enough deep qualification in system-level D coding
Nov 25 2023