OpenCascade on *BSD


I tried to build OpenCascade on FreeBSD 3.3 using GCC 2.95. I had to change some OS dependent stuff (mostly in OSD), but then compiling failed. It seems that OC isn't written in pure ANSI C++ (maybe I'm wrong, I'm not a programmer). Anyway, I decided that I won't be able to 'port' OC to BSD myself.

So I have a couple of questions. Will *BSDs be supported officially, like Linux, Solaris, or Win* ? Is it possible to build OC with GCC 2.95 ?

Tomas Furmonavicius

Régis Le Boité's picture


We have no plan to port Open CASCADE on FreeBSD. But I am surprised that the code does not compile correctly. Since Open CASCADE has already been ported on a lot of platforms including LINUX, the code is clean and is normally not far from ANSI.

In another hand, it seems to me that GCC on FreeBSD is not far from GCC on Linux. Perhaps you have found a particular issue. Can you explain a specific case ?

Has anobody else tried to port on FreeBSD ?

Régis Le Boité Open CASCADE webmaster

Tomas Furmonavicius's picture

Well, I've built OC on FreeBSD succesfully (more or less). I had to fix #include's and #ifdef's in OSD. I'm not a programmer, so I'm not sure that I did everything right. As OSD module manages all low level OS specific stuff, I'd like to see official port to BSD. Maybe some other BSD user with better knowledge than mine will do it.


Rao Garimella's picture

I tried to compile the Open Cascade source on a Solaris 2.6 system using the native sun compilers. The biggest problem is that much of the C code declarations are not ANSI compliant. For example, the file


has the following declaration


/* Subroutine */ int mma1fer_(ndimen, nbsesp, ndimse, iordre, ndgjac, crvjac,

ncflim, epsapr, ycvmax, errmax, errmoy, ncoeff, iercod)

integer *ndimen, *nbsesp, *ndimse, *iordre, *ndgjac;

doublereal *crvjac;

integer *ncflim;

doublereal *epsapr, *ycvmax, *errmax, *errmoy;

integer *ncoeff, *iercod; {


which is not ANSI compliant.

Most of the files converted using "f2c" seem to have this problem. I started to fix them one by one. Then I revisited the site and the saw that the publication plan includes a Solaris release on Jan 31. I figured I should wait until then and not duplicate work that others may already be doing.

Best Regards


Régis Le Boité's picture


You are right. Pure "c" code functions in Open CASCADE are not ANSI compliant. They use "Old Style C arguments". That means that when you write a function you should use the style:

myfunction ( a , b ) int a , b ; {...}

Instead of:

myfunction ( int a , int b ) { ... }

To compile this correctly, you must use a C compiler, but not a C++ compiler.

For your information, on Solaris we use the flags:

cc -K PIC -Usun -DSOLARIS -O2 -DNo_Exception +w -I... -c MA1CDI.c -o MA1CDI.o

And for C++:

CC -PIC -xchip=ultra -xarch=v8 -Usun -DSOLARIS -DNO_CXX_EXCEPTION -I... -vdelx -DCSFDB -O2 -DNo_Exception +w -c AdvApp2Var_ApproxAFunc2Var.cxx -o AdvApp2Var_ApproxAFunc2Var.o

Note that we use "cc" for c compiler and "CC" for C++ compiler.

I hope this will help.

Stay tuned.

Régis Le Boité

Rao Garimella's picture

Hello Regis

Thanks for the info. I will certainly try it. Also, is there any plan to convert the C code to ANSI compliant code? If not, if I do it can I submit this code back? (I am half done anyway).

Best Regards Rao