Bug 26674 - egl progs do not link without libm
Summary: egl progs do not link without libm
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Other (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-20 19:31 UTC by ataraxia937
Modified: 2010-02-21 09:30 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Makefile update to link egl progs with libm (1.43 KB, patch)
2010-02-20 19:31 UTC, ataraxia937
Details | Splinter Review

Description ataraxia937 2010-02-20 19:31:19 UTC
Created attachment 33467 [details] [review]
Makefile update to link egl progs with libm

Four of the egl programs need libm to link properly (eglgears, peglgears, xeglgears, and xeglthreads). Attached is a Makefile patch to fix this.
Comment 1 Chia-I Wu 2010-02-21 07:54:54 UTC
What errors did you get without this patch?  Do other demos in progs/egl/ need to link to libm?
Comment 2 ataraxia937 2010-02-21 08:45:46 UTC
Without this patch, trigonometric functions fail to resolve. The other progs in that directory do not require it. Here is linker output:

gcc -march=x86-64 -mtune=generic -O2 -pipe -Wall -Wmissing-prototypes -std=c99 -ffast-math -fvisibility=hidden -fno-strict-aliasing  -fPIC  -DUSE_X86_64_ASM -D_GNU_SOURCE -DPTHREADS -DHAVE_POSIX_MEMALIGN -DUSE_XCB -DGLX_USE_TLS -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS -DHAVE_XEXTPROTO_71 -Wl,--hash-style=gnu -Wl,--as-needed -o eglgears eglgears.o -L../../lib -lEGL -lGL -ldrm  
eglgears.o: In function `T.55':
eglgears.c:(.text+0x183): undefined reference to `sincos'
eglgears.c:(.text+0x25a): undefined reference to `sincos'
eglgears.c:(.text+0x312): undefined reference to `sincos'
eglgears.c:(.text+0x36b): undefined reference to `sincos'
eglgears.c:(.text+0x3c4): undefined reference to `sincos'
eglgears.o:eglgears.c:(.text+0x41a): more undefined references to `sincos' follow
eglgears.o: In function `T.55':
eglgears.c:(.text+0x854): undefined reference to `sincosf'
eglgears.c:(.text+0x88c): undefined reference to `sincos'
eglgears.c:(.text+0x91f): undefined reference to `sincos'
eglgears.c:(.text+0xa2f): undefined reference to `sincos'
eglgears.c:(.text+0xabc): undefined reference to `sincos'
eglgears.c:(.text+0xb06): undefined reference to `sin'
eglgears.c:(.text+0xc59): undefined reference to `sincosf'
eglgears.c:(.text+0xc93): undefined reference to `sincos'
collect2: ld returned 1 exit status
make: [eglgears] Error 1 (ignored)
gcc -march=x86-64 -mtune=generic -O2 -pipe -Wall -Wmissing-prototypes -std=c99 -ffast-math -fvisibility=hidden -fno-strict-aliasing  -fPIC  -DUSE_X86_64_ASM -D_GNU_SOURCE -DPTHREADS -DHAVE_POSIX_MEMALIGN -DUSE_XCB -DGLX_USE_TLS -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS -DHAVE_XEXTPROTO_71 -Wl,--hash-style=gnu -Wl,--as-needed -o peglgears peglgears.o -L../../lib -lEGL -lGL -ldrm  
peglgears.o: In function `T.48':
peglgears.c:(.text+0x183): undefined reference to `sincos'
peglgears.c:(.text+0x25a): undefined reference to `sincos'
peglgears.c:(.text+0x312): undefined reference to `sincos'
peglgears.c:(.text+0x36b): undefined reference to `sincos'
peglgears.c:(.text+0x3c4): undefined reference to `sincos'
peglgears.o:peglgears.c:(.text+0x41a): more undefined references to `sincos' follow
peglgears.o: In function `T.48':
peglgears.c:(.text+0x854): undefined reference to `sincosf'
peglgears.c:(.text+0x88c): undefined reference to `sincos'
peglgears.c:(.text+0x91f): undefined reference to `sincos'
peglgears.c:(.text+0xa2f): undefined reference to `sincos'
peglgears.c:(.text+0xabc): undefined reference to `sincos'
peglgears.c:(.text+0xb06): undefined reference to `sin'
peglgears.c:(.text+0xc59): undefined reference to `sincosf'
peglgears.c:(.text+0xc93): undefined reference to `sincos'
collect2: ld returned 1 exit status
make: [peglgears] Error 1 (ignored)
gcc -march=x86-64 -mtune=generic -O2 -pipe -Wall -Wmissing-prototypes -std=c99 -ffast-math -fvisibility=hidden -fno-strict-aliasing  -fPIC  -DUSE_X86_64_ASM -D_GNU_SOURCE -DPTHREADS -DHAVE_POSIX_MEMALIGN -DUSE_XCB -DGLX_USE_TLS -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS -DHAVE_XEXTPROTO_71 -Wl,--hash-style=gnu -Wl,--as-needed -o xeglgears xeglgears.o -L../../lib -lEGL -lGL -lX11
xeglgears.o: In function `T.84':
xeglgears.c:(.text+0x273): undefined reference to `sincos'
xeglgears.c:(.text+0x34a): undefined reference to `sincos'
xeglgears.c:(.text+0x402): undefined reference to `sincos'
xeglgears.c:(.text+0x45b): undefined reference to `sincos'
xeglgears.c:(.text+0x4b4): undefined reference to `sincos'
xeglgears.o:xeglgears.c:(.text+0x50a): more undefined references to `sincos' follow
xeglgears.o: In function `T.84':
xeglgears.c:(.text+0x944): undefined reference to `sincosf'
xeglgears.c:(.text+0x97c): undefined reference to `sincos'
xeglgears.c:(.text+0xa0f): undefined reference to `sincos'
xeglgears.c:(.text+0xb1f): undefined reference to `sincos'
xeglgears.c:(.text+0xbac): undefined reference to `sincos'
xeglgears.c:(.text+0xbf6): undefined reference to `sin'
xeglgears.c:(.text+0xd49): undefined reference to `sincosf'
xeglgears.c:(.text+0xd83): undefined reference to `sincos'
collect2: ld returned 1 exit status
make: [xeglgears] Error 1 (ignored)
gcc -march=x86-64 -mtune=generic -O2 -pipe -Wall -Wmissing-prototypes -std=c99 -ffast-math -fvisibility=hidden -fno-strict-aliasing  -fPIC  -DUSE_X86_64_ASM -D_GNU_SOURCE -DPTHREADS -DHAVE_POSIX_MEMALIGN -DUSE_XCB -DGLX_USE_TLS -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS -DHAVE_XEXTPROTO_71 -Wl,--hash-style=gnu -Wl,--as-needed -o xeglthreads xeglthreads.o -L../../lib -lEGL -lGL -lX11
xeglthreads.o: In function `MakeNewTexture':
xeglthreads.c:(.text+0xee2): undefined reference to `cos'
collect2: ld returned 1 exit status
make: [xeglthreads] Error 1 (ignored)
Comment 3 Chia-I Wu 2010-02-21 09:30:38 UTC
Patch committed.  Thanks.

I guess my gcc replaces trigonometric functions by something built-in.  I didn't see the errors and nm did not list any of the trigonometric functions.


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.