Bug 3686 - build problems and crash on solaris 8 gcc and 64 Bit
Summary: build problems and crash on solaris 8 gcc and 64 Bit
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: 6.2.1
Hardware: SPARC Solaris
: high major
Assignee: Ian Romanick
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 2773
  Show dependency treegraph
 
Reported: 2005-07-02 03:07 UTC by Daniel Stone
Modified: 2005-08-04 18:36 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description FreeDesktop Bugzilla Database Corruption Fix User 2005-07-02 03:07:16 UTC
Hello,
I tried to build mesa-6.2.1 for 64 Biz on solaris 8 with the 
gcc from sunfreeware. 
gcc -v
Reading specs from /usr/local/lib/gcc/sparc-sun-solaris2.8/3.4.2/specs
Configured with: ../configure --with-as=/usr/ccs/bin/as
--with-ld=/usr/ccs/bin/ld --disable-nls --disable-libgcj
--enable-languages=c,c++
Thread model: posix
gcc version 3.4.2

The first problem was that there was just a sunos5-gcc
in ther config directory so I modified sunos5-gcc.
I changed the CFLAGS and CXXFLAGS from 
-O3 -I/usr/openwin/include -fPIC -fomit-frame-pointer -D_REENTRANT -DUSE_XSHM
-DUSE_SPARC_ASM
to
m64 -mcpu=ultrasparc -mvis -O3 -I/usr/openwin/include -fPIC -fomit-frame-pointer
-D_REENTRANT -DUSE_XSHM -DUSE_SPARC_ASM
The next problem are the sparc asembler files clip.S, lapi_sparc.S,
norm.S and xform.S. (On 32 Bit it compiles fine but on 64 Bit
it produces errors:
...
/usr/ccs/bin/as: "/var/tmp//ccoYW8mj.s", line 187: error: detect global register
use not covered .register pseudo-op
/usr/ccs/bin/as: "/var/tmp//ccoYW8mj.s", line 188: warning: detect global
register use not covered .register pseudo-op
/usr/ccs/bin/as: "/var/tmp//ccoYW8mj.s", line 190: error: detect global register
use not covered .register pseudo-op
/usr/ccs/bin/as: "/var/tmp//ccoYW8mj.s", line 190: error: detect global register
use not covered .register pseudo-op
/usr/ccs/bin/as: "/var/tmp//ccoYW8mj.s", line 191: error: detect global register
use not covered .register pseudo-op

So I commented out the #ifdef SVR4 and
used in Clip.S
        .register %g2, #scratch
        .register %g3, #scratch
        .register %g7, #scratch
Ok, now it compiles the files. For linking the shared lib 
64 Bit I had to change bin/mklib
I tried the following:
LINK="gcc"
OPTS="-m64 -shared -Wl,-Bdynamic"
=> for compiling the demos I changed CC to CXX in the Makefiles

and I tried
LINK="gcc"
OPTS="-m64 -G"
Then everything compiled and linked e.g. ldd gears


 but the application ldd
gears                                                            libX11.so.4
=>   /usr/lib/64/libX11.so.4
        libglut.so =>    ../../lib//libglut.so
        libGLU.so =>     ../../lib//libGLU.so
        libGL.so =>      ../../lib//libGL.so
        libstdc++.so.6 =>        /usr/local/lib/sparcv9//libstdc++.so.6
        libm.so.1 =>     /usr/lib/64/libm.so.1
        libgcc_s.so.1 =>         /usr/local/lib/sparcv9//libgcc_s.so.1
        libc.so.1 =>     /usr/lib/64/libc.so.1
        libXext.so.0 =>  /usr/openwin/lib/sparcv9/libXext.so.0
        libsocket.so.1 =>        /usr/lib/64/libsocket.so.1
        libnsl.so.1 =>   /usr/lib/64/libnsl.so.1
        libdl.so.1 =>    /usr/lib/64/libdl.so.1
        libXmu.so.4 =>   /usr/lib/64/libXmu.so.4
        libXi.so.5 =>    /usr/lib/64/libXi.so.5
        libmp.so.2 =>    /usr/lib/64/libmp.so.2
        libXt.so.4 =>    /usr/openwin/lib/sparcv9/libXt.so.4
        libSM.so.6 =>    /usr/openwin/lib/sparcv9/libSM.so.6
        libICE.so.6 =>   /usr/openwin/lib/sparcv9/libICE.so.6
        libICE.so.6 (SUNWprivate) =>     (version not found)
        libICE.so.6 (SUNWprivate) =>     (version not found)
        /usr/platform/SUNW,Ultra-5_10/lib/sparcv9/libc_psr.so.1
file gears
gears:          ELF 64-bit MSB executable SPARCV9 Version 1, UltraSPARC1
Extensions Required, dynamically linked, not stripped
./gears
Illegal instruction (core dumped)

My gdb is not compiled for 64 Bit so I have no call stack
but I think it is a problem with the assembler files.

It would be nice if somebody of the mesa team could try to
compile mesa 64 Bit on Solaris with the gcc 3.4.2 or newer.


crashed after starting
Comment 1 Ian Romanick 2005-07-05 10:04:16 UTC
I'm working on a fix for this and some other SPARC related assembly issues.  In
general, all of the places that have '#ifdef SVR4' should instead be '#if
defined(SVR4) || defined(__SVR4) || defined(__svr4__)'.

I have also encounterd, and been unable to diagnose, the same crash you mention.
 For 32-bit builds, everthing is fine.  For 64-bit, there are nothing but
problems.  I suspect that we may just disable all the assembly stuff on 64-bit
SPARC for the Mesa 6.3 release (coming soon).  It's still up in the air.

The only SPARC system that I have access to has the same gdb issues you mention,
so debugging is slow going. :(
Comment 2 Ian Romanick 2005-07-05 11:51:39 UTC
Created attachment 3031 [details]
Screenshot of background problem

- The test for whether or not we're building for 64-bit is '#ifdef __arch64__'.
 This appears to be correct on both Linux and Solaris.

- The test for Solaris is now '#if defined(SVR4) || defined(__SVR4) ||
defined(__svr4__)'.  GCC 3.4.0 has all three defined on Solaris 9.

- Enables assembly language clip routines.

- Fixes to make GLSL code build on Solaris.

- Update gl_SPARC_asm.py.  You MUST 'pushd src/mesa/glapi ; make
../sparc/glapi_sparc.S ; popd' before building.

- "Breaks" mklib to enable 64-bit builds.
Comment 3 Ian Romanick 2005-07-09 08:01:19 UTC
Created attachment 3054 [details]
paint-with-alpha-image-out.png

This is essentially the same as the previous patch, but it also adds some fixes
mklib.	The changes to mklib mirror code in the x86-64 path to autodetect
64-bit vs. 32-bit object files and add the appropriate options (i.e., -m32 vs
-m64).
Comment 4 Ian Romanick 2005-07-09 08:03:02 UTC
Created attachment 3055 [details]
scale-source-surface-paint-image-out.png

This is the assembly dispatch code generated by src/mesa/glapi/gl_SPARC_asm.py.
 I have included this for people who do not have the required Python tools
installed.
Comment 5 FreeDesktop Bugzilla Database Corruption Fix User 2005-07-18 19:14:06 UTC
Thank you for working on the problem. I have build a 64 Bit gdb but 
the evening I tried to debug the problem I had a filesystem hard disk
problem so I had to repair everything ...
I'll try to test your patches soon. In the meanwhile I used Mesa 6.0.1.

If you still need the 64 Bit gdb for solaris I can write you a short 
summary how to build and install it. The 64 Bit gdb can debug 32 Bit and
64 Bit programs.

Comment 6 Alan Hourihane 2005-07-19 01:44:18 UTC
Ian, tested here on my ultra60 and things work great!
Comment 7 Ian Romanick 2005-08-06 04:36:10 UTC
My patch is committed, and I haven't heard any complaints.  Closing as fixed.


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.