For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Any hope in using occt from cygwin with x86_64-mingw32 cross-compilation toolchain ?

Matthieu Dubuget's picture

Hello,

I tried to compile OCCT with x86_64-mingw32 cross-compilation toolchain, but failed.

When linking TKernel shared library, the linker is looking for a 'dl' and a 'tr' lib.

Before I spend too much time on this: is there any hope, or am I trying something impossible?

Thanks

Matthieu Dubuget's picture

Hello,

I'm still failing to compile OCCT using x86_64-mingw32 cygwin toolchain under windows.

My goal would to be able to create a x86_64-mingw32 that would use occt libs.

Any advice would be greatly appreciated

Salutations

Kirill's picture

Do you really need Cygwin or maybe you just want using gcc instead of Visual Studio?
In the latter case, there will be more luck with MinGW-w64:
https://dev.opencascade.org/index.php?q=node/1152

I don't think there many users interested in using obsolete tools like Cygwin - there are better options for getting UNIX world into Windows nowadays, if really needed:
https://msdn.microsoft.com/en-us/commandline/wsl/faq#what-is-windows-sub...

Matthieu Dubuget's picture

Hello!

Thanks for your reply. I think I should explain my proplems in more
detail.

I wrote a small OCaml program which is used by a Java one through a
socket. The Java program has to be on one windows computer (because of
drivers). When delivering versions of the OCaml program, I compile a
window version. The Java program is running the OCaml one, and
establish a dialog with it.

I recently added some functionnalities to my OCaml program: it is now
relying on OCCT. But until now, I failed to produce a windows version.

Before I come back on explaining my compilation problems, let me
explore other solutions:

- I could run the linux version of my program on a separate linux box.
  But it implies two different computers! Not acceptable.

- To solve this, I could run a linux virtual machine on the windows
  system. But this is a too heavy solution!

- I also could distribute my OCaml program with Docker on windows
  (untested). Again, this seems quite heavy, and comes with constraint
  on the windows version (>= windows 10)

- I also tested (as a fallback) the Bash on Ubuntu on Windows
  solution. It works, but also comes with constraint on the windows
  version (>= windows 10), and need some linux knowledge (I have this
  knowledge, but not the end users and other developers)

This is why I'd really like to be able to deliver my OCaml program as
a windows application. This OCaml program does not call directly OCCT.
Instead, the OCaml program is linked (at run time) again an 'extern
"C"' shared library, which in turn calls OCCT libraries.

It worked like a charm on linux. I failed miserabily on Windows.

On windows, I have the choice between MSVC and gcc toolchains.

- I tried the MSVC solution (I installed something called Visual
  Studio 2017 Community Edition to make my tests), but:

  - some of the OCaml libraries I'm using are not compiling with it

  - and anyway the creation of the 'extern "C"' shared lib fails at
    link stage (should I have to also recompile OCCT with VS2017?)

- I tried my usual gcc toolchain (x86_64-w64-mingw32 on cygwin)

  - I did not succeed in compiling OCCT with it. Neither with
    mingw-w64.

  - I did not succed to link with an OCE version compiled by others
    (mxe project)

I really would need to achieve the compilation of OCCT + the C shared
lib with gcc on windows. I'm going to describe in detail what I tried.
Maybe someone will have the knowledge to spot my mistakes.

Cheers

Kirill's picture

(should I have to also recompile OCCT with VS2017?)

It is always better using consistent compiler versions (or at least consistent C/C++ runtime versions), though depending on application design some other combination are also possible.
Note that versions before Visual Studio 2015 provided some broken C++11 declarations making libraries incompatible on this barier (e.g. you will see linkage errors while using VS2010/VS2013 + VS2015/VS2017 combination).

- I tried my usual gcc toolchain (x86_64-w64-mingw32 on cygwin)

You have not explained why you need Cygwin (e.g. why you can not use toolchains producing native Windows binaries instead of Cywin simulating some Linux API like ugly file paths /c/myfavoritepath).

  - I did not succeed in compiling OCCT with it. Neither with mingw-w64.

If you've meant NOT a Cygwin, then it should be quite possible with OCCT 7.1.0 - there are users on this forum using MinGW-w64.

Matthieu Dubuget's picture

You have not explained why you need Cygwin (e.g. why you can not use toolchains producing native Windows binaries instead of Cywin simulating some Linux API like ugly file paths /c/myfavoritepath).

Sorry: I was not clear. I'm using cygwin as an environment only. The toolchain, packaged by cygwin is MinGW-w64, and as such, producing native windows binaries (no dependency to the cygwin dl, no path tricks).

Thanks for your confirmation that it should be possible.
Can you confirm that if I chose to use Cmake, the only files to adapt would be : CMakeLists.txt and adm/cmake/* ?

Salutations

Kirill's picture

Can you confirm that if I chose to use Cmake, the only files to adapt would be : CMakeLists.txt and adm/cmake/* ?

I have not tried it, but so far it should work without any patches:
https://tracker.dev.opencascade.org/view.php?id=27402
https://www.opencascade.com/content/mingw-w64-vs-msvc
https://tracker.dev.opencascade.org/view.php?id=27197
https://tracker.dev.opencascade.org/view.php?id=27397

Matthieu Dubuget's picture

Thanks Kirill!

I followed your advice, and compiled OCCT with gcc the way you suggested.

I wrote down in my TODO list to write a more detailed tutorial.

Cheeeeers