Hi folks, I posted a few months ago about compiling the OpenCSG library with mingw-cross-env (http://lists.nongnu.org/archive/html/mingw-cross-env-list/2011-05/msg00048.html). With some help I was able to successfully generate a libopencsg.a file. I had assumed that it worked, but now when I actually try to compile a .exe that uses it, I am unable to do so. The library tarball conveniently includes an example program that I am trying to compile. Here is the makefile I have made:
========BEGIN=========== # This file is part of mingw-cross-env. # See doc/index.html for further information.
So it just downloads the tarball and: 1. Adds "staticlib" to tell it to build the library statically 2. Adds some *.a files to the final linker command for the example program. I didn't do this initially, but I saw that toppler does it (which I was able to compile with mingw-cross-env) and adding those lines decreases the number of errors dramatically. It probably doesn't need ALL those libraries, but I'm willing to try anything at this point.
3. Compiles the library. 4. Attempts to compile the example. 5. If successfull, it wolud install the library and header file.
"make libopencsg" always fails. If I then "cd tmp-libopencsg/OpenCSG-1.3.1/example && make" the output is the following:
i686-pc-mingw32-g++ -Wl,-s -mthreads -Wl,-subsystem,windows -o release/opencsgexample.exe release/displaylistPrimitive.o release/main.o -L'/home/brad/code/mingw-cross-env/usr/i686-pc-mingw32/lib' -lglu32 -lopengl32 -lmingw32 -lqtmain -L../lib -lopencsg -lglut -L../glew/lib -lGLEW ../../../usr/i686-pc-mingw32/lib/libglew32s.a ../../../usr/i686-pc-mingw32/lib/libglut.a ../../../usr/i686-pc-mingw32/lib/libopengl32.a ../../../usr/i686-pc-mingw32/lib/libGLEW.a ../../../usr/i686-pc-mingw32/lib/libglaux.a ../../../usr/i686-pc-mingw32/lib/libglu32.a -lQtGui -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -ljpeg -lmng -llcms -ltiff -lmsimg32 -lQtCore -lpng -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32 -L/home/brad/code/mingw-cross-env/usr/i686-pc-mingw32/plugins/codecs -lqcncodecs -lqjpcodecs -lqtwcodecs -lqkrcodecs -lz
release/main.o:main.cpp:(.text+0x29f): undefined reference to address@hidden' release/main.o:main.cpp:(.text+0x72b): undefined reference to address@hidden' release/main.o:main.cpp:(.text+0x78f): undefined reference to address@hidden'
release/main.o:main.cpp:(.text+0x97e): undefined reference to address@hidden' release/main.o:main.cpp:(.text+0x9e7): undefined reference to address@hidden' release/main.o:main.cpp:(.text+0xb9d): undefined reference to address@hidden'
release/main.o:main.cpp:(.text+0xbd8): undefined reference to address@hidden' release/main.o:main.cpp:(.text+0x1203): undefined reference to address@hidden' release/main.o:main.cpp:(.text+0x1597): undefined reference to address@hidden'
release/main.o:main.cpp:(.text+0x186a): undefined reference to address@hidden' release/main.o:main.cpp:(.text+0x18ba): undefined reference to address@hidden' release/main.o:main.cpp:(.text.startup+0x2f): undefined reference to address@hidden'
release/main.o:main.cpp:(.text.startup+0x47): undefined reference to address@hidden' release/main.o:main.cpp:(.text.startup+0x57): undefined reference to address@hidden' release/main.o:main.cpp:(.text.startup+0x6f): undefined reference to address@hidden'
release/main.o:main.cpp:(.text.startup+0x78): undefined reference to `__imp__glewInit' release/main.o:main.cpp:(.text.startup+0x86): undefined reference to address@hidden' release/main.o:main.cpp:(.text.startup+0x9d): undefined reference to address@hidden'
release/main.o:main.cpp:(.text.startup+0x204): undefined reference to address@hidden' release/main.o:main.cpp:(.text.startup+0x243): undefined reference to address@hidden' release/main.o:main.cpp:(.text.startup+0x251): undefined reference to address@hidden'
release/main.o:main.cpp:(.text.startup+0x25f): undefined reference to address@hidden' release/main.o:main.cpp:(.text.startup+0x279): undefined reference to address@hidden' release/main.o:main.cpp:(.text.startup+0x285): undefined reference to address@hidden'
release/main.o:main.cpp:(.text.startup+0x29c): undefined reference to `__imp__glewGetErrorString' ../lib/libopencsg.a(opencsgRender.o):opencsgRender.cpp:(.text+0x2): undefined reference to `__imp____GLEW_ARB_occlusion_query'
../lib/libopencsg.a(opencsgRender.o):opencsgRender.cpp:(.text+0x11): undefined reference to `__imp____GLEW_NV_occlusion_query' ../lib/libopencsg.a(channelManager.o):channelManager.cpp:(.text+0x1ca): undefined reference to `__imp____GLEW_NV_texture_rectangle'
../lib/libopencsg.a(channelManager.o):channelManager.cpp:(.text+0x397): undefined reference to `__imp____GLEW_ARB_framebuffer_object' ../lib/libopencsg.a(channelManager.o):channelManager.cpp:(.text+0x3a9): undefined reference to `__imp____WGLEW_ARB_pbuffer'
../lib/libopencsg.a(channelManager.o):channelManager.cpp:(.text+0x3b7): undefined reference to `__imp____GLEW_EXT_framebuffer_object' ../lib/libopencsg.a(channelManager.o):channelManager.cpp:(.text+0x3c7): undefined reference to `__imp____GLEW_EXT_packed_depth_stencil'
../lib/libopencsg.a(channelManager.o):channelManager.cpp:(.text+0x688): undefined reference to `__imp____WGLEW_ARB_pixel_format' ../lib/libopencsg.a(channelManager.o):channelManager.cpp:(.text+0x703): undefined reference to `__imp____GLEW_ARB_texture_env_dot3'
../lib/libopencsg.a(channelManager.o):channelManager.cpp:(.text+0xc62): undefined reference to `__imp____GLEW_ARB_texture_env_dot3' ../lib/libopencsg.a(scissorMemo.o):scissorMemo.cpp:(.text+0x113): undefined reference to `__imp____GLEW_EXT_depth_bounds_test'
../lib/libopencsg.a(scissorMemo.o):scissorMemo.cpp:(.text+0x248): undefined reference to `__imp____glewDepthBoundsEXT' ../lib/libopencsg.a(scissorMemo.o):scissorMemo.cpp:(.text+0x285): undefined reference to `__imp____glewDepthBoundsEXT'
../lib/libopencsg.a(occlusionQuery.o):occlusionQuery.cpp:(.text+0x16): undefined reference to `__imp____glewDeleteQueriesARB' ../lib/libopencsg.a(occlusionQuery.o):occlusionQuery.cpp:(.text+0x56): undefined reference to `__imp____glewBeginQueryARB'
../lib/libopencsg.a(occlusionQuery.o):occlusionQuery.cpp:(.text+0x74): undefined reference to `__imp____glewEndQueryARB' ../lib/libopencsg.a(occlusionQuery.o):occlusionQuery.cpp:(.text+0xae): undefined reference to `__imp____glewGetQueryObjectuivARB'
../lib/libopencsg.a(occlusionQuery.o):occlusionQuery.cpp:(.text+0xd6): undefined reference to `__imp____glewDeleteOcclusionQueriesNV' ../lib/libopencsg.a(occlusionQuery.o):occlusionQuery.cpp:(.text+0x10e): undefined reference to `__imp____glewBeginOcclusionQueryNV'
../lib/libopencsg.a(occlusionQuery.o):occlusionQuery.cpp:(.text+0x121): undefined reference to `__imp____glewEndOcclusionQueryNV' ../lib/libopencsg.a(occlusionQuery.o):occlusionQuery.cpp:(.text+0x14e): undefined reference to `__imp____glewGetOcclusionQueryuivNV'
../lib/libopencsg.a(occlusionQuery.o):occlusionQuery.cpp:(.text+0x176): undefined reference to `__imp____glewDeleteOcclusionQueriesNV' ../lib/libopencsg.a(occlusionQuery.o):occlusionQuery.cpp:(.text+0x1c6): undefined reference to `__imp____glewDeleteQueriesARB'
../lib/libopencsg.a(occlusionQuery.o):occlusionQuery.cpp:(.text+0x216): undefined reference to `__imp____glewGenQueriesARB' ../lib/libopencsg.a(occlusionQuery.o):occlusionQuery.cpp:(.text+0x256): undefined reference to `__imp____glewGenOcclusionQueriesNV'
../lib/libopencsg.a(occlusionQuery.o):occlusionQuery.cpp:(.text+0x285): undefined reference to `__imp____GLEW_ARB_occlusion_query' ../lib/libopencsg.a(occlusionQuery.o):occlusionQuery.cpp:(.text+0x28f): undefined reference to `__imp____GLEW_NV_occlusion_query'
../lib/libopencsg.a(occlusionQuery.o):occlusionQuery.cpp:(.text+0x2b4): undefined reference to `__imp____glewGenOcclusionQueriesNV' ../lib/libopencsg.a(occlusionQuery.o):occlusionQuery.cpp:(.text+0x2ec): undefined reference to `__imp____glewGenQueriesARB'
../lib/libopencsg.a(stencilManager.o):stencilManager.cpp:(.text+0x6a): undefined reference to `__imp____wglewCreateBufferRegionARB' ../lib/libopencsg.a(stencilManager.o):stencilManager.cpp:(.text+0xac): undefined reference to `__imp____wglewSaveBufferRegionARB'
../lib/libopencsg.a(stencilManager.o):stencilManager.cpp:(.text+0x117): undefined reference to `__imp____wglewRestoreBufferRegionARB' ../lib/libopencsg.a(stencilManager.o):stencilManager.cpp:(.text+0x127): undefined reference to `__imp____wglewDeleteBufferRegionARB'
../lib/libopencsg.a(frameBufferObject.o):frameBufferObject.cpp:(.text+0x86): undefined reference to `__imp____glewBindFramebuffer' ../lib/libopencsg.a(frameBufferObject.o):frameBufferObject.cpp:(.text+0xa4): undefined reference to `__imp____glewBindFramebuffer'
../lib/libopencsg.a(frameBufferObject.o):frameBufferObject.cpp:(.text+0x145): undefined reference to `__imp____glewDeleteFramebuffers' ../lib/libopencsg.a(frameBufferObject.o):frameBufferObject.cpp:(.text+0x180): undefined reference to `__imp____glewDeleteRenderbuffers'
../lib/libopencsg.a(frameBufferObject.o):frameBufferObject.cpp:(.text+0x224): undefined reference to `__imp____GLEW_ARB_framebuffer_object' ../lib/libopencsg.a(frameBufferObject.o):frameBufferObject.cpp:(.text+0x272): undefined reference to `__imp____glewGenFramebuffers'
../lib/libopencsg.a(frameBufferObject.o):frameBufferObject.cpp:(.text+0x28a): undefined reference to `__imp____glewGenRenderbuffers' ../lib/libopencsg.a(frameBufferObject.o):frameBufferObject.cpp:(.text+0x2b2): undefined reference to `__imp____glewBindFramebuffer'
../lib/libopencsg.a(frameBufferObject.o):frameBufferObject.cpp:(.text+0x38f): undefined reference to `__imp____glewFramebufferTexture2DEXT' ../lib/libopencsg.a(frameBufferObject.o):frameBufferObject.cpp:(.text+0x3a0): undefined reference to `__imp____glewBindRenderbuffer'
../lib/libopencsg.a(frameBufferObject.o):frameBufferObject.cpp:(.text+0x3cc): undefined reference to `__imp____glewRenderbufferStorage' ../lib/libopencsg.a(frameBufferObject.o):frameBufferObject.cpp:(.text+0x3d7): undefined reference to `__imp____glewFramebufferRenderbuffer'
../lib/libopencsg.a(frameBufferObject.o):frameBufferObject.cpp:(.text+0x421): undefined reference to `__imp____glewCheckFramebufferStatus' ../lib/libopencsg.a(frameBufferObjectExt.o):frameBufferObjectExt.cpp:(.text+0x86): undefined reference to `__imp____glewBindFramebufferEXT'
../lib/libopencsg.a(frameBufferObjectExt.o):frameBufferObjectExt.cpp:(.text+0xa4): undefined reference to `__imp____glewBindFramebufferEXT' ../lib/libopencsg.a(frameBufferObjectExt.o):frameBufferObjectExt.cpp:(.text+0x145): undefined reference to `__imp____glewDeleteFramebuffersEXT'
../lib/libopencsg.a(frameBufferObjectExt.o):frameBufferObjectExt.cpp:(.text+0x180): undefined reference to `__imp____glewDeleteRenderbuffersEXT' ../lib/libopencsg.a(frameBufferObjectExt.o):frameBufferObjectExt.cpp:(.text+0x224): undefined reference to `__imp____GLEW_EXT_framebuffer_object'
../lib/libopencsg.a(frameBufferObjectExt.o):frameBufferObjectExt.cpp:(.text+0x24c): undefined reference to `__imp____GLEW_EXT_packed_depth_stencil' ../lib/libopencsg.a(frameBufferObjectExt.o):frameBufferObjectExt.cpp:(.text+0x26b): undefined reference to `__imp____glewGenFramebuffersEXT'
../lib/libopencsg.a(frameBufferObjectExt.o):frameBufferObjectExt.cpp:(.text+0x283): undefined reference to `__imp____glewGenRenderbuffersEXT' ../lib/libopencsg.a(frameBufferObjectExt.o):frameBufferObjectExt.cpp:(.text+0x2ab): undefined reference to `__imp____glewBindFramebufferEXT'
../lib/libopencsg.a(frameBufferObjectExt.o):frameBufferObjectExt.cpp:(.text+0x388): undefined reference to `__imp____glewFramebufferTexture2DEXT' ../lib/libopencsg.a(frameBufferObjectExt.o):frameBufferObjectExt.cpp:(.text+0x399): undefined reference to `__imp____glewBindRenderbufferEXT'
../lib/libopencsg.a(frameBufferObjectExt.o):frameBufferObjectExt.cpp:(.text+0x3c5): undefined reference to `__imp____glewRenderbufferStorageEXT' ../lib/libopencsg.a(frameBufferObjectExt.o):frameBufferObjectExt.cpp:(.text+0x3d0): undefined reference to `__imp____glewFramebufferRenderbufferEXT'
../lib/libopencsg.a(frameBufferObjectExt.o):frameBufferObjectExt.cpp:(.text+0x41a): undefined reference to `__imp____glewCheckFramebufferStatusEXT' ../lib/libopencsg.a(pBufferTexture.o):pBufferTexture.cpp:(.text+0x1a4): undefined reference to `__imp____GLEW_NV_texture_rectangle'
../lib/libopencsg.a(pBufferTexture.o):pBufferTexture.cpp:(.text+0x1c1): undefined reference to `__imp____WGLEW_ARB_render_texture' ../lib/libopencsg.a(pBufferTexture.o):pBufferTexture.cpp:(.text+0x206): undefined reference to `__imp____WGLEW_ARB_render_texture'
../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0x125): undefined reference to `__imp____wglewReleasePbufferDCARB' ../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0x135): undefined reference to `__imp____wglewDestroyPbufferARB'
../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0x278): undefined reference to `__imp____wglewBindTexImageARB' ../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0x2f9): undefined reference to `__imp____wglewBindTexImageARB'
../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0x555): undefined reference to `__imp____WGLEW_ARB_pbuffer' ../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0x567): undefined reference to `__imp____WGLEW_ARB_pixel_format'
../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0x57c): undefined reference to `__imp____WGLEW_ARB_render_texture' ../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0x590): undefined reference to `__imp____GLEW_NV_texture_rectangle'
../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0x5aa): undefined reference to `__imp____GLEW_ARB_depth_texture' ../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0x5d1): undefined reference to `__imp____GLEW_NV_float_buffer'
../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0x5de): undefined reference to `__imp____WGLEW_ATI_pixel_format_float' ../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0x5f2): undefined reference to `__imp____GLEW_ATI_texture_float'
../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0x783): undefined reference to `__imp____GLEW_NV_texture_rectangle' ../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0x9b3): undefined reference to `__imp____GLEW_NV_float_buffer'
../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0xa03): undefined reference to `__imp____GLEW_NV_float_buffer' ../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0xa23): undefined reference to `__imp____GLEW_NV_float_buffer'
../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0xa47): undefined reference to `__imp____GLEW_NV_float_buffer' ../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0xa68): undefined reference to `__imp____GLEW_ATI_texture_float'
../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0xa8b): undefined reference to `__imp____GLEW_ATI_texture_float' ../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0xaae): undefined reference to `__imp____GLEW_ATI_texture_float'
../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0xad1): undefined reference to `__imp____GLEW_ATI_texture_float' ../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0xbc7): undefined reference to `__imp____wglewCreatePbufferARB'
../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0xbdf): undefined reference to `__imp____wglewGetPbufferDCARB' ../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0xc2a): undefined reference to `__imp____wglewQueryPbufferARB'
../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0xc5e): undefined reference to `__imp____wglewGetPixelFormatAttribivARB' ../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0xeaf): undefined reference to `__imp____wglewChoosePixelFormatARB'
../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0x111e): undefined reference to `__imp____wglewReleasePbufferDCARB' ../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0x112e): undefined reference to `__imp____wglewDestroyPbufferARB'
../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0x14ed): undefined reference to `__imp____wglewReleaseTexImageARB' ../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0x1528): undefined reference to `__imp____wglewReleaseTexImageARB'
../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0x2472): undefined reference to `__imp____WGLEW_NV_render_depth_texture' ../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0x24d7): undefined reference to `__imp____WGLEW_NV_float_buffer'
../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0x2bc5): undefined reference to `__imp____WGLEW_NV_float_buffer' ../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0x34db): undefined reference to `__imp____GLEW_NV_texture_rectangle'
../lib/libopencsg.a(RenderTexture.o):RenderTexture.cpp:(.text+0x3848): undefined reference to `__imp____GLEW_NV_texture_rectangle' collect2: ld returned 1 exit status make[1]: *** [release/opencsgexample.exe] Error 1
make[1]: Leaving directory `/home/brad/code/mingw-cross-env-test/tmp-libopencsg/OpenCSG-1.3.1/example' make: *** [release] Error 2
I hope this is a really obvious stupid mistake. It seems like it just can't find freeglut and glew for some reason but I can't figure out why. The libopencsg.a compiles successfully, I just can't compile a .exe that uses it. Does anyone know what the problem is?
Thanks, Brad