Hello,

I have a simple C++ code that makes use of some of the APIs of OpenCASCADE 
<https://www.opencascade.com/doc/occt-7.3.0/overview/html/index.html>, and 
I have successfully run compiled with clang in macOS. I want to call the 
functions implemented in my C++ codebase, so I'm using wasm for it (I 
already have some code that does not call OpenCASCADE working in a browser).

Normally, I compile my C++ code using CMake:

cmake_minimum_required(VERSION 3.12)
project(oc_test)

set(CMAKE_VERBOSE_MAKEFILE on)
set(CMAKE_CXX_STANDARD 14)

include_directories(/usr/local/include/opencascade)
link_directories(/usr/local/lib)

add_executable(oc_test_bin CMakeLists.txt main.cpp)

target_link_libraries(oc_test_bin TKernel TKXSBase TKIGES TKBrep TKGeomBase 
TKTopAlgo TKG3d)


If I try to compile the former project with 

emconfigure cmake .

emmake make

it compiles fine, but on the linking stage I get warnings such as

error: undefined symbol: 
_ZN11GeomConvert23SurfaceToBSplineSurfaceERKN11opencascade6handleI12Geom_SurfaceEE
warning: To disable errors for undefined symbols use `-s 
ERROR_ON_UNDEFINED_SYMBOLS=0`
error: undefined symbol: 
_ZN13Standard_Type8RegisterEPKcS1_mRKN11opencascade6handleIS_EE
error: undefined symbol: _ZN16Standard_Failure16SetMessageStringEPKc
error: undefined symbol: _ZN16Standard_FailureC2EPKc

Which indeed refer to the symbols the OpenCASCADE library.

On the other hand, I'm trying to compile OpenCASCADE so I can get the .bc 
files to link, but I don't manage to do that. I download the source code 
<https://www.opencascade.com/sites/default/files/private/occt/OCC_7.3.0_release/opencascade-7.3.0.tgz>,
 
and I fail to build the CMake project. When doing 

emconfigure cmake .

the system doesn't find FreeType neither TCL-TK:

 Could not find headers of used third-party products:
  3RDPARTY_TCL_INCLUDE_DIR 3RDPARTY_TK_INCLUDE_DIR
  3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build
  3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2

Then, if I disable *USE_TCL *and *USE_FREETYPE*, I manage to generate the 
Makefile, but when compiling I get the following error:

[  1%] Building CXX object 
src/TKernel/CMakeFiles/TKernel.dir/__/OSD/OSD_Path.cxx.o
opencascade-7.3.0/src/OSD/OSD_Path.cxx:45:18: error: variable has 
incomplete type
      'struct utsname'
  struct utsname info;
                 ^
opencascade-7.3.0/src/OSD/OSD_Path.cxx:45:10: note: forward declaration of 
'utsname'
  struct utsname info;
         ^
1 error generated.
ERROR:root:compiler frontend failed to generate LLVM bitcode, halting
make[2]: *** [src/TKernel/CMakeFiles/TKernel.dir/__/OSD/OSD_Path.cxx.o] 
Error 1
make[1]: *** [src/TKernel/CMakeFiles/TKernel.dir/all] Error 2
make: *** [all] Error 2

Any ideas on what might be causing this?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to