OCC 6.5 compilation on MinGW/MSYS

Hello,

Did anyone succeed to compile OpenCascade v6.5 on MinGW/MSYS (without MS Visual installed) ?

I have tried with ./configure --build i386-pc-mingw32 --enable-shared=no --disable-debug --disable-vis --disable-draw --disable-wrappers --without-freetype --prefix=/usr

But MinGW does not provide some required libraries (dl and pthread are missing) ...

Paul Jimenez's picture

I got to compile part of OpenCASCADE 6.3.0 using MinGW (no MSYS). With part of it I mean only up to Visualization because I did not care about the rest.

I guess compiling 6.5.0 would not be that different. There are a few files that need some small patching, though.

I did it by converting the MSVC project files with Code::Blocks while using MinGW as compiler. Note, however, that OpenCASCADE uses per file settings (include directories and defines being the important pieces). You would need to add those settings to the Code::Blocks project (you can add them at the project level).

Once you have compiled all files, you will end up with another issue: you will not be able to link all of them. Some DLLs will be produced, some others will fail at this step. The reason is that Windows has a very short limitation in how long the parameters given to a command can be. Code::Blocks will try to call the linker with a huge number of file names, and quite long each one, hitting that limit.

It is possible to work around this issue by creating a special file that MinGW's linker can use instead where all the object files to be linked are specified. Another work around is to rename all object files so they have a short name, put them in the same folder, and hope you can manually link them. In both cases you will have to get dirty with the command line.

That fits the requirement of no MS VS installed, and even no MSYS.

heXus's picture

Perhaps you should try build system based on CMake from OCE project (see at http://www.opencascade.org/org/forum/thread_20467/). Previously I built OCC-6.3 with MinGW (http://www.opencascade.org/org/forum/thread_17909/).

Venugopal Gudimetla's picture

Hi Marc,
I was able to compile on cygwin, but there problems on cygwin side, which I am not sure if I can rectify, which I guess could also be in MinGW, the gethostent() function is not defined in libc which will make compilation abort. I made a hack and somewhere I read that I can assume it to be NULL as I won't do any networking stuff.

I will post my configuration flags. I also got pthread missing libraries warning/error, I got pthread lib from cygwin setup and configuration picked it in my 2nd or third try.

Right now, even though I was able to compile and link libraries, for some reason my executable still is not able to locate the libraries, even though my LD_LIBRARY_PATH is set to $CASROOT/lib. I should be able to solve it eventually in couple of days.