www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - LDC cant find lld-link when crosscompiling

reply AzuraAkumore <truemr.derpster gmail.com> writes:
Im trying to set up a project that i want to compile for both 
Windows and Linux. I a on a Linux machine.

When compiling for Linux, the platform I'm on, ldc works no 
problem. its only when I specify to compile for windows that it 
cant find lld-link. I installed both LDC and DMD via the deb 
package files.

My ldc2.conf has this section, taken from 
[this](https://forum.dlang.org/post/bgzrimurmhxdsamwrhyo forum.dlang.org) post.

```
"(i686|x86_64)-.*-windows.msvc":
	{
	    switches = [
		"-defaultlib=phobos2-ldc,druntime-ldc",
		"-link-defaultlib-shared=false",
	    ];
	    lib-dirs = [
		"/home/azura/Documents/ldc2-1.39.0-windows-x64/lib",
	    ];
	};
```

Ive also linked to the windows version of ldc in the conf. I dont 
know if i did it correctly though.

Where have i messed up or am I even on the right track?
Oct 09
next sibling parent Sergey <kornburn yandex.ru> writes:
On Wednesday, 9 October 2024 at 16:07:29 UTC, AzuraAkumore wrote:
 Where have i messed up or am I even on the right track?
It seems fine.. the only thing I can think about is misuse of 32/64 bit libs.. I have this notes: 1) Download Windows multilib 2) Install ldc on linux to LDC_PATH/ldc 3) unzip windows and put lib32 and lib64 to <LDC_PATH>/win-lib32 and <LDC_PATH>/win-lib64 4) Use config: ``` "i[3-6]86-.*-windows-msvc": { switches = [ "-defaultlib=phobos2-ldc,druntime-ldc", "-link-defaultlib-shared=false", ]; lib-dirs = [ "%%ldcbinarypath%%/../win-lib32", ]; }; "x86_64-.*-windows-msvc": { switches = [ "-defaultlib=phobos2-ldc,druntime-ldc", "-link-defaultlib-shared=false", ]; lib-dirs = [ "%%ldcbinarypath%%/../win-lib64", ]; }; ``` 5) dub build --arch=x86_64-pc-windows-msvc
Oct 09
prev sibling next sibling parent Johan <j j.nl> writes:
On Wednesday, 9 October 2024 at 16:07:29 UTC, AzuraAkumore wrote:
 Im trying to set up a project that i want to compile for both 
 Windows and Linux. I a on a Linux machine.

 When compiling for Linux, the platform I'm on, ldc works no 
 problem. its only when I specify to compile for windows that it 
 cant find lld-link. I installed both LDC and DMD via the deb 
 package files.
`lld-link` is the linker that LDC calls by default (apparently in your case), but that program is not shipped with LDC. You have to install it separately. You can compile with the `-v` flag to see the command that LDC calls to invoke the linker (at the end of the output). Another idea it to use `--link-internally`, which uses the linker built into LDC (same linker as lld-link). -Johan
Oct 09
prev sibling parent kinke <noone nowhere.com> writes:
On Wednesday, 9 October 2024 at 16:07:29 UTC, AzuraAkumore wrote:
 I installed both LDC and DMD via the deb package files.
And that's the problem - that deb package apparently wasn't built with the LLD linker integration. Official LDC releases from GitHub are, and thus default to `-link-internally` when cross-linking to Windows, not needing any external `lld-link` executable.
Oct 10