Having trouble cross-compiling from linux to windows
TheZipCreator
thezipcreator at protonmail.com
Sat Jan 14 18:26:47 UTC 2023
I've installed ldc2 for linux and am now trying to compile for
windows. I downloaded the windows release as well and put the
libs into the libs folder of the linux version. I'm currently
trying to compile a simple test application:
```d
import std.stdio;
void main() {
writeln("Hello, World!");
}
```
with the following compiler arguments:
`ldc2 hello.d --mtriple x86_64-windows-msvc`
but I get a linker error (with `-c` it compiles just fine, but I
need to produce an executable so that won't work.)
Here's the output the compiler gives me:
```
lld-link: error: <root>: undefined symbol: wmainCRTStartup
lld-link: error: undefined symbol:
_D3std5stdio13trustedStdoutFNdNeZSQBgQBf4File
>>> referenced by
>>> hello.obj:(_D3std5stdio__T7writelnTAyaZQnFNfQjZv)
lld-link: error: undefined symbol:
_D3std5stdio4File17lockingTextWriterMFNfZSQBoQBnQBk17LockingTextWriter
>>> referenced by
>>> hello.obj:(_D3std5stdio__T7writelnTAyaZQnFNfQjZv)
lld-link: error: undefined symbol: _D3std5stdio4File6__dtorMFNfZv
>>> referenced by
>>> hello.obj:(_D3std5stdio__T7writelnTAyaZQnFNfQjZv)
>>> referenced by
>>> hello.obj:(?dtor$7@?0?_D3std5stdio__T7writelnTAyaZQnFNfQjZv at 4HA)
lld-link: error: undefined symbol:
_D3std5stdio4File17LockingTextWriter10__aggrDtorMFNeZv
>>> referenced by
>>> hello.obj:(_D3std5stdio__T7writelnTAyaZQnFNfQjZv)
>>> referenced by
>>> hello.obj:(?dtor$4@?0?_D3std5stdio__T7writelnTAyaZQnFNfQjZv at 4HA)
lld-link: error: undefined symbol: __CxxFrameHandler3
>>> referenced by hello.obj:(.xdata)
lld-link: error: undefined symbol: _d_enter_cleanup
>>> referenced by
>>> hello.obj:(?dtor$4@?0?_D3std5stdio__T7writelnTAyaZQnFNfQjZv at 4HA)
>>> referenced by
>>> hello.obj:(?dtor$7@?0?_D3std5stdio__T7writelnTAyaZQnFNfQjZv at 4HA)
lld-link: error: undefined symbol: _d_leave_cleanup
>>> referenced by
>>> hello.obj:(?dtor$4@?0?_D3std5stdio__T7writelnTAyaZQnFNfQjZv at 4HA)
>>> referenced by
>>> hello.obj:(?dtor$7@?0?_D3std5stdio__T7writelnTAyaZQnFNfQjZv at 4HA)
lld-link: error: undefined symbol: _d_wrun_main
>>> referenced by hello.obj:(wmain)
lld-link: error: undefined symbol:
_D3std5stdio4File17LockingTextWriter26highSurrogateShouldBeEmptyMFNfZv
>>> referenced by
>>> hello.obj:(_D3std5stdio4File17LockingTextWriter__T3putTaZQhMFNfaZv)
>>> referenced by
>>> hello.obj:(_D3std5stdio4File17LockingTextWriter__T3putTyaZQiMFNfyaZv)
lld-link: error: undefined symbol:
_D3std5stdio4File17LockingTextWriter7handle_MFNdNeZPS4core4stdcQCf6_iobuf
>>> referenced by
>>> hello.obj:(_D3std5stdio4File17LockingTextWriter__T3putTaZQhMFNfaZv)
>>> referenced by
>>> hello.obj:(_D3std5stdio4File17LockingTextWriter__T3putTaZQhMFNfaZv)
>>> referenced by
>>> hello.obj:(_D3std5stdio4File17LockingTextWriter__T3putTaZQhMFNfaZv)
>>> referenced 3 more times
lld-link: error: undefined symbol: _fputc_nolock
>>> referenced by
>>> hello.obj:(_D3std5stdio4File17LockingTextWriter__T3putTaZQhMFNfaZv)
>>> referenced by
>>> hello.obj:(_D3std5stdio4File17LockingTextWriter__T3putTyaZQiMFNfyaZv)
lld-link: error: undefined symbol: _fputwc_nolock
>>> referenced by
>>> hello.obj:(_D3std5stdio4File17LockingTextWriter__T3putTaZQhMFNfaZv)
>>> referenced by
>>> hello.obj:(_D3std5stdio4File17LockingTextWriter__T3putTaZQhMFNfaZv)
>>> referenced by
>>> hello.obj:(_D3std5stdio4File17LockingTextWriter__T3putTyaZQiMFNfyaZv)
>>> referenced 1 more times
lld-link: error: undefined symbol: _d_arraybounds_index
>>> referenced by
>>> hello.obj:(_D3std5stdio4File17LockingTextWriter__T3putTaZQhMFNfaZv)
>>> referenced by
>>> hello.obj:(_D3std5stdio4File17LockingTextWriter__T3putTaZQhMFNfaZv)
>>> referenced by
>>> hello.obj:(_D3std5stdio4File17LockingTextWriter__T3putTyaZQiMFNfyaZv)
>>> referenced 8 more times
lld-link: error: undefined symbol: _d_arraybounds_slice
>>> referenced by
>>> hello.obj:(_D3std5stdio4File17LockingTextWriter__T3putTaZQhMFNfaZv)
>>> referenced by
>>> hello.obj:(_D3std5stdio4File17LockingTextWriter__T3putTyaZQiMFNfyaZv)
>>> referenced by
>>> hello.obj:(_D3std3utf__T11decodeFrontVEQBa8typecons__T4FlagVAyaa19_7573655265706c6163656d656e744463686172ZQCai0TAaZQDnFNaNeMKQnJmZw)
>>> referenced 2 more times
lld-link: error: undefined symbol: fwrite
>>> referenced by
>>> hello.obj:(_D3std5stdio__T13trustedFwriteTaZQsFNbNiNePOS4core4stdcQBx6_iobufxAaZm)
lld-link: error: undefined symbol: ClassInfo for
std.exception.ErrnoException
>>> referenced by
>>> hello.obj:(_D3std9exception__T7bailOutHTCQBcQBb14ErrnoExceptionZQBiFNfAyamMAxaZNn)
lld-link: error: undefined symbol: _d_allocclass
>>> referenced by
>>> hello.obj:(_D3std9exception__T7bailOutHTCQBcQBb14ErrnoExceptionZQBiFNfAyamMAxaZNn)
>>> referenced by
>>> hello.obj:(_D3std3utf__T10decodeImplVbi1VEQBd8typecons__T4FlagVAyaa19_7573655265706c6163656d656e744463686172ZQCai0TAxaZQDrFQiKmZ__T9exceptionTQBbZQpFNaNbNfQBoQDrZCQFuQFt12UTFException)
>>> referenced by
>>> hello.obj:(_D3std3utf__T13_utfExceptionVEQBc8typecons__T4FlagVAyaa19_7573655265706c6163656d656e744463686172ZQCai0ZQDmFNaNfQCiwZw)
lld-link: error: undefined symbol: vtable for
std.exception.ErrnoException
>>> referenced by
>>> hello.obj:(_D3std9exception__T7bailOutHTCQBcQBb14ErrnoExceptionZQBiFNfAyamMAxaZNn)
lld-link: error: undefined symbol: initializer for
std.exception.ErrnoException
>>> referenced by
>>> hello.obj:(_D3std9exception__T7bailOutHTCQBcQBb14ErrnoExceptionZQBiFNfAyamMAxaZNn)
lld-link: error: too many errors emitted, stopping now (use
/errorlimit:0 to see all errors)
Error: linking with LLD failed
```
More information about the digitalmars-d-ldc
mailing list