www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How to build a statically linked executable, before i loose my mind

reply ryuukk_ <ryuukk.dev gmail.com> writes:
First of all, i build with `ldmd2`

Second of all, i do not use DUB

Lastly, it fails with:


```
ldmd2 -L-static  ...
```

```
/usr/bin/ld: cannot find -lphobos2-ldc-shared: No such file or 
directory
/usr/bin/ld: cannot find -ldruntime-ldc-shared: No such file or 
directory
```


Why does it complain about SHARED when passing STATIC?
Jul 13
next sibling parent Sergey <kornburn yandex.ru> writes:
On Saturday, 13 July 2024 at 14:53:41 UTC, ryuukk_ wrote:
 Why does it complain about SHARED when passing STATIC?
It depends on the OS and if Linux - distribution.
Jul 13
prev sibling next sibling parent "Richard (Rikki) Andrew Cattermole" <richard cattermole.co.nz> writes:
On 14/07/2024 2:53 AM, ryuukk_ wrote:
 First of all, i build with `ldmd2`
 
 Second of all, i do not use DUB
 
 Lastly, it fails with:
 
 
 ```
 ldmd2 -L-staticĀ  ...
 ```
 
 ```
 /usr/bin/ld: cannot find -lphobos2-ldc-shared: No such file or directory
 /usr/bin/ld: cannot find -ldruntime-ldc-shared: No such file or directory
 ```
 
 
 Why does it complain about SHARED when passing STATIC?
Doesn't look like the switch does what you are thinking it does. ``` -static On systems that support dynamic linking, this overrides -pie and prevents linking with the shared libraries. On other systems, this option has no effect. ``` https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html Preventing linking against, and swapping two different binaries to link against are different things. Specifying to link against the shared libraries for druntime + phobos is done by the compiler, not the linker. You might want to try ``--link-defaultlib-shared=false`` instead.
Jul 13
prev sibling parent reply ryuukk_ <ryuukk.dev gmail.com> writes:
I'm loosing it

Even with dub it doesn't work

`"lflags": [ "-static", "--link-defaultlib-shared=false" ],`



```
(cut due to forum's limit)
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd6__ctorMFNaNbNcNfAyaZSQCtQCp__
QClHTyaZQCt+0x1a9): undefined reference to `_d_arraybounds_slice'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd6__ctorMFNaNbNcNfAyaZSQCtQCp__
QClHTyaZQCt+0x1c5): undefined reference to `_d_arraybounds_slice'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd6__ctorMFNaNbNcNfAyaZSQCtQCp__
QClHTyaZQCt+0x1e3): undefined reference to `_d_arraybounds_index'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd6__ctorMFNaNbNcNfAyaZSQCtQCp__
QClHTyaZQCt+0x1fc): undefined reference to `_d_arraybounds_slice'
/usr/bin/ld: server/dls/libdcd.a(dparse.trivia.o): in function 
`_D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd__T7processTS3std5array__T8AppenderTAyaZQoZQBoMFNaNbNfKQBrZv':
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd__T7processTS3std5array__T8AppenderTAyaZQoZQBoM
NaNbNfKQBrZv+0xfe): undefined reference to `_d_arraybounds_slice'
/usr/bin/ld: server/dls/libdcd.a(dparse.trivia.o): in function 
`_D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd11stripIndentMFNaNbNiNfZv':
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd11stripInden
MFNaNbNiNfZv+0x6c): undefined reference to `_D3std5ascii7isWhiteFNaNbNiNfwZb'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd11stripIndent
FNaNbNiNfZv+0x142): undefined reference to `_D3std5ascii7isWhiteFNaNbNiNfwZb'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd11stripIndent
FNaNbNiNfZv+0x17d): undefined reference to `_d_arraybounds_index'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd11stripIndent
FNaNbNiNfZv+0x196): undefined reference to `_d_arraybounds_index'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd11stripIndent
FNaNbNiNfZv+0x1b1): undefined reference to `_d_arraybounds_index'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd11stripIndent
FNaNbNiNfZv+0x1cd): undefined reference to `_d_arraybounds_slice'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd11stripIndent
FNaNbNiNfZv+0x1ee): undefined reference to `_d_arraybounds_slice'
/usr/bin/ld: server/dls/libdcd.a(dparse.trivia.o): in function 
`_D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd16processFirstLineMFNaNbNiNfZv':
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd16processFirstLin
MFNaNbNiNfZv+0xff): undefined reference to `_d_array_slice_copy'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd16processFirstLine
FNaNbNiNfZv+0x13c): undefined reference to `_D3std5ascii7isWhiteFNaNbNiNfwZb'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd16processFirstLine
FNaNbNiNfZv+0x16d): undefined reference to `_d_arraybounds_index'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd16processFirstLine
FNaNbNiNfZv+0x186): undefined reference to `_d_arraybounds_index'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd16processFirstLine
FNaNbNiNfZv+0x1a1): undefined reference to `_d_arraybounds_index'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd16processFirstLine
FNaNbNiNfZv+0x1bc): undefined reference to `_d_arraybounds_index'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd16processFirstLine
FNaNbNiNfZv+0x1da): undefined reference to `_d_arraybounds_slice'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd16processFirstLine
FNaNbNiNfZv+0x1f5): undefined reference to `_d_arraybounds_index'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd16processFirstLine
FNaNbNiNfZv+0x20b): undefined reference to `_d_arraybounds_index'
/usr/bin/ld: server/dls/libdcd.a(dparse.trivia.o): in function 
`_D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd15processLastLineMFNaNbNiNfZv':
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd15processLastLin
MFNaNbNiNfZv+0xc7): undefined reference to `_d_arraybounds_index'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd15processLastLin
MFNaNbNiNfZv+0xe0): undefined reference to `_d_arraybounds_index'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd15processLastLin
MFNaNbNiNfZv+0xfc): undefined reference to `_d_arraybounds_slice'
/usr/bin/ld: server/dls/libdcd.a(dparse.trivia.o): in function 
`_D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd10unDecorateMFNaNbNiNfZv':
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd10unDecorate
FNaNbNiNfZv+0x1d4): undefined reference to `_d_arraybounds_index'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd10unDecorate
FNaNbNiNfZv+0x1f0): undefined reference to `_d_arraybounds_index'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd10unDecorate
FNaNbNiNfZv+0x209): undefined reference to `_d_arraybounds_index'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd10unDecorate
FNaNbNiNfZv+0x222): undefined reference to `_d_arraybounds_index'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd10unDecorate
FNaNbNiNfZv+0x240): undefined reference to `_d_arraybounds_index'
/usr/bin/ld: 
server/dls/libdcd.a(dparse.trivia.o):trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd10unDecorate
FNaNbNiNfZv+0x25b): more undefined references to `_d_arraybounds_index' follow
/usr/bin/ld: server/dls/libdcd.a(dparse.trivia.o): in function 
`_D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd10unDecorateMFNaNbNiNfZv':
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd10unDecorate
FNaNbNiNfZv+0x276): undefined reference to `_d_arraybounds_slice'
/usr/bin/ld: server/dls/libdcd.a(dparse.trivia.o): in function 
`_D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd9stripLeftMFNaNbNiNfZv':
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd9stripLef
MFNaNbNiNfZv+0x54): undefined reference to `_D3std5ascii7isWhiteFNaNbNiNfwZb'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd9stripLef
MFNaNbNiNfZv+0xf7): undefined reference to `_D3std5ascii7isWhiteFNaNbNiNfwZb'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd9stripLeft
FNaNbNiNfZv+0x1fd): undefined reference to `_d_arraybounds_index'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd9stripLeft
FNaNbNiNfZv+0x216): undefined reference to `_d_arraybounds_index'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd9stripLeft
FNaNbNiNfZv+0x231): undefined reference to `_d_arraybounds_slice'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd9stripLeft
FNaNbNiNfZv+0x24c): undefined reference to `_d_arraybounds_index'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd9stripLeft
FNaNbNiNfZv+0x267): undefined reference to `_d_arraybounds_slice'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd9stripLeft
FNaNbNiNfZv+0x282): undefined reference to `_d_arraybounds_index'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd9stripLeft
FNaNbNiNfZv+0x29e): undefined reference to `_d_arraybounds_slice'
/usr/bin/ld: server/dls/libdcd.a(dparse.trivia.o): in function 
`_D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd10stripRightMFNaNbNiNfZv':
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd10stripRigh
MFNaNbNiNfZv+0x5f): undefined reference to `_D3std5ascii7isWhiteFNaNbNiNfwZb'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd10stripRigh
MFNaNbNiNfZv+0x9e): undefined reference to `_D3std5ascii7isWhiteFNaNbNiNfwZb'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd10stripRigh
MFNaNbNiNfZv+0xcd): undefined reference to `_d_arraybounds_slice'
/usr/bin/ld: 
trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd10stripRigh
MFNaNbNiNfZv+0xf8): undefined reference to `_d_arraybounds_index'
/usr/bin/ld: 
server/dls/libdcd.a(msgpack.streaming_unpacker.o):(.data._D11TypeI
fo_xb6__initZ+0x0): undefined reference to `_D14TypeInfo_Const6__vtblZ'
/usr/bin/ld: 
server/dls/libdcd.a(msgpack.streaming_unpacker.o):(.data._D11TypeIn
o_xb6__initZ+0x10): undefined reference to `_D10TypeInfo_b6__initZ'
/usr/bin/ld: 
server/dls/libdcd.a(dcd.server.autocomplete.symbols.o):(.data._D3dcd6server12autocomplete7symbols12
_ModuleInfoZ+0x10): undefined reference to
`_D3std12experimental6logger12__ModuleInfoZ'
/usr/bin/ld: 
server/dls/libdcd.a(dcd.server.server.o):(.data._D3dcd6serverQh12
_ModuleInfoZ+0x10): undefined reference to
`_D3std12experimental6logger12__ModuleInfoZ'
/usr/bin/ld: 
server/dls/libdcd.a(dcd.server.server.o):(.data._D3dcd6serverQh12
_ModuleInfoZ+0x18): undefined reference to `_D3std7process12__ModuleInfoZ'
/usr/bin/ld: 
server/dls/libdcd.a(msgpack.common.o):(.data._D11TypeInfo_xh6__initZ+0x0):
undefined reference to `_D14TypeInfo_Const6__vtblZ'
/usr/bin/ld: 
server/dls/libdcd.a(msgpack.common.o):(.data._D11TypeInfo_xh6__initZ+0x10):
undefined reference to `_D10TypeInfo_h6__initZ'
/usr/bin/ld: 
server/dls/libdcd.a(msgpack.exception.o):(.data.rel.ro._D7msgpack9exception20MessagePackExc
ption6__vtblZ+0x8): undefined reference to `_D6object9Throwable8toStringMFZAya'
/usr/bin/ld: 
server/dls/libdcd.a(msgpack.exception.o):(.data.rel.ro._D7msgpack9exception20MessagePackExce
tion6__vtblZ+0x10): undefined reference to `_D6object6Object6toHashMFNbNeZm'
/usr/bin/ld: 
server/dls/libdcd.a(msgpack.exception.o):(.data.rel.ro._D7msgpack9exception20MessagePackExce
tion6__vtblZ+0x18): undefined reference to `_D6object6Object5opCmpMFCQqZi'
/usr/bin/ld: 
server/dls/libdcd.a(msgpack.exception.o):(.data.rel.ro._D7msgpack9exception20MessagePackExce
tion6__vtblZ+0x20): undefined reference to `_D6object6Object8opEqualsMFCQtZb'
/usr/bin/ld: 
server/dls/libdcd.a(msgpack.exception.o):(.data.rel.ro._D7msgpack9exception20MessagePackExce
tion6__vtblZ+0x28): undefined reference to
`_D6object9Throwable4nextMNgFNaNbNdNiNjNlNfZNgCQBsQBo'
/usr/bin/ld: 
server/dls/libdcd.a(msgpack.exception.o):(.data.rel.ro._D7msgpack9exception20MessagePackExce
tion6__vtblZ+0x30): undefined reference to
`_D6object9Throwable4nextMFNaNbNdNiNlNfCQBlQBhZv'
/usr/bin/ld: 
server/dls/libdcd.a(msgpack.exception.o):(.data.rel.ro._D7msgpack9exception20MessagePackExce
tion6__vtblZ+0x38): undefined reference to
`_D6object9Throwable7opApplyMFMDFCQBfQBbZiZi'
/usr/bin/ld: 
server/dls/libdcd.a(msgpack.exception.o):(.data.rel.ro._D7msgpack9exception20MessagePackExce
tion6__vtblZ+0x40): undefined reference to
`_D6object9Throwable8toStringMxFMDFIAaZvZv'
/usr/bin/ld: 
server/dls/libdcd.a(msgpack.exception.o):(.data.rel.ro._D7msgpack9exception20MessagePackExce
tion6__vtblZ+0x48): undefined reference to
`_D6object9Throwable7messageMxFNbNfZAxa'
/usr/bin/ld: 
server/dls/libdcd.a(msgpack.exception.o):(.data._D7msgpack9exception20MessagePackExce
tion7__ClassZ+0x0): undefined reference to `_D14TypeInfo_Class6__vtblZ'
/usr/bin/ld: 
server/dls/libdcd.a(msgpack.exception.o):(.data._D7msgpack9exception20MessagePackExcep
ion7__ClassZ+0x50): undefined reference to `_D9Exception7__ClassZ'
/usr/bin/ld: 
server/dls/libdcd.a(msgpack.exception.o):(.data.rel.ro._D7msgpack9exception15UnpackExc
ption6__vtblZ+0x8): undefined reference to `_D6object9Throwable8toStringMFZAya'
/usr/bin/ld: 
server/dls/libdcd.a(msgpack.exception.o):(.data.rel.ro._D7msgpack9exception15UnpackExce
tion6__vtblZ+0x10): undefined reference to `_D6object6Object6toHashMFNbNeZm'
/usr/bin/ld: 
server/dls/libdcd.a(msgpack.exception.o):(.data.rel.ro._D7msgpack9exception15UnpackExce
tion6__vtblZ+0x18): undefined reference to `_D6object6Object5opCmpMFCQqZi'
/usr/bin/ld: 
server/dls/libdcd.a(msgpack.exception.o):(.data.rel.ro._D7msgpack9exception15UnpackExce
tion6__vtblZ+0x20): undefined reference to `_D6object6Object8opEqualsMFCQtZb'
/usr/bin/ld: 
server/dls/libdcd.a(msgpack.exception.o):(.data.rel.ro._D7msgpack9exception15UnpackExce
tion6__vtblZ+0x28): undefined reference to
`_D6object9Throwable4nextMNgFNaNbNdNiNjNlNfZNgCQBsQBo'
/usr/bin/ld: 
server/dls/libdcd.a(msgpack.exception.o):(.data.rel.ro._D7msgpack9exception15UnpackExce
tion6__vtblZ+0x30): undefined reference to
`_D6object9Throwable4nextMFNaNbNdNiNlNfCQBlQBhZv'
/usr/bin/ld: 
server/dls/libdcd.a(msgpack.exception.o):(.data.rel.ro._D7msgpack9exception15UnpackExce
tion6__vtblZ+0x38): undefined reference to
`_D6object9Throwable7opApplyMFMDFCQBfQBbZiZi'
/usr/bin/ld: 
server/dls/libdcd.a(msgpack.exception.o):(.data.rel.ro._D7msgpack9exception15UnpackExce
tion6__vtblZ+0x40): undefined reference to
`_D6object9Throwable8toStringMxFMDFIAaZvZv'
/usr/bin/ld: 
server/dls/libdcd.a(msgpack.exception.o):(.data.rel.ro._D7msgpack9exception15UnpackExce
tion6__vtblZ+0x48): undefined reference to
`_D6object9Throwable7messageMxFNbNfZAxa'
/usr/bin/ld: 
server/dls/libdcd.a(msgpack.exception.o):(.data._D7msgpack9exception15UnpackExce
tion7__ClassZ+0x0): undefined reference to `_D14TypeInfo_Class6__vtblZ'
/usr/bin/ld: 
server/dls/libdcd.a(dcd.server.autocomplete.doc.o):(.data._D3dcd6server12autocomplete3doc12
_ModuleInfoZ+0x10): undefined reference to
`_D3std12experimental6logger12__ModuleInfoZ'
/usr/bin/ld: 
server/dls/libdcd.a(dcd.server.autocomplete.inlayhints.o):(.data._D3dcd6server12autocomplete10inlayhints12
_ModuleInfoZ+0x10): undefined reference to
`_D3std12experimental6logger12__ModuleInfoZ'
/usr/bin/ld: 
server/dls/libdcd.a(dcd.server.autocomplete.localuse.o):(.data._D3dcd6server12autocomplete8localuse12
_ModuleInfoZ+0x10): undefined reference to
`_D3std12experimental6logger12__ModuleInfoZ'
collect2: error: ld returned 1 exit status
Error: /usr/bin/cc failed with status: 1
make: *** [makefile:42: build-dls-release] Error 1
ryuukk ark:~/dev/dls (master)
$
```
Jul 13
next sibling parent ryuukk_ <ryuukk.dev gmail.com> writes:
For anyone curious:

https://github.com/ryuukk/dls/tree/master

``make build-dcd-release && make build-dls-release``

i'm giving up for now, i'll never touch druntime/phobos/dub never 
again
Jul 13
prev sibling parent reply "Richard (Rikki) Andrew Cattermole" <richard cattermole.co.nz> writes:
Seeing ``_d_arraybounds_slice`` missing sounds like druntime isn't being 
linked against.

It is possible that your distribution of ldc doesn't include a static 
build of druntime/phobos. You need to verify that ld is trying to link 
against a static build and that static build exists.
Jul 13
parent reply ryuukk_ <ryuukk.dev gmail.com> writes:
On Saturday, 13 July 2024 at 16:16:20 UTC, Richard (Rikki) Andrew 
Cattermole wrote:
 Seeing ``_d_arraybounds_slice`` missing sounds like druntime 
 isn't being linked against.

 It is possible that your distribution of ldc doesn't include a 
 static build of druntime/phobos. You need to verify that ld is 
 trying to link against a static build and that static build 
 exists.
`curl -fsS https://dlang.org/install.sh | bash -s ldc`
Jul 13
parent reply "Richard (Rikki) Andrew Cattermole" <richard cattermole.co.nz> writes:
On 14/07/2024 4:37 AM, ryuukk_ wrote:
 On Saturday, 13 July 2024 at 16:16:20 UTC, Richard (Rikki) Andrew 
 Cattermole wrote:
 Seeing ``_d_arraybounds_slice`` missing sounds like druntime isn't 
 being linked against.

 It is possible that your distribution of ldc doesn't include a static 
 build of druntime/phobos. You need to verify that ld is trying to link 
 against a static build and that static build exists.
`curl -fsS https://dlang.org/install.sh | bash -s ldc`
Okay yup, looks like its all there in latest release. Have to dump out what ld is getting passed to it, and what it thinks it is doing next.
Jul 13
parent reply ryuukk_ <ryuukk.dev gmail.com> writes:
On Saturday, 13 July 2024 at 16:44:22 UTC, Richard (Rikki) Andrew 
Cattermole wrote:
 On 14/07/2024 4:37 AM, ryuukk_ wrote:
 On Saturday, 13 July 2024 at 16:16:20 UTC, Richard (Rikki) 
 Andrew Cattermole wrote:
 Seeing ``_d_arraybounds_slice`` missing sounds like druntime 
 isn't being linked against.

 It is possible that your distribution of ldc doesn't include 
 a static build of druntime/phobos. You need to verify that ld 
 is trying to link against a static build and that static 
 build exists.
`curl -fsS https://dlang.org/install.sh | bash -s ldc`
Okay yup, looks like its all there in latest release. Have to dump out what ld is getting passed to it, and what it thinks it is doing next.
``` /usr/bin/ld -plugin /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper -plugin-opt=-fresolution=/tmp/ccBV7TjM.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o bin/dls /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o -L/home/runner/dlang/ldc-1.39.0/bin/../lib -L/home/runner/dlang/ldc-1.39.0/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/11 -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/home/runner/dlang/ldc-1.39.0/lib -L/usr/lib/gcc/x ``` https://github.com/ryuukk/dls/actions/runs/9921536908/job/27409615370 It works locally, but not their machine, ubuntu apparently
Jul 13
parent reply "Richard (Rikki) Andrew Cattermole" <richard cattermole.co.nz> writes:
On 14/07/2024 5:06 AM, ryuukk_ wrote:
 On Saturday, 13 July 2024 at 16:44:22 UTC, Richard (Rikki) Andrew 
 Cattermole wrote:
 On 14/07/2024 4:37 AM, ryuukk_ wrote:
 On Saturday, 13 July 2024 at 16:16:20 UTC, Richard (Rikki) Andrew 
 Cattermole wrote:
 Seeing ``_d_arraybounds_slice`` missing sounds like druntime isn't 
 being linked against.

 It is possible that your distribution of ldc doesn't include a 
 static build of druntime/phobos. You need to verify that ld is 
 trying to link against a static build and that static build exists.
`curl -fsS https://dlang.org/install.sh | bash -s ldc`
Okay yup, looks like its all there in latest release. Have to dump out what ld is getting passed to it, and what it thinks it is doing next.
``` /usr/bin/ld -plugin /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper -plugin-opt=-fresolution=/tmp/ccBV7TjM.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o bin/dls /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o -L/home/runner/dlang/ldc-1.39.0/bin/../lib -L/home/runner/dlang/ldc-1.39.0/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/11 -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/home/runner/dlang/ldc-1.39.0/lib -L/usr/lib/gcc/x ``` https://github.com/ryuukk/dls/actions/runs/9921536908/job/27409615370 It works locally, but not their machine, ubuntu apparently
Boom, got it working! https://github.com/rikkimax/dls/blob/master/makefile#L39 It's a link order issue. ``` ldc2 -of=bin/dlsobj.o -c --output-o $(OPTIMIZE) $(PREVIEWS) -Iserver/ -i server/cjson/cJSON.c server/dls/main.d ldc2 -of=bin/dls$(exe) bin/dlsobj.o server/dls/libdcd.a ```
Jul 13
parent ryuukk_ <ryuukk.dev gmail.com> writes:
On Sunday, 14 July 2024 at 06:34:54 UTC, Richard (Rikki) Andrew 
Cattermole wrote:
 On 14/07/2024 5:06 AM, ryuukk_ wrote:
 On Saturday, 13 July 2024 at 16:44:22 UTC, Richard (Rikki) 
 Andrew Cattermole wrote:
 On 14/07/2024 4:37 AM, ryuukk_ wrote:
 On Saturday, 13 July 2024 at 16:16:20 UTC, Richard (Rikki) 
 Andrew Cattermole wrote:
 Seeing ``_d_arraybounds_slice`` missing sounds like 
 druntime isn't being linked against.

 It is possible that your distribution of ldc doesn't 
 include a static build of druntime/phobos. You need to 
 verify that ld is trying to link against a static build and 
 that static build exists.
`curl -fsS https://dlang.org/install.sh | bash -s ldc`
Okay yup, looks like its all there in latest release. Have to dump out what ld is getting passed to it, and what it thinks it is doing next.
``` /usr/bin/ld -plugin /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper -plugin-opt=-fresolution=/tmp/ccBV7TjM.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o bin/dls /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o -L/home/runner/dlang/ldc-1.39.0/bin/../lib -L/home/runner/dlang/ldc-1.39.0/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/11 -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/home/runner/dlang/ldc-1.39.0/lib -L/usr/lib/gcc/x ``` https://github.com/ryuukk/dls/actions/runs/9921536908/job/27409615370 It works locally, but not their machine, ubuntu apparently
Boom, got it working! https://github.com/rikkimax/dls/blob/master/makefile#L39 It's a link order issue. ``` ldc2 -of=bin/dlsobj.o -c --output-o $(OPTIMIZE) $(PREVIEWS) -Iserver/ -i server/cjson/cJSON.c server/dls/main.d ldc2 -of=bin/dls$(exe) bin/dlsobj.o server/dls/libdcd.a ```
It works!! thanks a lot!!
Jul 14