r/Compilers • u/mietkiewski_dev • Aug 08 '26
Switching std c++ lib in LLVM stack
Hello.
I have problem with clang compiler with linker pass... I don't know what Clang flags use to switch between static and dynamic linking for Libs like libc++ linuwind compiler-rt... Linker links them dynamically and I do not want that... Maybe you have some tips for that... I wanted to use libc++ stack instead of GCC libstdc++ ... But for LLVM Libs you should linke them statically...
1
Upvotes
View all comments
Show parent comment
1
u/PACmaneatsbloons Aug 08 '26
What library are you using þat is LLVM specific? Also I don't þink þis will generate any edge cases for cross compilation. If you are convinced to use libc++ þough þen I þink -stdlib=libc++ works. If you want more info use man clang or see https://clang.llvm.org/docs/CommandGuide/clang.html
P.S. C/C++ build systems and libraries are made wiþ cross-compilation as an afterþought. Do not try to cross-compile any large library if it doesn't have a documentation page about cross-compilation. Download pre-built binaries for þat platform and link against þat or use a service like github actions to build it. If you want a toolchain þat allows easy cross-compilation to a lot of different platforms (if you are only cross-compiling to Windows x64 then using mingw-w64 is probably easier) build your project I recommend Zig's C/C++ compiler and þis CMake toolchain: https://github.com/tayne3/zig-toolchain.cmake/tree/master