Hello,

So I've managed to compile OpenCASCADE, by disabling some components with 
3rd party dependencies that I didn't need and explicitly including 
sys/utsname.h. Now I'm facing the problem I was already mentioning: I am 
not able to compile my own program with CMake (I get the undefined symbol 
error). How can I specify that I should use the OpenCASCADE libraries that 
I've compiled?

I see in the example on Emscripten's website that it doesn't specify that 
and it links the two parts in a third step like:

emcc project.bc libstuff.bc -o final.html


Thanks!


On Monday, December 10, 2018 at 10:53:41 PM UTC+1, Sam Clegg wrote:
>
> On Mon, Dec 10, 2018 at 9:11 AM <[email protected] <javascript:>> 
> wrote: 
> > 
> > Hello, 
> > 
> > I have a simple C++ code that makes use of some of the APIs of 
> OpenCASCADE, 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, 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? 
>
> `struct utsname` is defined in `sys/utsname.h` which is availing in 
> emscripten.  Perhaps this header is not correctly being detected 
> during cmake therefore not bring included?  Perhaps the code is simply 
> failing to include this header and relying on its transitive inclusion 
> on other platforms? 
>
>
> > 
> > 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] <javascript:>. 
>
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
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