0

I am trying to build Assimp with Code::Blocks and MinGW as a static library. I have downloaded the latest available version (5.0.1) and created a makefile for Code::Blocks using cmake-gui. I am able to open that file with Code::Blocks, but when I am trying to build it fails. Here is the complete log:

-------------- Build: all in Assimp (compiler: GNU GCC Compiler)---------------

Checking if target is up-to-date: mingw32-make.exe -q -f Makefile all
Running command: C:/PROGRA~2/CODEBL~1/MinGW/bin/mingw32-make.exe -f "C:/Users/.../assimp-5.0.1/build/Makefile" VERBOSE=1 all
"C:\Users\...\cmake-3.22.1-windows-i386\bin\cmake.exe" -S"C:\Users\...\assimp-5.0.1" -B"C:\Users\...\assimp-5.0.1\build" --check-build-system CMakeFiles\Makefile.cmake 0
Re-run cmake file: Makefile older than: C:/Users/.../cmake-3.22.1-windows-i386/share/cmake-3.22/Modules/CMakeCInformation.cmake
-- Shared libraries disabled
-- Looking for DirectX...
-- DirectX_PREFIX_PATH changed.
-- Found DirectX: C:/Program Files (x86)/CodeBlocks/MinGW/lib/libd3d9.a
-- DX lib dir: C:/Program Files (x86)/CodeBlocks/MinGW/lib
-- Looking for ZLIB...
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Could not locate ZLIB
-- compiling zlib from sources
CMake Deprecation Warning at contrib/zlib/CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
CMake Warning (dev) at C:/Users/.../cmake-3.22.1-windows-i386/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (rt) does
not match the name of the calling package (RT). This can lead to problems
in calling code that expects `find_package` result variables (e.g.,
`_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
cmake-modules/FindRT.cmake:19 (find_package_handle_standard_args)
code/CMakeLists.txt:1013 (FIND_PACKAGE)
This warning is for project developers. Use -Wno-dev to suppress it.
INFO Hunter enabled or RT-extension not found. glTF import/export will be built without Open3DGC-compression.
-- Could NOT find rt (missing: RT_LIBRARY)
-- Enabled importer formats: AMF 3DS AC ASE ASSBIN B3D BVH COLLADA DXF CSM HMP IRRMESH IRR LWO LWS MD2 MD3 MD5 MDC MDL NFF NDO OFF OBJ OGRE OPENGEX PLY MS3D COB BLEND IFC XGL FBX Q3D Q3BSP RAW SIB SMD STL TERRAGEN 3D X X3D GLTF 3MF MMD STEP
-- Disabled importer formats:
-- Enabled exporter formats: 3DS ASSBIN ASSXML COLLADA OBJ OPENGEX PLY FBX STL X X3D GLTF 3MF ASSJSON STEP
-- Disabled exporter formats:
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/.../assimp-5.0.1/build
"C:\Users\...\cmake-3.22.1-windows-i386\bin\cmake.exe" -E cmake_progress_start "C:\Users\...\assimp-5.0.1\build\CMakeFiles" "C:\Users\...\assimp-5.0.1\build\\CMakeFiles\progress.marks"
C:/PROGRA~2/CODEBL~1/MinGW/bin/mingw32-make.exe -f CMakeFiles\Makefile2 all
mingw32-make.exe[1]: Entering directory 'C:/Users/.../assimp-5.0.1/build'
C:/PROGRA~2/CODEBL~1/MinGW/bin/mingw32-make.exe -f contrib\zlib\CMakeFiles\zlib.dir\build.make contrib/zlib/CMakeFiles/zlib.dir/depend
mingw32-make.exe[2]: Entering directory 'C:/Users/.../assimp-5.0.1/build'
[ 1%] Generating zlib1rc.obj
cd /d C:\Users\...\ASSIMP~1.1\build\contrib\zlib && "C:\Program Files (x86)\CodeBlocks\MinGW\bin\windres.exe" -D GCC_WINDRES -I "C:/Users/.../assimp-5.0.1/contrib/zlib" -I "C:/Users/.../assimp-5.0.1/build/contrib/zlib" -o "C:/Users/.../assimp-5.0.1/build/contrib/zlib/zlib1rc.obj" -i "C:/Users/.../assimp-5.0.1/contrib/zlib/win32/zlib1.rc"
Der Befehl "C:\Program" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
C:\Program Files (x86)\CodeBlocks\MinGW\bin\windres.exe: preprocessing failed.
mingw32-make.exe[2]: *** [contrib/zlib/zlib1rc.obj] Error 1
mingw32-make.exe[1]: *** [contrib/zlib/CMakeFiles/zlib.dir/all] Error 2
mingw32-make.exe: *** [all] Error 2
contrib\zlib\CMakeFiles\zlib.dir\build.make:72: recipe for target 'contrib/zlib/zlib1rc.obj' failed
mingw32-make.exe[2]: Leaving directory 'C:/Users/.../assimp-5.0.1/build'
CMakeFiles\Makefile2:176: recipe for target 'contrib/zlib/CMakeFiles/zlib.dir/all' failed
mingw32-make.exe[1]: Leaving directory 'C:/Users/.../assimp-5.0.1/build'
C:/Users/.../assimp-5.0.1/build/Makefile:134: recipe for target 'all' failed
Process terminated with status 2 (0 minute(s), 11 second(s))
4 error(s), 0 warning(s) (0 minute(s), 11 second(s))

I am not really familiar with all that build stuff, but it looks like there is some problem with zlib. How can I fix that problem and build the library with the compiler I have?

I don’t want to switch to MSYS2.

After I switched to Assimp version 5.1.6, it became even worth it. CMake is not able to generate the makefile:

Enter image description here

Possibly this could be the reason:

Enter image description here

But I don't have any idea about all that makefile stuff.

I even moved to version 3.0, which still not working with CMake. At least that version has a way around that annoying CMake. There is a Visual Studio project which I was able to open and select the noboost version like this:

Enter image description here

But even with that selection, I got many errors about Boost. But there are some error messages not related to Boost which make no sense for me:

C:\...\assimp--3.0.1270-source-only\code\StringComparison.h||In function 'int Assimp::ASSIMP_stricmp(const char*, const char*)':|
C:\...\assimp--3.0.1270-source-only\code\StringComparison.h|137|error: '::strcasecmp' has not been declared|
C:\...\assimp--3.0.1270-source-only\code\StringComparison.h||In function 'int Assimp::ASSIMP_strincmp(const char*, const char*, unsigned int)':|
C:\...\assimp--3.0.1270-source-only\code\StringComparison.h|186|error: '::strncasecmp' has not been declared|

Both strcasecmp and strncasecmp are from string.h, but including string.h didn’t change anything.

As can be seen here, I am not the only one with this problem. So the solutions from that question worked for strcasecmp and strncasecmp, but there are still a lot of errors because of that annoying Boost.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
convert
  • 1
  • 1
  • 3
  • 14
  • You may want to just switch to use msys2 to provide your mingw and install Assimp via the msys2 package management. Then modify your Code::Blocks settings to use the MinGW that msys2 installed. [https://www.msys2.org/](https://www.msys2.org/) – drescherjm Jan 06 '22 at 22:01
  • In some other thread have already got the same advice, this is the reason I explicitly wrote that I want to use the compiler I have. Sorry had to make it more clear in my question. – convert Jan 06 '22 at 22:07
  • ***Der Befehl "C:\Program" ist entweder falsch geschrieben oder konnte nicht gefunden werden.*** I don't understand the language but the "C:\Program" looks concerning in that it does not look like its handling the space in the path between Program and Files – drescherjm Jan 06 '22 at 22:10
  • ***In some other thread have already got the same advice*** That is because the msys2 solution is much simpler. However I can fully understand if you are forced to use what you have. – drescherjm Jan 06 '22 at 22:13
  • 1
    Here the translation: The command "C: \ Program" is either misspelled or could not be found. C:/Program Files (x86)/CodeBlocks/MinGW/lib/libd3d9.a seemd to be no problem, so why this one? – convert Jan 06 '22 at 22:22
  • I can't tell from the output because `"C:\Program Files (x86)\CodeBlocks\MinGW\bin\windres.exe"` appears to be properly quoted. – drescherjm Jan 06 '22 at 22:46
  • At least don´t think it´s a problem with the spaces. – convert Jan 06 '22 at 22:56
  • Posibly -I "C:/Users/.../assimp-5.0.1/build/contrib/zlib" makes problems, to be more precise -I. At least I´ve read it somewhere. – convert Jan 06 '22 at 23:01
  • 1
    Looks like very similar error was mentioned here: https://stackoverflow.com/questions/57092128/cmake-not-generating-assimp-solutions-properly-windows-10. Unfortunatelly still not fixed. – convert Jan 08 '22 at 20:52
  • Have you tried setting `CMAKE_CODEBLOCKS_EXECUTABLE` to the full path of `codeblocks.exe`? You may also want to try using slashes instead of backslashes. – Brecht Sanders Jan 12 '22 at 10:53
  • @Brecht Sanders No have not triead to set any path manually. So it should be something like "C:\Program Files (x86)\CodeBlocks\codeblocks.exe", right? – convert Jan 12 '22 at 11:34
  • Yes, and if that doesn't work replace \ with / – Brecht Sanders Jan 12 '22 at 12:00
  • Tried both \ and / but still the same error as befor. – convert Jan 12 '22 at 12:28
  • @Brecht Sanders Just to avoid posible misunderstanding, you was talking about that flag I marked on the pic, right? – convert Jan 12 '22 at 13:51
  • Yes, variable `CMAKE_CODEBLOCKS_EXECUTABLE` – Brecht Sanders Jan 12 '22 at 13:56
  • @Brecht Sanders Was not the reason for the error. – convert Jan 12 '22 at 18:21
  • Try to set `CMAKE_INSTALL_PREFIX` to something without spaces or special characters (e.g. `C:\Temp`) – Brecht Sanders Jan 12 '22 at 18:54
  • @Brecht Sanders No, that has also changed nothing. I changed CMAKE_INSTALL_PREFIX to C:\Assimp. – convert Jan 12 '22 at 20:48
  • Do you still have MinGW installed in a location with spaces? If you still have it in `C:\Program Files (x86)\CodeBlocks\MinGW` you need to fix that. Note that MinGW-w64 is much newer. On https://winlibs.com/ there is an explanation on how to point Code::Blocks to it. – Brecht Sanders Jan 13 '22 at 15:56
  • @Brecht Sanders Yes I have it still in the same place. It was instaled with CodeBlocks. So shuld I copy the complete MinGW folder just to C:/? Would really like to build the API with CodeBlocks and not only MinGW, realy hate to use comandline. – convert Jan 13 '22 at 19:27
  • Is there a reason you want to keep your current compiler? You understand that MSYS2 ships the same compiler you already have, just a newer version? – HolyBlackCat Jan 15 '22 at 09:20
  • @HolyBlackCat We have tallked about it in the other thread already. The main reason is my strong aversion against online instalers. – convert Jan 15 '22 at 12:43
  • Is that all? Being honest, that's a rather weak reason. It's going to prevent you from using many useful tools. :/ As I already told you, you can install it on a machine with an internet connection, install the packages you want, then make an archive from your installation. The resulting archive can be installed completely offline. Which isn't much different than installing CB offline? – HolyBlackCat Jan 15 '22 at 13:04
  • @HolyBlackCat Why should it be weak reason? Just let along the fact that is really complicated. What if I can´t instal anithing on a machine with an internet connection? The machine can also have a complete diferent OS, making the instalation useles. I could think of some other reasons, but this is not the right place for such discusion. – convert Jan 15 '22 at 13:11
  • @convert Do you actually have this problem (no Windows machine with internet connection)? If yes, then we might be able to suggest workarounds if you give us more details (e.g. it should be possible to install MSYS2 offline, manually download the packages and transfer them to the target machine). But if not, and you're worrying about it "just in case", then (I'll be frank) I suggest to rethink your reasoning. Good C++ tooling is already hard to come by, and it becomes prohibitevely hard if you impose arbitrary restrictions upon the tools you choose. – HolyBlackCat Jan 15 '22 at 13:26
  • At the moment it´s even more complicated. Like already mentioned no posibility to instal online. And posibly a biger problem, at the moment I am on XP machine as my 7 one is not working properly animore. – convert Jan 15 '22 at 13:57
  • XP is going to be problematic. I'm not sure if MSYS2 even supports it. I suggest installed a newer OS. If your machine can't handle Win 10, then a lightweight Linux distribution could work (Xubuntu?). – HolyBlackCat Jan 15 '22 at 13:59
  • @HolyBlackCat I am Windows user and want to compile for Windows including even XP, so any Linux distribution is not a solution. Looking forword to use ReactOS, once it become a working OS. – convert Jan 15 '22 at 14:08
  • It's possible to cross-compile from Linux to Windows (and I've been successfully doing it, using a [MSYS2-based tool](https://github.com/HolyBlackCat/quasi-msys2) that I made). ReactOS uses code from Wine, so most apps you could run on ReactOS, you could also run on Linux using Wine (including the ones you compile yourself). As for Win XP... You don't want to support it. Numerous libraries drop XP support, so you'll be forced to use outdated versions, that may or may not contain known vulnerabilities. – HolyBlackCat Jan 15 '22 at 14:34
  • @HolyBlackCat Not going to use Linux. – convert Jan 15 '22 at 14:45
  • @HolyBlackCat What you mean by outdated versions? Version 4.1.0 is outdated, but it seems to have all the features I need so I could live with it. As long the version is not using C++17 or newer should be no real problems with compiler. – convert Jan 15 '22 at 18:59
  • I meant libraries in general, not specifically assimp. Btw, I looked it up, and MSYS2 dropped XP support in 2016. You can still download the installer from 2016. It wouldn't be able to install any extra packages (so the installation is effectively offline), so I'm not sure how helpful it would be, but that would be my starting point anyway. – HolyBlackCat Jan 15 '22 at 19:15
  • @HolyBlackCat But that version of MSYS2 would be also outdated like my mingw and I gues it´ll have the same problems with building code using C++17. – convert Jan 15 '22 at 19:22

1 Answers1

0

The latest Assimp version at this time is 5.1.6, so it looks like you're a bit behind.

That version builds with Mingw-w64. I build it using CMake and Ninja. I use the following CMake flags:

-DASSIMP_BUILD_ASSIMP_TOOLS:BOOL=ON -DASSIMP_HEADERCHECK:BOOL=OFF -DASSIMP_OPT_BUILD_PACKAGES:BOOL=OFF -DSYSTEM_IRRXML:BOOL=OFF -DASSIMP_BUILD_SAMPLES:BOOL=OFF -DBUILD_DOCS:BOOL=OFF -DASSIMP_BUILD_TESTS:BOOL=OFF -DCMAKE_CXX_FLAGS:STRING="-Wno-array-bounds -Wno-alloc-size-larger-than -Wno-error=array-compare"

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Brecht Sanders
  • 6,215
  • 1
  • 16
  • 40
  • I need 32 bit version of assimp. – convert Jan 11 '22 at 20:01
  • You can build it as mentioned above with 32-bit MinGW-w64. – Brecht Sanders Jan 11 '22 at 20:06
  • More then a week ago, when I downloaded it, 5.0.1 was the actual version, even when I started this thread it still was. Thanks for the link to the latest version. That flags I can also set in the gui of cmake, right? – convert Jan 11 '22 at 20:16
  • What that DCMAKE_CXX_FLAGS stands for? – convert Jan 11 '22 at 20:27
  • Those `CMAKE_CXX_FLAGS` were for getting arround issues with recent gcc versions. If you're using an older gcc version you may not need them. – Brecht Sanders Jan 11 '22 at 22:33
  • Using older version, posibly even to old. – convert Jan 11 '22 at 22:36
  • Also looking like cmake has problems with that 5.1.6 version, as can be seen in my first post. – convert Jan 11 '22 at 23:32
  • Have you considered using new versions (CMake, MinGW-w64, MSYS2)? – Brecht Sanders Jan 13 '22 at 20:26
  • Have you read my very first post? I explicitly said that I want to keep my compiler and defenetly not wiling to use that MSYS2. I really don´t see any reason why an open sorce API should not work with my compiler. Have build a lot of stuff with that compiler without problems. – convert Jan 13 '22 at 20:32
  • OK looks likeyou a right, in the log of cmake gui I´ve read something like mingw version not suported. Is there some older Assimp version which suports mingw? I just need the import functionality at the first place, also some export stuff, but the rest is not realy interesting for me. – convert Jan 14 '22 at 13:27
  • So I tried version 4.1.0 which should be old enought to suport my compiler, but got exactly the same error log as in my first post. Changing that zlib flag also didn´t change nothing. – convert Jan 14 '22 at 15:01
  • Even Assimp version 3.0 not working with that cmake. But 3.0 has Visual Studio makefile, which makes it much easier to build. Unfortunatelly 3.0 has some isues with that anoing boost API. – convert Jan 14 '22 at 18:25
  • See no reason to swich to other compiler jus because the creators of this API are so incompetent to write working code. I am not the only one having problems with building the API. – convert Jan 31 '22 at 18:53