nigels-com / glew

The OpenGL Extension Wrangler Library
Other
2.58k stars 608 forks source link

Building with MinGW LLVM: "unknown argument: -nostdlib, -soname" #410

Open ariankordi opened 2 months ago

ariankordi commented 2 months ago

I'm trying to build for Windows ARM64 from Linux and this LLVM MinGW toolchain I got from https://github.com/mstorsjo/llvm-mingw seems to be the best choice.

However, I've tried on and off to build this, even with the x86_64 version, and it keeps showing me this (I've tried versions going back to 2018 and it shows the same thing):

arian@debian /d/s/glew (master)> PATH=/dev/shm/llvm-mingw-20240417-ucrt-ubuntu-20.04-x86_64/bin/:$PATH SYSTEM=linux-mingw64 make
mkdir lib
x86_64-w64-mingw32-gcc -DGLEW_NO_GLU -DGLEW_BUILD -O2 -Wall -W -Iinclude -fno-builtin -fno-stack-protector -Wno-cast-function-type  -o tmp/linux-mingw64/default/shared/glew.o -c src/glew.c
x86_64-w64-mingw32-ld -nostdlib -shared -soname libglew32.dll --out-implib lib/libglew32.dll.a     -o lib/glew32.dll tmp/linux-mingw64/default/shared/glew.o  -L/usr/x86_64-w64-mingw32/lib -lopengl32 -lgdi32 -luser32 -lkernel32 
lld: error: unknown argument: -nostdlib
lld: error: unknown argument: -soname
make: *** [Makefile:123: lib/glew32.dll] Error 1

If I remove -nostdlib and -soname, it shows me this:

arian@debian /d/s/glew (master)> PATH=/dev/shm/llvm-mingw-20240417-ucrt-ubuntu-20.04-x86_64/bin/:$PATH SYSTEM=linux-mingw64 make
x86_64-w64-mingw32-ld -shared --out-implib lib/libglew32.dll.a     -o lib/glew32.dll tmp/linux-mingw64/default/shared/glew.o  -L/usr/x86_64-w64-mingw32/lib -lopengl32 -lgdi32 -luser32 -lkernel32 
ld.lld: error: <root>: undefined symbol: _DllMainCRTStartup
make: *** [Makefile:123: lib/glew32.dll] Error 1

I know that the linux-mingw64 config assumes GCC and this is probably clang, but I'm not sure what modifications to make.