For my language (Runa), which compiles to LLVM IR, I'm trying to enable compilation to Windows. I would like to enable linking with MSVC-compiled stuff, so I want to use an MSVC target triple. I installed MSVC Community 2013 and have a cmd.exe
window where I've run the accompanying vcvars32.bat
script, so that a bunch of MSVC things have been added to PATH
. However, when trying to compile, I get the following linker errors:
hello-163edf.obj : error LNK2019: unresolved external symbol malloc referenced in function runa.malloc
hello-163edf.obj : error LNK2019: unresolved external symbol free referenced in function runa.free
hello-163edf.obj : error LNK2019: unresolved external symbol memcpy referenced in function runa.memcpy
hello-163edf.obj : error LNK2019: unresolved external symbol write referenced in function runa.unhandled
hello-163edf.obj : error LNK2019: unresolved external symbol exit referenced in function runa.clean
hello-163edf.obj : error LNK2019: unresolved external symbol _Unwind_RaiseException referenced in function runa.raise
hello-163edf.obj : error LNK2019: unresolved external symbol snprintf referenced in function float.__str__
hello-163edf.obj : error LNK2019: unresolved external symbol strlen referenced in function uint.__str__
hello-163edf.obj : error LNK2019: unresolved external symbol __chkstk referenced in function str.__eq__
hello-163edf.obj : error LNK2019: unresolved external symbol strncmp referenced in function str.__eq__
hello-163edf.obj : error LNK2001: unresolved external symbol _fltused
I understand the one about _Unwind_RaiseException
, that probably doesn't fit in with this target, but it's not clear to me why basic libc stuff like malloc()
cannot be find.
Most of these were solved by adding /link msvcrt.lib
to the end of my compiler invocation.