mstorsjo / llvm-mingw

An LLVM/Clang/LLD based mingw-w64 toolchain
Other
1.75k stars 176 forks source link

Installation #417

Open tzargar8 opened 3 months ago

tzargar8 commented 3 months ago

This is going to look stupid, but still; your readme says: "The GitHub Releases page contains prebuilt toolchains that can be downloaded and installed by just unpacking them". Did you maybe forget something? That doesn't "install" anything, maybe I should have some environment variable pointing to one of those executables also or something? But there's tons of them.

longnguyen2004 commented 3 months ago

Probably just mean "ready to use after extracting". Users are expected to know how to setup environment variables and the like.

Andarwinux commented 3 months ago

All you need to do is append llvm-mingw/bin to the top of $PATH, that's all.

tzargar8 commented 3 months ago

Seems that _MSC_VER isn't defined?

Andarwinux commented 3 months ago

It's mingw toolchain, and _MSC_VER is a macro specific to msvc toolchain. If you need msvc build environment then you should consider https://github.com/mstorsjo/msvc-wine

tzargar8 commented 3 months ago

I see, I switched to MSVC and no problem. But it's a weird thing MSVC automatically outputs .lib .ilk etc. which was the only problem I had with this llvm-mingw, do you happen to know why?

Andarwinux commented 3 months ago

This is one of the differences between MSVC and GNU. The .lib is MSVC style static or import library, while GNU style is .a. The format of these libraries is compatible, so the import library is also compatible, but the static library is not, because the ABI is different between the two.

tzargar8 commented 3 months ago

I see. So the _MSC_VER not being defined was the problem since it switched between declspec(dllexport) and attribute__((visibility("default"))), out of which the dllexport apparently has those files output automatically to conform to the stuff you said I guess.

It should work though if I added those files manually to the build output? Or bypassed the _MSC_VER in the defines.

longnguyen2004 commented 3 months ago

Seems like your code is currently dependent on MSVC. I'd advise you to refactor and use what's available on both compilers (example: use _WIN32 instead of _MSC_VER to check for Windows)