Bug 6936

Summary: Undefined symbols in 6.4.2 if using -DUSE_MGL_NAMESPACE in sunos5-gcc on Solaris
Product: Mesa Reporter: Roland Egger <spark74>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: highest CC: vlee
Version: 6.4Keywords: NEEDINFO
Hardware: SPARC   
OS: Solaris   
Whiteboard:
i915 platform: i915 features:

Description Roland Egger 2006-05-17 00:53:05 UTC
I compiled the last stable release 6.4.2 on Solaris 9 (sparc/ultrasparc)
for 32 bit. If I just run 
make sunos5-gcc
without changing sunos5-gcc everything builds fine but if I want to
build mangled mesa and add -DUSE_MGL_NAMESPACE to the defines in
sunos5-gcc
=>
DEFINES = -D_REENTRANT -DUSE_XSHM -DUSE_MGL_NAMESPACE
It compiles and link the libraries libGL.so ... but with undefined symbols.
Afterwards I can't build the examples or any test program due to
the undefined symbols
make sunos5-gcc
stops with the followinf errors:
gcc -I../../include -Wall -O3 -g -fomit-frame-pointer -pipe -fPIC  -D_REENTRANT
-DUSE_XSHM -DUSE_MGL_NAMESPACE -DUSE_SPARC_ASM -std=c99 -ffast-math -I/usr/openw
in/include arbfplight.c readtex.o -L../../lib -lX11 -lglut -lGLU -lGL -lm -o arb
fplight
Undefined                       first referenced
 symbol                             in file
mglGetMinmax                        ../../lib/libGL.so
mglNormal3fv                        ../../lib/libglut.so
mglNormal3dv                        ../../lib/libGL.so
mglNormal3bv                        ../../lib/libGL.so
mglNormal3iv                        ../../lib/libGL.so
mglNormal3sv                        ../../lib/libGL.so
mglSecondaryColor3s                 ../../lib/libGL.so
....
mglCopyColorTableSGI                ../../lib/libGL.so
ld: fatal: Symbol referencing errors. No output written to arbfplight
collect2: ld returned 1 exit status
make[3]: *** [arbfplight] Error 1
make[3]: Leaving directory `/export/home/egger/src/mesa/Mesa-6.4.2/progs/demos'
make[2]: *** [subdirs] Error 1
make[2]: Leaving directory `/export/home/egger/src/mesa/Mesa-6.4.2/progs'
make[1]: *** [default] Error 1
make[1]: Leaving directory `/export/home/egger/src/mesa/Mesa-6.4.2'
make: *** [sunos5-gcc] Error 2

I'll try the version 6.5 (Last development release) but I expect the same or
even worse errors. What is wrong here?
Comment 1 Roland Egger 2006-05-17 01:36:26 UTC
compiling of Mesa 6.5 has the same problem and has even problems without
"Function Name Mangling". The CVS version has problems with this
"mangled" version, too.
Comment 2 Brian Paul 2006-05-18 00:59:07 UTC
Does Solaris have the 'nm' program like Linux that lists the symbols in an
object file or library?  If so, I'd be curious to see 'nm libGL.so | grep
GetMinmax'.

Are you sure you did a 'make realclean' after you added the -DUSE_MGL_NAMESPACE
flag?
Comment 3 Roland Egger 2006-05-18 23:14:07 UTC
Hi Paul,
of course Solaris has an nm ;)
Here's it's output
egger@blade02 Mesa-6.4.2$ nm lib/libGL.so | grep GetMinmax
[4448]  |   1131188|     216|FUNC |LOCL |0    |13     |NoOpGetMinmax
[3437]  |   1153452|     216|FUNC |LOCL |0    |13     |NoOpGetMinmaxEXT
[3849]  |   1131404|     216|FUNC |LOCL |0    |13     |NoOpGetMinmaxParameterfv
[5000]  |   1153668|     216|FUNC |LOCL |0    |13     |NoOpGetMinmaxParameterfvEXT
[4033]  |   1131620|     216|FUNC |LOCL |0    |13     |NoOpGetMinmaxParameteriv
[3251]  |   1153884|     216|FUNC |LOCL |0    |13     |NoOpGetMinmaxParameterivEXT
[11738] |    680000|    1384|FUNC |GLOB |0    |13     |_mesa_GetMinmax
[10767] |    694612|     320|FUNC |GLOB |0    |13     |_mesa_GetMinmaxParameterfv
[10828] |    694932|     256|FUNC |GLOB |0    |13     |_mesa_GetMinmaxParameteriv
[1296]  |    516544|     108|FUNC |LOCL |0    |13     |exec_GetMinmax
[1013]  |    516652|     100|FUNC |LOCL |0    |13     |exec_GetMinmaxParameterfv
[1018]  |    516752|     100|FUNC |LOCL |0    |13     |exec_GetMinmaxParameteriv
[11774] |   2898928|       0|FUNC |GLOB |0    |20     |glGetMinmax
[9148]  |   2900048|       0|FUNC |GLOB |0    |20     |glGetMinmaxEXT
[9135]  |   2898948|       0|FUNC |GLOB |0    |20     |glGetMinmaxParameterfv
[12178] |   2900068|       0|FUNC |GLOB |0    |20     |glGetMinmaxParameterfvEXT
[9423]  |   2898968|       0|FUNC |GLOB |0    |20     |glGetMinmaxParameteriv
[11428] |   2900088|       0|FUNC |GLOB |0    |20     |glGetMinmaxParameterivEXT
[11283] |         0|       0|NOTY |GLOB |0    |UNDEF  |mglGetMinmax
[10942] |         0|       0|NOTY |GLOB |0    |UNDEF  |mglGetMinmaxEXT
[12070] |         0|       0|NOTY |GLOB |0    |UNDEF  |mglGetMinmaxParameterfv
[10288] |         0|       0|NOTY |GLOB |0    |UNDEF  |mglGetMinmaxParameterfvEXT
[12371] |         0|       0|NOTY |GLOB |0    |UNDEF  |mglGetMinmaxParameteriv
[9629]  |         0|       0|NOTY |GLOB |0    |UNDEF  |mglGetMinmaxParameterivEXT

With nm of binutils:
~/opt/bin/nm lib/libGL.so | grep GetMinmax
001142b4 t NoOpGetMinmax
001199ac t NoOpGetMinmaxEXT
0011438c t NoOpGetMinmaxParameterfv
00119a84 t NoOpGetMinmaxParameterfvEXT
00114464 t NoOpGetMinmaxParameteriv
00119b5c t NoOpGetMinmaxParameterivEXT
000a6040 T _mesa_GetMinmax
000a9954 T _mesa_GetMinmaxParameterfv
000a9a94 T _mesa_GetMinmaxParameteriv
0007e1c0 t exec_GetMinmax
0007e22c t exec_GetMinmaxParameterfv
0007e290 t exec_GetMinmaxParameteriv
002c3bf0 D glGetMinmax
002c4050 D glGetMinmaxEXT
002c3c04 D glGetMinmaxParameterfv
002c4064 D glGetMinmaxParameterfvEXT
002c3c18 D glGetMinmaxParameteriv
002c4078 D glGetMinmaxParameterivEXT
         U mglGetMinmax
         U mglGetMinmaxEXT
         U mglGetMinmaxParameterfv
         U mglGetMinmaxParameterfvEXT
         U mglGetMinmaxParameteriv
         U mglGetMinmaxParameterivEXT

I think Alan offered you to compile Mesa on his sun.
That might be a good solution to get rid of the solaris
errors.

I removed all sources and made a clean build with
-DUSE_MGL_NAMESPACE and it has the errors like I described.
Can it be something special with the sun or the gnu ld?

Comment 4 Brian Paul 2006-05-19 00:07:04 UTC
It'll be a few days before I can get access to Alan's Solaris system.

In the mean time, could you run nm on the main/dispatch.o file?  Here's what I
get when I compile with -DUSE_MGL_NAMESPACE:

nm main/dispatch.o | grep Minmax
0000870f T mglGetMinmax
0000ab50 T mglGetMinmaxEXT
00008775 T mglGetMinmaxParameterfv
0000abb6 T mglGetMinmaxParameterfvEXT
000087cd T mglGetMinmaxParameteriv
0000ac0e T mglGetMinmaxParameterivEXT
000088d9 T mglMinmax
00008939 T mglMinmaxEXT
00008a3d T mglResetMinmax
00008a8f T mglResetMinmaxEXT

Comment 5 Roland Egger 2006-05-19 19:25:33 UTC
Hello Brian,
there are no symbols in dispatch.o.
Solaris nm shows:
nm ./src/mesa/main/dispatch.o


./src/mesa/main/dispatch.o:

[Index]   Value      Size    Type  Bind  Other Shndx   Name

[2]     |         0|       0|SECT |LOCL |0    |6      |
[6]     |         0|       0|SECT |LOCL |0    |4      |
[3]     |         0|       0|SECT |LOCL |0    |2      |
[4]     |         0|       0|SECT |LOCL |0    |3      |
[5]     |         0|       0|SECT |LOCL |0    |5      |
[1]     |         0|       0|FILE |LOCL |0    |ABS    |dispatch.c
The GNU binutils nm shows:
egger@blade02 Mesa-6.4.2$ ~/opt/bin/nm -D ./src/mesa/main/dispatch.o
/export/home/egger/opt/bin/nm: ./src/mesa/main/dispatch.o: No symbols
egger@blade02 Mesa-6.4.2$ ~/opt/bin/nm ./src/mesa/main/dispatch.o
egger@blade02 Mesa-6.4.2$

If you won't get access to Alans machine maybe I can prepare an
access on my sun ultra5 at home (then I have to update ssh and change
the firewall rules ...)
I used the gcc from sunfreeware
and have tried it with a self compiled versions  gcc 3.4.4 and 4.0.2, too.
If you need a compiled gcc 3.4.4, 4.0.2 or a gdb 6.4 for
Solaris I can send you my compiled versions as tar archieves.
Then you could install it on a local folder.
Comment 6 Ian Romanick 2011-01-04 14:45:12 UTC
Are you still able to reproduce this on newer versions of Mesa?  A lot has happened in this area in the last 4+ years.
Comment 7 Ian Romanick 2015-11-30 23:46:13 UTC
I'm going to close this (very old bug).  I know that Mesa has built on Solaris since 2006.  I believe that there are other build problems, and those are tracked by other bugs (submitted by Vinson Lee).

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.