[Mesa-dev] OSdemo32 GLU undefined reference errors..

Trevor Sandy trevor.sandy at gmail.com
Tue Jul 11 18:27:10 UTC 2017


I'm having some difficulty linking OSdemo32 [Mesa Demo] on MSYS2/MinGW.
Basically, some functions are not included in libGLU.a as the error
returned is undefined reference to __imp_glu... It's strange because these
functions exist in the libGLU source and I am building and using a static
libGLU library (versus a .dll which could have some dll import issues as
explained at the bottom).

Here is what the last bit of  linking trace looks like:

* building Mesa demo...
g++ -DHAVE_FREEGLUT -DFREEGLUT_STATIC -O3 -I/opt/osmesa/include
-I../../src/util -include /opt/osmesa/include/GL/gl.h -include
/opt/osmesa/include/GL/glu.h -include /opt/osmesa/include/GL/freeglut.h -o
osdemo32 osdemo32.c -L/opt/osmesa/lib -losmesa -lfreeglut -lGLU -lz
-LC:\Users\Trevor\Projects\osmesa-install\build\install\llvm/lib
-lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMGlobalISel
-lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMDebugInfoCodeView
-lLLVMDebugInfoMSF -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine
-lLLVMTransformUtils -lLLVMBitWriter -lLLVMX86Desc -lLLVMMCDisassembler
-lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMMCJIT
-lLLVMExecutionEngine -lLLVMTarget -lLLVMAnalysis -lLLVMProfileData
-lLLVMRuntimeDyld -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMMC
-lLLVMCore -lLLVMSupport -lLLVMDemangle -lpsapi -lshell32 -lole32 -luuid

C:\msys64\tmp\cc4gd4Lj.o:osdemo32.c:(.text.startup+0xe1): undefined
reference to `__imp_gluNewQuadric'
C:\msys64\tmp\cc4gd4Lj.o:osdemo32.c:(.text.startup+0x347): undefined
reference to `__imp_gluCylinder'
C:\msys64\tmp\cc4gd4Lj.o:osdemo32.c:(.text.startup+0x3a7): undefined
reference to `__imp_gluSphere'
C:\msys64\tmp\cc4gd4Lj.o:osdemo32.c:(.text.startup+0x3bf): undefined
reference to `__imp_gluDeleteQuadric'

collect2.exe: error: ld returned 1 exit status

I had numerous 'redeclared without dllimport attribute: previous dllimport
ignored [-Wattributes]' warnings while building libGLU but as I am using a
static lib, I imagine this should not be related to my issue. However, this
situation could indeed cause functions declared without dllimport
attributes to not export to the compiled [dynamic] library. Thanks.

Cheers,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170711/69b0f4c8/attachment.html>


More information about the mesa-dev mailing list