digitalmars.D.ldc - build runtime for embedded Linux (cross)
- Dmitry Ponyatov (39/39) Oct 27 2023 What's can be wrong with `i686-linux-musl` cross target for
- Dmitry Ponyatov (58/60) Oct 27 2023 fixed with
- kinke (5/8) Oct 28 2023 The .conf seems fine. On musl, druntime depends on libunwind
What's can be wrong with `i686-linux-musl` cross target for
`ldc-build-runtime` ?
```sh
ponyatov debian:~/player$ rm -rf tmp/ldc_i686-linux-musl ;
CORES=1 make ldc
```
```
PATH=/home/ponyatov/player/host/bin:/opt/ldc2-1.32.0-linux-x86_64/bin:/home/ponyatov/.cargo/bin:/home/ponyatov/.npm/bin:/home/ponyatov/.opam/default/bin:/home/ponyatov/.nimble/bin:/home/ponyatov/Arduino/arduino-ide_2.2.1_Linux_64bit/resources/app/lib/backend/resources:/home/ponyatov/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin:/home/ponyatov/Arduino/arduino-ide_2.2.1_Linux_64bit:/usr/lib/jvm/java-11-openjdk-amd64/bin:/home/ponyatov/.cache/rebar3/bin:/home/ponyatov/bin:/home/ponyatov/.local/bin:/usr/local/bin:/usr
bin:/bin:/usr/games CC=i686-linux-musl-gcc CXX=i686-linux-musl-g++
/opt/ldc2-1.32.0-linux-x86_64/bin/ldc-build-runtime -j1 --ldc
/opt/ldc2-1.32.0-linux-x86_64/bin/ldc2 \
--buildDir /home/ponyatov/player/tmp/ldc_i686-linux-musl
--ldcSrcDir /home/ponyatov/player/tmp/ldc-1.32.0-src \
--targetSystem i686-linux-musl BUILD_SHARED_LIBS=ON \
--dFlags="-mtriple=i686-linux-musl;-mcpu=i686"
```
```
.: Creating build directory:
/home/ponyatov/player/tmp/ldc_i686-linux-musl
.: Invoking: cmake
-DLDC_EXE_FULL=/opt/ldc2-1.32.0-linux-x86_64/bin/ldc2
-DDMDFE_MINOR_VERSION=102 -DDMDFE_PATCH_VERSION=2
-DTARGET_SYSTEM=i686-linux-musl
'-DD_EXTRA_FLAGS=-mtriple=i686-linux-musl;-mcpu=i686'
-DBUILD_SHARED_LIBS=ON
/home/ponyatov/player/tmp/ldc-1.32.0-src/runtime
-- The C compiler identification is GNU 12.3.0
-- Check for working C compiler:
/home/ponyatov/player/host/bin/i686-linux-musl-gcc
-- Check for working C compiler:
/home/ponyatov/player/host/bin/i686-linux-musl-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
```
```
CMake Error at CMakeLists.txt:111 (message):
Shared libraries (BUILD_SHARED_LIBS) are only supported on
Windows, Linux,
macOS, FreeBSD and DragonFly for the time being.
```
Oct 27 2023
Shared libraries (BUILD_SHARED_LIBS) are only supported on Windows, Linux,fixed with ``` --targetSystem='Linux;UNIX' CMAKE_SYSTEM_NAME=Linux BUILD_SHARED_LIBS=ON \ ``` Now have some problems with right `ldc2.conf`: ```Makefile .PHONY: hello hello: $(ROOT)/bin/hello $(ROOT)/bin/hello: hello/hello.d ldc2.conf $(XPATH) ldc2 -mtriple $(TARGET) -of=$ $< && file $ ``` project-local: `~/player/ldc2.conf` ``` "i686-.+-linux-musl": { switches = [ "-mcpu=i686", "-I%%ldcbinarypath%%/../import", "-gcc=i686-linux-musl-gcc" ]; lib-dirs = [ "/home/ponyatov/player/root/lib" ]; } ``` ``` ldc2 -mtriple i686-linux-musl -of=/home/ponyatov/player/root/bin/hello hello/hello.d && file /home/ponyatov/player/root/bin/hello ``` ``` /home/ponyatov/player/host/lib/gcc/i686-linux-musl/12.3.0/../../../../i68 -linux-musl/bin/ld: cannot find -lunwind: No such file or directory collect2: error: ld returned 1 exit status ``` ```sh ponyatov debian:~/player$ ls root/lib/ ``` ``` crt1.o libcrypt.a libdruntime-ldc-shared.so libphobos2-ldc-debug-shared.so.102.2 librt.a crti.o libc.so libdruntime-ldc-shared.so.102 libphobos2-ldc-shared.so libutil.a crtn.o libdl.a libdruntime-ldc-shared.so.102.2 libphobos2-ldc-shared.so.102 libxnet.a ldc_rt.dso.o libdruntime-ldc-debug-shared.so libm.a libphobos2-ldc-shared.so.102.2 modules ld-musl-i386.so.1 libdruntime-ldc-debug-shared.so.102 libphobos2-ldc-debug-shared.so libpthread.a rcrt1.o libc.a libdruntime-ldc-debug-shared.so.102.2 libphobos2-ldc-debug-shared.so.102 libresolv.a Scrt1.o ```
Oct 27 2023
On Friday, 27 October 2023 at 17:14:07 UTC, Dmitry Ponyatov wrote:Now have some problems with right `ldc2.conf`: [...] /home/ponyatov/player/host/lib/gcc/i686-linux-musl/12.3.0/../../../../i68 -linux-musl/bin/ld: cannot find -lunwind: No such file or directoryThe .conf seems fine. On musl, druntime depends on libunwind (`-lunwind` is injected by LDC). There's a package for Alpine, incl. a link to the project home page to build it yourself: https://pkgs.alpinelinux.org/package/edge/main/x86/libunwind
Oct 28 2023








kinke <noone nowhere.com>