JuliaHubOSS / llvm-cbe

resurrected LLVM "C Backend", with improvements
Other
826 stars 141 forks source link

Issues with building llvm-cbe as a part of the llvm 13 toolchain #141

Closed jfm535 closed 3 years ago

jfm535 commented 3 years ago

this issue specific deals with compiling wherein llvm-cbe is located at llvm-project/llvm/projects/llvm-cbe

most of the codebase compiles file until you reach LLVM-C.dll or its other system dependent names.

the problem is a linking issue connected with this line https://github.com/JuliaComputingOSS/llvm-cbe/blob/d316e6860ec5d79ac5c5404001510fea4b63e6c1/lib/Target/CBackend/CBackend.cpp#L75

a copy of the observed error

FAILED: bin/LLVM-C.dll lib/LLVM-C.lib 
cmd.exe /C "cd . && C:\Users\peter\scoop\apps\cmake\3.20.5\bin\cmake.exe -E vs_link_dll --intdir=tools\llvm-shlib\CMakeFiles\LLVM-C.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x64\mt.exe --manifests  -- C:\PROGRA~2\MICROS~1\2019\COMMUN~1\VC\Tools\Llvm\x64\bin\lld-link.exe /nologo @CMakeFiles\LLVM-C.rsp  /out:bin\LLVM-C.dll /implib:lib\LLVM-C.lib /pdb:bin\LLVM-C.pdb /dll /version:0.0 /machine:x64 /debug /INCREMENTAL  /DEF:"D:/Modding/llvm-project/llvm/llvmTesting/tools/llvm-shlib/LLVM-C.def"  && cmd.exe /C "cd /D D:\Modding\llvm-project\llvm\llvmTesting\tools\llvm-shlib && C:\Users\peter\scoop\shims\pwsh.exe -noprofile -executionpolicy Bypass -file D:/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 -targetBinary D:/Modding/llvm-project/llvm/llvmTesting/bin/LLVM-C.dll -installedDir D:/Modding/llvm-project/llvm/llvmTesting/vcpkg_installed/x64-windows-static-md/bin -OutVariable out""
LINK Pass 1: command "C:\PROGRA~2\MICROS~1\2019\COMMUN~1\VC\Tools\Llvm\x64\bin\lld-link.exe /nologo @CMakeFiles\LLVM-C.rsp /out:bin\LLVM-C.dll /implib:lib\LLVM-C.lib /pdb:bin\LLVM-C.pdb /dll /version:0.0 /machine:x64 /debug /INCREMENTAL /DEF:D:/Modding/llvm-project/llvm/llvmTesting/tools/llvm-shlib/LLVM-C.def /MANIFEST /MANIFESTFILE:tools\llvm-shlib\CMakeFiles\LLVM-C.dir/intermediate.manifest tools\llvm-shlib\CMakeFiles\LLVM-C.dir/manifest.res" failed (exit code 1) with the following output:
lld-link: error: undefined symbol: class llvm::Target llvm::TheCBackendTarget
>>> referenced by D:\Modding\llvm-project\llvm\projects\llvm-cbe\lib\Target\CBackend\CBackend.cpp:76
>>>               LLVMCBackendCodeGen.lib(CBackend.cpp.obj):(LLVMInitializeCBackendTarget)
ninja: build stopped: subcommand failed.

the important part is error: undefined symbol: class llvm::Target llvm::TheCBackendTarget

I havent yet figured out a fix for the issue but i am documenting it here for now

jfm535 commented 3 years ago

I have found a quickfix but it probably breaks other versions of llvm which is `commenting out line 75.