missing lib triples folder structure and files for runtimes
seandunaway opened this issue · 8 comments
i'm having to symlink my triples in ./lib/clang/19/lib
to link successfully
lld-link: error: could not open '/Users/sean/src/winmake/llvm/lib/clang/19/lib/aarch64-pc-windows-msvc/clang_rt.builtins.lib': No such file or directory
cd $@/lib/clang/19/lib && ln -s windows aarch64-pc-windows-msvc
cd $@/lib/clang/19/lib && ln -s windows x86_64-pc-windows-msvc
and then i have to re-symlink the builtins to the appropriate arch
%_a64.exe: %.c
cd $(winmake)llvm/lib/clang/19/lib/windows && ln -sf libclang_rt.builtins-aarch64.a clang_rt.builtins.lib
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
%_x64.exe: %.c
cd $(winmake)llvm/lib/clang/19/lib/windows && ln -sf libclang_rt.builtins-x86_64.a clang_rt.builtins.lib
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
% CFLAGS=-v make
cd /Users/sean/src/winmake/llvm/lib/clang/19/lib/windows && ln -sf libclang_rt.builtins-aarch64.a clang_rt.builtins.lib
/Users/sean/src/winmake/llvm/bin/aarch64-w64-mingw32-clang -v -target aarch64-pc-windows-msvc -Os -Weverything -Wno-unused-parameter -isystem/Users/sean/src/winmake/xwin/splat/crt/include -isystem/Users/sean/src/winmake/xwin/splat/sdk/include -isystem/Users/sean/src/winmake/xwin/splat/sdk/include/cppwinrt -isystem/Users/sean/src/winmake/xwin/splat/sdk/include/ucrt -isystem/Users/sean/src/winmake/xwin/splat/sdk/include/shared -isystem/Users/sean/src/winmake/xwin/splat/sdk/include/um -isystem/Users/sean/src/winmake/xwin/splat/sdk/include/winrt -L/Users/sean/src/winmake/xwin/splat/crt/lib/aarch64 -L/Users/sean/src/winmake/xwin/splat/sdk/lib/aarch64 -L/Users/sean/src/winmake/xwin/splat/sdk/lib/ucrt/aarch64 -L/Users/sean/src/winmake/xwin/splat/sdk/lib/um/aarch64 -o example_a64.exe example.c -lkernel32 -luser32 -lgdi32
clang version 19.1.0-rc3 (https://github.com/llvm/llvm-project.git 437434df21d839becb453f6821564662e9824f02)
Target: aarch64-pc-windows-msvc
Thread model: posix
InstalledDir: /Users/sean/src/winmake/llvm/bin
"/Users/sean/src/winmake/llvm/bin/clang-19" -cc1 -triple aarch64-pc-windows-msvc19.33.0 -emit-obj -mincremental-linker-compatible -dumpdir example_a64.exe- -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name example.c -mrelocation-model pic -pic-level 2 -mframe-pointer=none -relaxed-aliasing -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu generic -target-feature +v8a -target-feature +fp-armv8 -target-feature +neon -target-abi aapcs -fdebug-compilation-dir=/Users/sean/src/winmake -target-linker-version 1053.12 -v -fcoverage-compilation-dir=/Users/sean/src/winmake -resource-dir /Users/sean/src/winmake/llvm/lib/clang/19 -isystem /Users/sean/src/winmake/xwin/splat/crt/include -isystem /Users/sean/src/winmake/xwin/splat/sdk/include -isystem /Users/sean/src/winmake/xwin/splat/sdk/include/cppwinrt -isystem /Users/sean/src/winmake/xwin/splat/sdk/include/ucrt -isystem /Users/sean/src/winmake/xwin/splat/sdk/include/shared -isystem /Users/sean/src/winmake/xwin/splat/sdk/include/um -isystem /Users/sean/src/winmake/xwin/splat/sdk/include/winrt -internal-isystem /Users/sean/src/winmake/llvm/lib/clang/19/include -Os -Weverything -Wno-unused-parameter -ferror-limit 19 -fno-use-cxa-atexit -fms-extensions -fms-compatibility -fms-compatibility-version=19.33 -fskip-odr-check-in-gmf -fdelayed-template-parsing -fcolor-diagnostics -vectorize-loops -vectorize-slp -faddrsig -o /var/folders/_z/w81n9b952kbc88vl3wrlckhh0000gn/T/example-743bfa.o -x c example.c
clang -cc1 version 19.1.0-rc3 based upon LLVM 19.1.0-rc3 default target arm64-apple-darwin22.6.0
#include "..." search starts here:
#include <...> search starts here:
/Users/sean/src/winmake/xwin/splat/crt/include
/Users/sean/src/winmake/xwin/splat/sdk/include
/Users/sean/src/winmake/xwin/splat/sdk/include/cppwinrt
/Users/sean/src/winmake/xwin/splat/sdk/include/ucrt
/Users/sean/src/winmake/xwin/splat/sdk/include/shared
/Users/sean/src/winmake/xwin/splat/sdk/include/um
/Users/sean/src/winmake/xwin/splat/sdk/include/winrt
/Users/sean/src/winmake/llvm/lib/clang/19/include
End of search list.
"/Users/sean/src/winmake/llvm/bin/lld-link" -out:example_a64.exe -defaultlib:libcmt -defaultlib:oldnames -libpath:lib/arm64 -libpath:atlmfc/lib/arm64 -libpath:/Users/sean/src/winmake/xwin/splat/crt/lib/aarch64 -libpath:/Users/sean/src/winmake/xwin/splat/sdk/lib/aarch64 -libpath:/Users/sean/src/winmake/xwin/splat/sdk/lib/ucrt/aarch64 -libpath:/Users/sean/src/winmake/xwin/splat/sdk/lib/um/aarch64 -libpath:/Users/sean/src/winmake/llvm/lib/clang/19/lib/aarch64-pc-windows-msvc -libpath:/Users/sean/src/winmake/llvm/lib/clang/19/lib/windows -nologo /Users/sean/src/winmake/llvm/lib/clang/19/lib/aarch64-pc-windows-msvc/clang_rt.builtins.lib /var/folders/_z/w81n9b952kbc88vl3wrlckhh0000gn/T/example-743bfa.o kernel32.lib user32.lib gdi32.lib
cd /Users/sean/src/winmake/llvm/lib/clang/19/lib/windows && ln -sf libclang_rt.builtins-x86_64.a clang_rt.builtins.lib
/Users/sean/src/winmake/llvm/bin/x86_64-w64-mingw32-clang -v -target x86_64-pc-windows-msvc -Os -Weverything -Wno-unused-parameter -isystem/Users/sean/src/winmake/xwin/splat/crt/include -isystem/Users/sean/src/winmake/xwin/splat/sdk/include -isystem/Users/sean/src/winmake/xwin/splat/sdk/include/cppwinrt -isystem/Users/sean/src/winmake/xwin/splat/sdk/include/ucrt -isystem/Users/sean/src/winmake/xwin/splat/sdk/include/shared -isystem/Users/sean/src/winmake/xwin/splat/sdk/include/um -isystem/Users/sean/src/winmake/xwin/splat/sdk/include/winrt -L/Users/sean/src/winmake/xwin/splat/crt/lib/x86_64 -L/Users/sean/src/winmake/xwin/splat/sdk/lib/x86_64 -L/Users/sean/src/winmake/xwin/splat/sdk/lib/ucrt/x86_64 -L/Users/sean/src/winmake/xwin/splat/sdk/lib/um/x86_64 -o example_x64.exe example.c -lkernel32 -luser32 -lgdi32
clang version 19.1.0-rc3 (https://github.com/llvm/llvm-project.git 437434df21d839becb453f6821564662e9824f02)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: /Users/sean/src/winmake/llvm/bin
"/Users/sean/src/winmake/llvm/bin/clang-19" -cc1 -triple x86_64-pc-windows-msvc19.33.0 -emit-obj -mincremental-linker-compatible -dumpdir example_x64.exe- -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name example.c -mrelocation-model pic -pic-level 2 -mframe-pointer=none -relaxed-aliasing -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -fdebug-compilation-dir=/Users/sean/src/winmake -target-linker-version 1053.12 -v -fcoverage-compilation-dir=/Users/sean/src/winmake -resource-dir /Users/sean/src/winmake/llvm/lib/clang/19 -isystem /Users/sean/src/winmake/xwin/splat/crt/include -isystem /Users/sean/src/winmake/xwin/splat/sdk/include -isystem /Users/sean/src/winmake/xwin/splat/sdk/include/cppwinrt -isystem /Users/sean/src/winmake/xwin/splat/sdk/include/ucrt -isystem /Users/sean/src/winmake/xwin/splat/sdk/include/shared -isystem /Users/sean/src/winmake/xwin/splat/sdk/include/um -isystem /Users/sean/src/winmake/xwin/splat/sdk/include/winrt -internal-isystem /Users/sean/src/winmake/llvm/lib/clang/19/include -Os -Weverything -Wno-unused-parameter -ferror-limit 19 -fno-use-cxa-atexit -fms-extensions -fms-compatibility -fms-compatibility-version=19.33 -fskip-odr-check-in-gmf -fdelayed-template-parsing -fcolor-diagnostics -vectorize-loops -vectorize-slp -faddrsig -o /var/folders/_z/w81n9b952kbc88vl3wrlckhh0000gn/T/example-c08c40.o -x c example.c
clang -cc1 version 19.1.0-rc3 based upon LLVM 19.1.0-rc3 default target arm64-apple-darwin22.6.0
#include "..." search starts here:
#include <...> search starts here:
/Users/sean/src/winmake/xwin/splat/crt/include
/Users/sean/src/winmake/xwin/splat/sdk/include
/Users/sean/src/winmake/xwin/splat/sdk/include/cppwinrt
/Users/sean/src/winmake/xwin/splat/sdk/include/ucrt
/Users/sean/src/winmake/xwin/splat/sdk/include/shared
/Users/sean/src/winmake/xwin/splat/sdk/include/um
/Users/sean/src/winmake/xwin/splat/sdk/include/winrt
/Users/sean/src/winmake/llvm/lib/clang/19/include
End of search list.
"/Users/sean/src/winmake/llvm/bin/lld-link" -out:example_x64.exe -defaultlib:libcmt -defaultlib:oldnames -libpath:lib/amd64 -libpath:atlmfc/lib/amd64 -libpath:/Users/sean/src/winmake/xwin/splat/crt/lib/x86_64 -libpath:/Users/sean/src/winmake/xwin/splat/sdk/lib/x86_64 -libpath:/Users/sean/src/winmake/xwin/splat/sdk/lib/ucrt/x86_64 -libpath:/Users/sean/src/winmake/xwin/splat/sdk/lib/um/x86_64 -libpath:/Users/sean/src/winmake/llvm/lib/clang/19/lib/x86_64-pc-windows-msvc -libpath:/Users/sean/src/winmake/llvm/lib/clang/19/lib/windows -nologo /Users/sean/src/winmake/llvm/lib/clang/19/lib/x86_64-pc-windows-msvc/clang_rt.builtins.lib /var/folders/_z/w81n9b952kbc88vl3wrlckhh0000gn/T/example-c08c40.o kernel32.lib user32.lib gdi32.lib
% uname -a
Darwin mbp.local 22.6.0 Darwin Kernel Version 22.6.0: Mon Apr 22 20:49:37 PDT 2024; root:xnu-8796.141.3.705.2~1/RELEASE_ARM64_T6000 arm64
You're using the wrong triple. aarch64-pc-windows-msvc19.33.0
will start clang in MSVC mode, while this toolchain is mingw-w64. Removing the -triple
flag should make it work again.
oh shoot thank you. i'm missing some fundamental understanding. would you please share how i might still set the architecture and windows platform so llvm still adds the appropriate defines to avoid endless errors like winnt.h:253:2: error: Must define a target architecture.
and vcruntime.h:96:20: error: expected ';' after top level declarator
which are not present when using the triple?
What are you trying to build? Either it's dependent on MSVC specific includes, or something really bad is happening and the header files are getting mixed up.
/Users/sean/src/winmake/xwin/splat/crt/include
/Users/sean/src/winmake/xwin/splat/sdk/include
/Users/sean/src/winmake/xwin/splat/sdk/include/cppwinrt
/Users/sean/src/winmake/xwin/splat/sdk/include/ucrt
/Users/sean/src/winmake/xwin/splat/sdk/include/shared
/Users/sean/src/winmake/xwin/splat/sdk/include/um
/Users/sean/src/winmake/xwin/splat/sdk/include/winrt
I see that you're using this toolchain with Windows SDK header files. This will not work for obvious reasons. You don't need the Windows SDK since this toolchain uses mingw-w64.
After some more research, I found out that you're probably using https://github.com/Jake-Shadle/xwin. If so, please don't mix the 2 toolchains, they're not designed to work together.
gosh, that really simplifies things and is working, haha. thank you!