I'm on Manjaro Linux. I'm trying to crossbuild my C application for Windows. I have installed the mingw-w64 build environment, and built assimp 5.0.1 using the AUR package mingw-w64-assimp (PKGBUILD). Assimp builds and installs without errors.
I can compile my application's C translation units using the assimp headers with no errors or warnings, too. However, when I try to link it, ld can't seem to find any of the assimp entry points I use.
Linking command and output:
x86_64-w64-mingw32-cc -o target/x86_64-w64-mingw32/shadowclad.exe <compiled C objects omitted> -L/usr/x86_64-w64-mingw32/lib -lopengl32 -lglew32 -lfreeglut -lassimp
/usr/lib/gcc/x86_64-w64-mingw32/10.1.0/../../../../x86_64-w64-mingw32/bin/ld: target/x86_64-w64-mingw32/src/engine/asset.c.o: in function `importSolid':
/home/outfrost/Code/Projects/shadowclad/src/engine/asset.c:94: undefined reference to `aiGetMaterialTexture'
/usr/lib/gcc/x86_64-w64-mingw32/10.1.0/../../../../x86_64-w64-mingw32/bin/ld: /home/outfrost/Code/Projects/shadowclad/src/engine/asset.c:128: undefined reference to `aiReleaseImport'
/usr/lib/gcc/x86_64-w64-mingw32/10.1.0/../../../../x86_64-w64-mingw32/bin/ld: target/x86_64-w64-mingw32/src/engine/asset.c.o: in function `importScene':
/home/outfrost/Code/Projects/shadowclad/src/engine/asset.c:133: undefined reference to `aiImportFile'
/usr/lib/gcc/x86_64-w64-mingw32/10.1.0/../../../../x86_64-w64-mingw32/bin/ld: /home/outfrost/Code/Projects/shadowclad/src/engine/asset.c:136: undefined reference to `aiReleaseImport'
collect2: error: ld returned 1 exit status
Compiler: x86_64-w64-mingw32-cc (GCC) 10.1.0
I have tried:
-L library path to /usr/x86_64-w64-mingw32/bin, or both at once;dll, dll.a, or both at once, instead of -lassimp;mingw-w64-assimp PKGBUILD, rebuilding and reinstalling the library;#ifndef ASSIMP_BUILD_NO_EXPORT in include/assimp/material.inl, and I wasn't getting errors about ::strlen being undefined.When I package assimp with the stripping commands enabled, strings doesn't find any occurrences of aiImportFile et al. in the resulting assimp.dll.
Largely the same application code compiles, links, and runs without issue in a native build configuration. The changes I've made are the names of libraries to link (originally -lGL -lGLEW -lglut -lassimp), and a few OpenGL, freeglut and GLEW header includes and defines, to make them work under mingw-w64.
Could this be an issue in assimp? If I've missed anything, I would greatly appreciate any help.
Does anyone have any tips about this?
Just started to install mingw32 again.
Just to get it right. You are crosscompiling the libs for windows on linux, right?
I tried on my windows 10 64bit PC and got same problem.
Just to get it right. You are crosscompiling the libs for windows on linux, right?
Yes. Host is Linux x86-64, target is Windows x86-64.
Shall work now! https://github.com/assimp/assimp/pull/3314 closed the issue and I doublechecked it on Windows 10.
Can confirm this issue is fixed as of ac8a8a5ad433afd2a10124774685f9db1edbe701 :)
Most helpful comment
Shall work now! https://github.com/assimp/assimp/pull/3314 closed the issue and I doublechecked it on Windows 10.