mingw-w64assimp

building assimp using MinGW64


I am trying to build assimp-5.0.0 using MinGW64. CMake CMakeLists.txt -G"MinGW Makefiles" ran without issues. But when I call mingw32-make, I get the following issue at

[ 73%] Linking CXX executable ..\..\bin\assimp.exe:

CMakeFiles\assimp_cmd.dir/objects.a(Main.cpp.obj):Main.cpp:(.text+0x8d): undefined reference to Assimp::Importer::ValidateFlags(unsigned int) const

CMakeFiles\assimp_cmd.dir/objects.a(Main.cpp.obj):Main.cpp:(.text+0xc4): undefined reference to Assimp::Importer::ReadFile(char const*, unsigned int)

...

CMakeFiles\assimp_cmd.dir/objects.a(Export.cpp.obj):Export.cpp:(.text+0xf44): undefined reference to `Assimp::Exporter::GetExportFormatDescription(unsigned long long) const'

collect2.exe: error: ld returned 1 exit status

mingw32-make[2]: *** [tools\assimp_cmd\CMakeFiles\assimp_cmd.dir\build.make:195: bin/assimp.exe] Error 1

mingw32-make[1]: *** [CMakeFiles\Makefile2:337: tools/assimp_cmd/CMakeFiles/assimp_cmd.dir/all] Error 2

mingw32-make: *** [Makefile:135: all] Error 2

I have found a github thread with the same issue here https://github.com/assimp/assimp/issues/2431 and the creator says it is fixed... but it doesn't seem that way. Any idea on how to fix it?


Solution

  • When building assimp 5.0.1 with MinGW-w64 I noticed there were some dllexport/dllimport issues.

    In my case they were resolved by this patch:

    patch -ulbf include/assimp/defs.h << EOF
    @@ -128,3 +128,3 @@
    
    -#ifdef _MSC_VER
    +#ifdef _WIN32
     #   undef ASSIMP_API
    EOF