Compile Assimp on Windows with MinGW

Started by
9 comments, last by DejaimeNeto 10 years, 3 months ago

Hello. Im new here and this will be my first post. Im struggling myself trying to build assimp on windows. I dont use Visual Studio. I work on Programmers Notepad with MinGW installed and i compile source files through command line with g++. Im learning OpenGL and SDL and i need assimp to import 3D scenes. But i cant get it to work. I downloaded the full package. I have searched through the internet and all they talk is about how to get it compiled under Visual Studio. I dont want to do that. I want to compile libraries under MinGW and use them as SDL for example.

If anyone wants to help please be more specific. I want to compile assimp on windows under MinGW.

Advertisement

If you want to use a notepad to program, you'll have to link everything yourself with your compiler.

Are you using CMake?

Im already doing that. Like g++ main.cpp -o text.exe -lmingw32 -lSDLmain -lSDL -lopengl32 -lglu32 and im fine with these. I just dont want to use Visual Studios compiler and i dont feel comfortable with CodeBlocks syntax highlighting. I just dont know how to get assimp libraries build. CMake gui complains about stuff like Directx SDK which i dont know why ? Should i download the SDK and try it again. Why there are no precompiled libraries like SDL for example ?

You'd need to install (or link) all the dependencies of the library you are trying to build. But iirc the only dependency assimp has is boost, that is relatively trickier to set-up, and huge.

I don't recall DirectX being a dependency...

Usually, precompiled binaries are available for most libraries that are are under heavy use by beginners. If it is a complex library, it is assumed that whoever will use it will be able to build it using an automatic tool such as CMake or Premake4, given it is (usually) a simple process. This is due to the fact that on some cases there is no one size fits all build, and it makes it harder to provide precompiled versions.

The weird thing about assimp is that they provide prebuilt binaries for microsoft's compiler but not for MinGW...

Static lib for Visual Studio will work for MinGW as well, you can simply rename them from .lib to .a

I always do that and it works

Turns out the assimp library is not dependent on DirectX, but its tools are.
This is weird, since it means it is not portable. The library is, but its tools aren't. That makes absolutely no sense to me.

Why there are no precompiled libraries like SDL for example ?

I usually don't do this kind of thing but I'll provide you with a compiled copy for MinGW.
Notice that I am only doing this since assimp compile process asks for DirectX by default, what's really misleading. To be fair, their cmake solution overall is not the best I've seen. In addition, boost is trickier to build, there's no magic CMake files there...

I won't include its tools since I don't have DirectX installed, nor plan on installing. I only use OpenGL.

Precompiled binaries of assimp.
This was compiles using:

  • MinGW 4.8.1
  • CMake 2.8.12
  • Boost 1.55.0

under Win7 x64, MinGW 4.8.1.

Updated Download link - https://www.mediafire.com/?xuc3i12wxfsxe8k, as in this post.

Still, I highly recommend that you avoid precompiled binaries. Building libraries is important to know.
The process in this case would be:

  • Download Boost and decompress it somewhere (c:/boost, for example)
  • In the terminal run:
    • cd <boost directory path>
    • bootstrap.bat mingw
    • b2 --with-filesystem --with-system --with-regex --with-program_options variant=debug,release toolset=gcc link=shared -j 7
  • Now open CMake and insert your assimp root folder on the first text box (that reads Where is the code)
  • Select where you want to build the binaries, you may use the same as above or add a /build suffix, your choice (reads Where to build the binaries)
  • Press the Add Entry button, just under the above text boxes
  • Add a variable called BOOST_ROOT with the type Path and insert your boost directory in the value.
  • Hit the configure button (it will prompt a configuration warning in red, check the subitems).
    • If you want to build the assimp tools (and have the DirectX SDK installed) you may need to update the directx sdk directories.
    • If you do not want to build the tools, uncheck the option BUILD_ASSIMP_TOOLS
    • If you want the build to be a static version (no need for a dll), check the option BUILD_STATIC_LIB, if not leave it unchecked.
  • Hit the configure button again.
  • Hit generate.

Now you have prepared the files necessary to compile it. Now through the terminal just go to the folder (the path you inserted on Where to build the binaries) and issue the mingw32-make command.

As an output, you should have two files:

  • libassimp.dll (probably under the bin directory)
  • libassimp.dll.a (probably under the lib directory)

This is for the shared build. I guess the static build would be libassimp.a, but I am guessing.

I usually don't do this kind of thing but I'll provide you with a compiled copy for MinGW.

I am a beginner. And i want to learn things and do some cool stuff with it.

So i hate it when i waste my time trying to put the wheels together just because someone else was just too lazy to do that. I would rather like to

get in and learn to drive. Thats the point. Anyway thank you very much for taking your time to help and providing me with the precompiled binaries.

As I stated before, in C++ we have some situations where there isn't a "one size fits all" solution.

This one could have precompiled binaries, I agree. But "Putting the wheels together" is a part of what one should learn when using C++.

I'd consider this a part of the learning process and not a waste of time.

Still, I should mention that C++ has its advantages, but this is one of the many drawbacks. If this is really important to you, I'd recommend looking up C#, or other languages.

(PS: I accidentally downvoted you when I wanted to upvote, so I upvoted you twice to undo it)

As an output, you should have two files:

  1. code / libassimp.dll
  2. code / libassimp.dll.a

This is for the shared build. I guess the static build would be code/libassimp.a, but I am guessing.

i could use it too (the same situation i got mingw, i am not learned to do such complex compiles, also limited internet connections to downloads <100MB )

but why is this so big? libassimp.dll 27MB, libassimp.dll.a 45 MB ??


Still, I should mention that C++ has its advantages, but this is one of the many drawbacks. If this is really important to you, I'd recommend looking up C#, or other languages.

No i love C++. I love to be in low level. And with putting the wheels together i meant wasting my time trying to build those binaries and trying to link up things to work together. I would rather like to just learn assimp and its core. I know that linking up things with your project and making them work as whole is a thing that every programmer should know how to do it. But its just i was too frustrated. I will care about such details when i see myself good enough to handle big projects. I love C++ and im glad there are still people that contribute and extend our capabilities by developing libraries like assimp for example.

And i dont have any idea why those files are so big ? Maybe some paramethers, flags before compiling could help i dont know.

This topic is closed to new replies.

Advertisement