build runtime for embedded Linux (cross)

Dmitry Ponyatov dponyatov at gmail.com
Fri Oct 27 17:14:07 UTC 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/../../../../i686-linux-musl/bin/ld: cannot find -lunwind: No such file or directory
collect2: error: ld returned 1 exit status
```
```sh
ponyatov at 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
```



More information about the digitalmars-d-ldc mailing list