Bug 28071

Summary: undefined reference to `__egl InitDriverFallbacks'
Product: Mesa Reporter: Vinson Lee <vlee>
Component: GLXAssignee: mesa-dev
Status: CLOSED FIXED QA Contact:
Severity: critical    
Priority: medium CC: olvaffe
Version: git   
Hardware: x86 (IA32)   
OS: Cygwin   
Whiteboard:
i915 platform: i915 features:
Attachments: Add back-linking to libEGL
fix building of demos
fix building EGL demos by ignoring LIB_DEP
give cygwin libraries the correct suffix

Description Vinson Lee 2010-05-11 16:18:45 UTC
mesa: edbc302ad678e1a4a8803ba0e827a13dd27105d2 (master)

$ ./autogen.sh
$ make
...
make[4]: Entering directory `/home/vlee/mesa/src/mesa/drivers/x11'
mklib: Making CYGWIN_NT-5.1 shared library:  cygGL-1.dll
Creating library file: libGL-1.dll.a
mklib: Installing libGL-1.dll.a libGL.dll.a in ../../../../lib
make[4]: Leaving directory `/home/vlee/mesa/src/mesa/drivers/x11'
make[4]: Entering directory `/home/vlee/mesa/src/mesa/drivers/osmesa'
/bin/sh ../../../../bin/mklib -o OSMesa -linker 'gcc' -ldflags '' \
                -major 7 -minor 9 -patch 0 \
                -install ../../../../lib  \
                -id /usr/local/lib/libOSMesa.7.dylib \
                -L../../../../lib -lGL   osmesa.o
mklib: Making CYGWIN_NT-5.1 shared library:  cygOSMesa-7.dll
Creating library file: libOSMesa-7.dll.a
mklib: Installing libOSMesa-7.dll.a libOSMesa.dll.a in ../../../../lib
make[4]: Leaving directory `/home/vlee/mesa/src/mesa/drivers/osmesa'
make[3]: Leaving directory `/home/vlee/mesa/src/mesa/drivers'
make[2]: Leaving directory `/home/vlee/mesa/src/mesa'
make[2]: Entering directory `/home/vlee/mesa/src/glew'
make[2]: Nothing to be done for `default'.
make[2]: Leaving directory `/home/vlee/mesa/src/glew'
make[2]: Entering directory `/home/vlee/mesa/src/egl'
make[3]: Entering directory `/home/vlee/mesa/src/egl/main'
/bin/sh ../../../bin/mklib -o EGL -linker 'gcc' -ldflags '' \
                -major 1 -minor 0 \
                -install ../../../lib  \
                  -lpthread eglapi.o eglconfig.o eglconfigutil.o eglcontext.o eg
lcurrent.o egldisplay.o egldriver.o eglglobals.o eglimage.o egllog.o eglmisc.o e
glmode.o eglscreen.o eglstring.o eglsurface.o
mklib: Making CYGWIN_NT-5.1 shared library:  cygEGL-1.dll
Creating library file: libEGL-1.dll.a
mklib: Installing libEGL-1.dll.a libEGL.dll.a in ../../../lib
make[3]: Leaving directory `/home/vlee/mesa/src/egl/main'
make[3]: Entering directory `/home/vlee/mesa/src/egl/drivers'
make[4]: Entering directory `/home/vlee/mesa/src/egl/drivers/glx'
mklib: Making CYGWIN shared library:  egl_glx.so
egl_glx.o: In function `_eglMain':
/home/vlee/mesa/src/egl/drivers/glx/egl_glx.c:923: undefined reference to `__egl
InitDriverFallbacks'
egl_glx.o: In function `GLX_eglCreatePbufferSurface':
/home/vlee/mesa/src/egl/drivers/glx/egl_glx.c:808: undefined reference to `__egl
InitSurface'
/home/vlee/mesa/src/egl/drivers/glx/egl_glx.c:804: undefined reference to `__egl
Error'
egl_glx.o: In function `GLX_eglCreatePixmapSurface':
/home/vlee/mesa/src/egl/drivers/glx/egl_glx.c:748: undefined reference to `__egl
InitSurface'
/home/vlee/mesa/src/egl/drivers/glx/egl_glx.c:744: undefined reference to `__egl
Error'
egl_glx.o: In function `GLX_eglCreateWindowSurface':
/home/vlee/mesa/src/egl/drivers/glx/egl_glx.c:702: undefined reference to `__egl
InitSurface'
/home/vlee/mesa/src/egl/drivers/glx/egl_glx.c:698: undefined reference to `__egl
Error'
egl_glx.o: In function `GLX_eglMakeCurrent':
/home/vlee/mesa/src/egl/drivers/glx/egl_glx.c:645: undefined reference to `__egl
BindContext'
/home/vlee/mesa/src/egl/drivers/glx/egl_glx.c:664: undefined reference to `__egl
BindContext'
egl_glx.o: In function `GLX_eglCreateContext':
/home/vlee/mesa/src/egl/drivers/glx/egl_glx.c:587: undefined reference to `__egl
InitContext'
/home/vlee/mesa/src/egl/drivers/glx/egl_glx.c:583: undefined reference to `__egl
Error'
egl_glx.o: In function `GLX_eglTerminate':
/home/vlee/mesa/src/egl/drivers/glx/egl_glx.c:553: undefined reference to `__egl
ReleaseDisplayResources'
/home/vlee/mesa/src/egl/drivers/glx/egl_glx.c:554: undefined reference to `__egl
CleanupDisplay'
egl_glx.o: In function `create_configs':
/home/vlee/mesa/src/egl/drivers/glx/egl_glx.c:404: undefined reference to `__egl
InitConfig'
egl_glx.o: In function `convert_fbconfig':
/home/vlee/mesa/src/egl/drivers/glx/egl_glx.c:220: undefined reference to `__egl
ConfigFromContextModesRec'
egl_glx.o: In function `create_configs':
/home/vlee/mesa/src/egl/drivers/glx/egl_glx.c:413: undefined reference to `__egl
ValidateConfig'
/home/vlee/mesa/src/egl/drivers/glx/egl_glx.c:414: undefined reference to `__egl
Log'
/home/vlee/mesa/src/egl/drivers/glx/egl_glx.c:423: undefined reference to `__egl
AddConfig'
egl_glx.o: In function `convert_visual':
/home/vlee/mesa/src/egl/drivers/glx/egl_glx.c:340: undefined reference to `__egl
ConfigFromContextModesRec'
egl_glx.o: In function `check_quirks':
/home/vlee/mesa/src/egl/drivers/glx/egl_glx.c:484: undefined reference to `__egl
Log'
egl_glx.o: In function `GLX_eglInitialize':
/home/vlee/mesa/src/egl/drivers/glx/egl_glx.c:516: undefined reference to `__egl
Log'
/home/vlee/mesa/src/egl/drivers/glx/egl_glx.c:528: undefined reference to `__egl
Log'
/home/vlee/mesa/src/egl/drivers/glx/egl_glx.c:509: undefined reference to `__egl
Log'
egl_glx.o: In function `GLX_eglWaitNative':
/home/vlee/mesa/src/egl/drivers/glx/egl_glx.c:898: undefined reference to `__egl
Error'
egl_glx.o: In function `GLX_eglInitialize':
/home/vlee/mesa/src/egl/drivers/glx/egl_glx.c:503: undefined reference to `__egl
Error'
collect2: ld returned 1 exit status
/usr/bin/install -c egl_glx.so ../../../../lib/egl
/usr/bin/install: cannot stat `egl_glx.so': No such file or directory
make[4]: *** [../../../../lib/egl/egl_glx.so] Error 1
make[4]: Leaving directory `/home/vlee/mesa/src/egl/drivers/glx'
Comment 1 Chia-I Wu 2010-05-12 01:06:03 UTC
Created attachment 35583 [details] [review]
Add back-linking to libEGL

It seems EGL drivers should link back to libEGL.so on Cygwin.  Could you try again with this patch?
Comment 2 Vinson Lee 2010-05-17 08:08:52 UTC
0001-egl-Link-drivers-back-to-libEGL.patch

$ make
...
make[1]: Entering directory `/home/vlee/mesa/progs'
Making programs for autoconf
make[2]: Entering directory `/home/vlee/mesa/progs/xdemos'
make[2]: Nothing to be done for `default'.
make[2]: Leaving directory `/home/vlee/mesa/progs/xdemos'
make[2]: Entering directory `/home/vlee/mesa/progs/egl/eglut'
make[2]: Nothing to be done for `default'.
make[2]: Leaving directory `/home/vlee/mesa/progs/egl/eglut'
make[2]: Entering directory `/home/vlee/mesa/progs/egl/opengl'
make[2]: *** No rule to make target `../../../lib/libEGL.so', needed by `demo1'.
  Stop.
make[2]: Leaving directory `/home/vlee/mesa/progs/egl/opengl'
make[1]: *** [subdirs] Error 1
make[1]: Leaving directory `/home/vlee/mesa/progs'
make: *** [default] Error 1
Comment 3 Chia-I Wu 2010-05-17 10:25:34 UTC
libEGL should have been built in src/egl/main/.  Does it not exist or does it have a different suffix?
Comment 4 Vinson Lee 2010-05-18 07:05:58 UTC
$ ls lib
egl             libGL-1.dll.a   libGLU.dll.a       libOSMesa.dll.a
gallium         libGL.dll.a     libGLw-1.dll.a     libglut-3.dll.a
libEGL-1.dll.a  libGLEW.a       libGLw.dll.a       libglut.dll.a
libEGL.dll.a    libGLU-1.dll.a  libOSMesa-7.dll.a

$ ls src/egl/main
Makefile       eglconfig.h      egldefines.h  eglimage.h  eglmutex.h
README.txt     eglconfig.o      egldisplay.c  eglimage.o  eglscreen.c
cygEGL-1.dll   eglconfigutil.c  egldisplay.h  egllog.c    eglscreen.h
depend         eglconfigutil.h  egldisplay.o  egllog.h    eglscreen.o
depend.bak     eglconfigutil.o  egldriver.c   egllog.o    eglstring.c
egl.pc.in      eglcontext.c     egldriver.h   eglmisc.c   eglstring.h
eglapi.c       eglcontext.h     egldriver.o   eglmisc.h   eglstring.o
eglapi.h       eglcontext.o     eglglobals.c  eglmisc.o   eglsurface.c
eglapi.o       eglcurrent.c     eglglobals.h  eglmode.c   eglsurface.h
eglcompiler.h  eglcurrent.h     eglglobals.o  eglmode.h   eglsurface.o
eglconfig.c    eglcurrent.o     eglimage.c    eglmode.o   egltypedefs.h
Comment 5 Chia-I Wu 2010-05-18 09:25:15 UTC
Created attachment 35728 [details] [review]
fix building of demos

Could you try again with this patch?
Comment 6 Vinson Lee 2010-05-18 10:12:09 UTC
0001-egl-Link-drivers-back-to-libEGL.patch
0001-progs-egl-Fix-building-on-cygwin.patch

$ make
...
make[1]: Entering directory `/home/vlee/mesa/progs/xdemos'
make[1]: Nothing to be done for `default'.
make[1]: Leaving directory `/home/vlee/mesa/progs/xdemos'
make[1]: Entering directory `/home/vlee/mesa/progs/egl/eglut'
make[1]: Nothing to be done for `default'.
make[1]: Leaving directory `/home/vlee/mesa/progs/egl/eglut'
make[1]: Entering directory `/home/vlee/mesa/progs/egl/opengl'
make[1]: *** No rule to make target `../../../lib/libEGL.dll', needed by `demo1'
.  Stop.
make[1]: Leaving directory `/home/vlee/mesa/progs/egl/opengl'
make: *** [subdirs] Error 1
Comment 7 Chia-I Wu 2010-05-18 12:22:32 UTC
I am not sure how to proceed from here.  Does progs/demos/ build on cygwin?  If it does, I suppose progs/egl/ should too.
Comment 8 Vinson Lee 2010-05-18 19:44:15 UTC
demos successfully builds on Cygwin.
Comment 9 Chia-I Wu 2010-05-19 02:57:03 UTC
Created attachment 35754 [details] [review]
fix building EGL demos by ignoring LIB_DEP

The GNU make manual says that a suffix rule cannot have any prerequisite.  It seems $(LIB_DEP) in progs/demos/Makefile is simply ignored.  Could you see if this patch helps?  It is a workaround instead of a fix.
Comment 10 Chia-I Wu 2010-05-19 03:00:30 UTC
Created attachment 35755 [details] [review]
give cygwin libraries the correct suffix

This patch tries to fix the issue by fixing the library suffix in cygwin.  This is a real fix, but I could not test it.  If it is not too much trouble, could you see if this fixes the issue too?  I would like to apply this patch instead of the workaround above.
Comment 11 Vinson Lee 2010-05-19 08:38:21 UTC
(In reply to comment #9)
> The GNU make manual says that a suffix rule cannot have any prerequisite.  It
> seems $(LIB_DEP) in progs/demos/Makefile is simply ignored.  Could you see if
> this patch helps?  It is a workaround instead of a fix.

The workaround patch gets progs/egl building.

0001-egl-Link-drivers-back-to-libEGL.patch
0001-progs-egl-Fix-building-on-cygwin.patch
0001-progs-egl-No-LIB_DEP.patch

$ make
...
make[1]: Entering directory `/home/vlee/mesa/progs/egl/eglut'
make[1]: Nothing to be done for `default'.
make[1]: Leaving directory `/home/vlee/mesa/progs/egl/eglut'
make[1]: Entering directory `/home/vlee/mesa/progs/egl/opengl'
gcc -c -I../../../include  -I../../../progs/egl/eglut -g -O2 -Wall -Wmissing-pro
totypes -std=c99 -ffast-math -fvisibility=hidden -fno-strict-aliasing     -DPTHR
EADS -DHAVE_POSIX_MEMALIGN -DUSE_XSHM eglgears.c -o eglgears.o
eglgears.c: In function `gear':
eglgears.c:64: error: `M_PI' undeclared (first use in this function)
eglgears.c:64: error: (Each undeclared identifier is reported only once
eglgears.c:64: error: for each function it appears in.)
make[1]: *** [eglgears.o] Error 1
make[1]: Leaving directory `/home/vlee/mesa/progs/egl/opengl'
make: *** [subdirs] Error 1
Comment 12 Vinson Lee 2010-05-19 09:39:39 UTC
(In reply to comment #10)
> This patch tries to fix the issue by fixing the library suffix in cygwin.  This
> is a real fix, but I could not test it.  If it is not too much trouble, could
> you see if this fixes the issue too?  I would like to apply this patch instead
> of the workaround above.

I did a 'make realclean; autogen.sh; make'. This patch gets progs/egl working too. It also stops the unnecessary rebuilding of some DLLs on incremental makes as well.


0001-egl-Link-drivers-back-to-libEGL.patch
0001-progs-egl-Fix-building-on-cygwin.patch
0001-configure.ac-Fix-cygwin-suffix.patch

$ make
...
make[2]: Entering directory `/home/vlee/mesa/progs/egl/eglut'
make[2]: Nothing to be done for `default'.
make[2]: Leaving directory `/home/vlee/mesa/progs/egl/eglut'
make[2]: Entering directory `/home/vlee/mesa/progs/egl/opengl'
gcc -c -I../../../include  -I../../../progs/egl/eglut -g -O2 -Wall -Wmissing-pro
totypes -std=c99 -ffast-math -fvisibility=hidden -fno-strict-aliasing     -DPTHR
EADS -DHAVE_POSIX_MEMALIGN -DUSE_XSHM eglgears.c -o eglgears.o
eglgears.c: In function `gear':
eglgears.c:64: error: `M_PI' undeclared (first use in this function)
eglgears.c:64: error: (Each undeclared identifier is reported only once
eglgears.c:64: error: for each function it appears in.)
make[2]: *** [eglgears.o] Error 1
make[2]: Leaving directory `/home/vlee/mesa/progs/egl/opengl'
make[1]: *** [subdirs] Error 1
Comment 13 Chia-I Wu 2010-05-19 12:41:19 UTC
I've pushed two commits that are based on

0001-egl-Link-drivers-back-to-libEGL.patch
0001-progs-egl-Fix-building-on-cygwin.patch
0001-configure.ac-Fix-cygwin-suffix.patch

with the addition of M_PI fixes.  Please test.
Comment 14 Vinson Lee 2010-05-19 23:16:03 UTC
mesa: 366798ac6f10daae059d299b92ddf709875cc7ca (master)

The Cygwin build completes.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.