nigels-com / glew

The OpenGL Extension Wrangler Library
Other
2.64k stars 617 forks source link

[WINDOWS] Cannot link for ARM64. #309

Closed carlo-bramini closed 1 year ago

carlo-bramini commented 3 years ago

The ARM64 compiler fails to link GLEW on Windows for ARM64 with this message:

LINK : fatal error LNK1355: invalid base address 0x62AA0000; ARM64 image cannot have base address below 4GB

Actually, it does not seem to be a good idea to force a base address, especially for 64bit platforms and it is not clear to me why it exists since GNU and Clang for WIN32 don't do this change. So, I'm wondering if this line could be removed or at least commented:

https://github.com/nigels-com/glew/blob/80e061f85d2f92d8721959b1508accef50bb8e1c/build/cmake/CMakeLists.txt#L141

to make able VCPKG to build the library. Sincerely.

carlo-bramini commented 3 years ago

immagine

nigels-com commented 3 years ago

Ideally we can do that link flag for 32-bit builds only. Historically we'd go to that trouble to avoid the runtime overhead of DLLs having to relocate themselves. The idea was to pre-allocate the address space across the whole set of DLLs to optimise launch time.

I agree that it is not relevant for modern 64-bit or ARM binaries. But I'd lean towards continuing that binary level of compatibility for 32-bit builds.

matheusgomes28 commented 1 year ago

@nigels-com this is still an issue. Arm and 64-bit builds are more common than ever, I think it's worth implementing a CMake check for 32-bit around that base-force line.