OpenSceneGraph
OpenSceneGraph copied to clipboard
Linking the example osgemscripten
I wanted to compile+link the example osgemscripten (Emscripten version 3.1.25). I compiled successfully (after some minor modifications) the whole OpenSceneGraph (current master) repository, however I did not manage to link this example, because it has a bunch of undefined symbols wrt. OpenGL (see below). I tried to add manually all kind of GL libraries (e.g., -lGL-webgl2, -lGL) that are shipped with emscripten, but nothing works apparently. Does anyone have an idea how I could manage to link this?
error: undefined symbol: glAlphaFunc (referenced by top-level compiled C/C++ code)
warning: Link with `-sLLD_REPORT_UNDEFINED` to get more information on undefined symbols
warning: To disable errors for undefined symbols use `-sERROR_ON_UNDEFINED_SYMBOLS=0`
warning: _glAlphaFunc may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glCallList (referenced by top-level compiled C/C++ code)
warning: _glCallList may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glClearAccum (referenced by top-level compiled C/C++ code)
warning: _glClearAccum may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glClipPlane (referenced by top-level compiled C/C++ code)
warning: _glClipPlane may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glColor3dv (referenced by top-level compiled C/C++ code)
warning: _glColor3dv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glColor3fv (referenced by top-level compiled C/C++ code)
warning: _glColor3fv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glColor4dv (referenced by top-level compiled C/C++ code)
warning: _glColor4dv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glColor4fv (referenced by top-level compiled C/C++ code)
warning: _glColor4fv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glColor4ubv (referenced by top-level compiled C/C++ code)
warning: _glColor4ubv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glColorMaterial (referenced by top-level compiled C/C++ code)
warning: _glColorMaterial may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glColorPointer (referenced by top-level compiled C/C++ code)
warning: _glColorPointer may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glCopyTexImage1D (referenced by top-level compiled C/C++ code)
warning: _glCopyTexImage1D may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glCopyTexSubImage1D (referenced by top-level compiled C/C++ code)
warning: _glCopyTexSubImage1D may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glDeleteLists (referenced by top-level compiled C/C++ code)
warning: _glDeleteLists may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glDisableClientState (referenced by top-level compiled C/C++ code)
warning: _glDisableClientState may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glDrawBuffer (referenced by top-level compiled C/C++ code)
warning: _glDrawBuffer may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glDrawPixels (referenced by top-level compiled C/C++ code)
warning: _glDrawPixels may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glEnableClientState (referenced by top-level compiled C/C++ code)
warning: _glEnableClientState may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glEndList (referenced by top-level compiled C/C++ code)
warning: _glEndList may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glFogf (referenced by top-level compiled C/C++ code)
warning: _glFogf may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glFogfv (referenced by top-level compiled C/C++ code)
warning: _glFogfv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glFogi (referenced by top-level compiled C/C++ code)
warning: _glFogi may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glGenLists (referenced by top-level compiled C/C++ code)
warning: _glGenLists may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glGetTexImage (referenced by top-level compiled C/C++ code)
warning: _glGetTexImage may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glGetTexLevelParameteriv (referenced by top-level compiled C/C++ code)
warning: _glGetTexLevelParameteriv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glLightModelfv (referenced by top-level compiled C/C++ code)
warning: _glLightModelfv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glLightModeli (referenced by top-level compiled C/C++ code)
warning: _glLightModeli may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glLightf (referenced by top-level compiled C/C++ code)
warning: _glLightf may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glLightfv (referenced by top-level compiled C/C++ code)
warning: _glLightfv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glLineStipple (referenced by top-level compiled C/C++ code)
warning: _glLineStipple may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glLoadMatrixd (referenced by top-level compiled C/C++ code)
warning: _glLoadMatrixd may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glLogicOp (referenced by top-level compiled C/C++ code)
warning: _glLogicOp may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glMaterialf (referenced by top-level compiled C/C++ code)
warning: _glMaterialf may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glMaterialfv (referenced by top-level compiled C/C++ code)
warning: _glMaterialfv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glNewList (referenced by top-level compiled C/C++ code)
warning: _glNewList may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glNormal3bv (referenced by top-level compiled C/C++ code)
warning: _glNormal3bv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glNormal3dv (referenced by top-level compiled C/C++ code)
warning: _glNormal3dv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glNormal3fv (referenced by top-level compiled C/C++ code)
warning: _glNormal3fv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glNormal3sv (referenced by top-level compiled C/C++ code)
warning: _glNormal3sv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glNormalPointer (referenced by top-level compiled C/C++ code)
warning: _glNormalPointer may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glOrtho (referenced by top-level compiled C/C++ code)
warning: _glOrtho may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glPointSize (referenced by top-level compiled C/C++ code)
warning: _glPointSize may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glPolygonMode (referenced by top-level compiled C/C++ code)
warning: _glPolygonMode may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glPolygonStipple (referenced by top-level compiled C/C++ code)
warning: _glPolygonStipple may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glRasterPos3f (referenced by top-level compiled C/C++ code)
warning: _glRasterPos3f may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glReadBuffer (referenced by top-level compiled C/C++ code)
warning: _glReadBuffer may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glRecti (referenced by top-level compiled C/C++ code)
warning: _glRecti may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glScalef (referenced by top-level compiled C/C++ code)
warning: _glScalef may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glShadeModel (referenced by top-level compiled C/C++ code)
warning: _glShadeModel may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glTexCoordPointer (referenced by top-level compiled C/C++ code)
warning: _glTexCoordPointer may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glTexEnvf (referenced by top-level compiled C/C++ code)
warning: _glTexEnvf may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glTexEnvfv (referenced by top-level compiled C/C++ code)
warning: _glTexEnvfv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glTexEnvi (referenced by top-level compiled C/C++ code)
warning: _glTexEnvi may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glTexGendv (referenced by top-level compiled C/C++ code)
warning: _glTexGendv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glTexGeni (referenced by top-level compiled C/C++ code)
warning: _glTexGeni may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glTexImage1D (referenced by top-level compiled C/C++ code)
warning: _glTexImage1D may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
Error: Aborting compilation due to previous errors
Steps to reproduce (previously with emscripten compiled and installed OpenSceneGraph without examples is required):
# in osgemscripten
mkdir build
cd build
emcmake cmake .. -GNinja
# or with this: cmake -DCMAKE_TOOLCHAIN_FILE=/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake ..
ninja