Bug 7275 - liboil 0.3.9 compile error on Mac OS X 10.4
Summary: liboil 0.3.9 compile error on Mac OS X 10.4
Status: RESOLVED FIXED
Alias: None
Product: liboil
Classification: Unclassified
Component: unknown (show other bugs)
Version: unspecified
Hardware: PowerPC Mac OS X (All)
: high normal
Assignee: David Schleef
QA Contact: David Schleef
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-19 17:12 UTC by Benjamin Reed
Modified: 2007-03-18 07:21 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
This file was requested for debugging (18.65 KB, text/plain)
2006-06-20 01:13 UTC, Per
Details
asm patch for ppc (465 bytes, patch)
2006-07-02 18:46 UTC, Benjamin Reed
Details | Splinter Review
using sysctl (1023 bytes, patch)
2006-07-02 19:38 UTC, Benjamin Reed
Details | Splinter Review

Description Benjamin Reed 2006-06-19 17:12:19 UTC
I'd give you more if I could figure out how, but it's dying somewhere in the asm
and I'm not sure how to ferret out where since it's a temp file:

/bin/sh ../libtool --tag=CC --mode=compile /usr/bin/gcc -DHAVE_CONFIG_H -I. -I.
-I..   -I/sw/include -Wall -force_cpusubtype_ALL -D_BSD_SOURCE -D_GNU_SOURCE
-I.. -g -O2 -c -o liboil_0.3_la-liboilcpu.lo `test -f 'liboilcpu.c' || echo
'./'`liboilcpu.c
 /usr/bin/gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/sw/include -Wall
-force_cpusubtype_ALL -D_BSD_SOURCE -D_GNU_SOURCE -I.. -g -O2 -c liboilcpu.c 
-fno-common -DPIC -o .libs/liboil_0.3_la-liboilcpu.o
/var/tmp//ccvqR3pE.s:380:Parameter syntax error (parameter 1)
make[1]: *** [liboil_0.3_la-liboilcpu.lo] Error 1

Is there an easy way to get gcc to tell me where the code's coming from?
Comment 1 Per 2006-06-20 01:13:38 UTC
Created attachment 5988 [details]
This file was requested for debugging

I had the same problem. Attached is a file that was requested on the mailing
list for debugging purposes. I tried to compile on MacOSX 10.4.2, with gcc
version 4.0.1
Comment 2 Benjamin Reed 2006-07-02 18:22:15 UTC
btw, it builds on 10.4/x86 now, just not on ppc
Comment 3 Benjamin Reed 2006-07-02 18:46:56 UTC
Created attachment 6101 [details] [review]
asm patch for ppc

I talked to one of the gcc folks who hangs around in darwin channels, and he
says the attached patch fixes it (I don't understand asm *nor* altivec, so I
can't speak for it's validity).

He said, however:

<pinskia> anyways the best way to have the illegal instruction to hit for
altivec is asm volatile ("vor v0,v0,v0");
<RangerRick> ok
<pinskia> which is a nop and does not change any register
<pinskia> unlike their current check which changes v0 which could cause things
to go bad
<pinskia> #ifdef __MACH__
<pinskia>   asm volatile ("vor v0,v0,v0");
<pinskia> #else
<pinskia>   asm volatile ("vor 0,0,0");
<pinskia> #endif
<pinskia> is what is used in GCC
Comment 4 Benjamin Reed 2006-07-02 18:49:34 UTC
after more discussion, it was also discussed that the "correct" way to do this
on osx is a sysctl:

http://developer.apple.com/hardwaredrivers/ve/g3_compatibility.html
Comment 5 Benjamin Reed 2006-07-02 19:38:07 UTC
Created attachment 6103 [details] [review]
using sysctl

yeah, the previous asm patch caused osx to pop up a crash error, and the tests
don't pass...

However, with this new patch using sysctl (and the powerpc md5 code disabled)
all tests pass on 10.3/ppc and 10.4/ppc.

The mmx_engine.c file fails to compile on x86 though, with this error:

/usr/bin/gcc -DHAVE_CONFIG_H -I. -I. -I..   -Os -I/fink/include -Wall
-D_BSD_SOURCE -D_GNU_SOURCE -I.. -Os -c mmx_engine.c			       
			    
/var/tmp//cc4iMVAh.s:368:Alignment too large: 15. assumed.		       
									       
		  
/var/tmp//cc4iMVAh.s:416:Alignment too large: 15. assumed.		       
									       
		  
/var/tmp//cc4iMVAh.s:461:Alignment too large: 15. assumed.		       
									       
		  
/var/tmp//cc4iMVAh.s:506:Alignment too large: 15. assumed.		      

(and a billion more)

changing ".align 16" to ".align 4" fixes it (and all tests pass), but I don't
know what's actually happening there, so it's probably wrong.  :)

I also get some "OIL: ERROR liboilcpu.c 549: oil_cpu_detect_kernel_support():
Operating system is not known to support SSE.  Assuming it does, which might
cause problems" warnings, adding "&& !defined(__APPLE__)" fixes it.
Comment 6 Benjamin Reed 2006-07-02 19:48:38 UTC
looks like apple has the same sysctl as freebsd, so in liboilcpu.c you could
really change the #ifdef __FreeBSD__ to:

#if defined(__FreeBSD__) || defined(__APPLE__)

test suite still passes with this enabled

I realized that the sysctl bit is probably not portable to linux/ppc etc, so I
guess it still needs to be refactored, but at least things are working on ppc
for now, enough that I cna release fink packages.  :)
Comment 7 Per 2006-07-27 02:33:58 UTC
Patch in comment#5 works for me (PPC MacosX 10.4).
Comment 8 Per 2006-07-27 03:30:37 UTC
Well, I got liboil itself to compile, along with most of the testsuite, using the patch in comment#5, but 
other tests and some of the example directories fail to compile:

nader:~/tests/liboil/examples/md5 perim$ make
/bin/sh ../../libtool --mode=link gcc  -g -O2   -o md5sum  md5sum-md5sum.o ../../liboil/
liboil-0.3.la 
gcc -g -O2 -o .libs/md5sum md5sum-md5sum.o  ../../liboil/.libs/liboil-0.3.0.1.0.dylib -lm
/usr/bin/ld: Undefined symbols:
_oil_function_class_ptr_md5
collect2: ld returned 1 exit status
make: *** [md5sum] Error 1

nader:~/tests/liboil/examples/taylor perim$ make
/bin/sh ../../libtool --mode=link gcc  -g -O2   -o example1  example1-example1.o ../../liboil/
liboil-0.3.la 
gcc -g -O2 -o .libs/example1 example1-example1.o  ../../liboil/.libs/liboil-0.3.0.1.0.dylib -lm
/usr/bin/ld: Undefined symbols:
_oil_function_class_ptr_add_f32
_oil_function_class_ptr_multiply_f32
_oil_function_class_ptr_scalaradd_f32_ns
_oil_function_class_ptr_scalarmultiply_f32_ns
collect2: ld returned 1 exit status
make: *** [example1] Error 1

etc
Comment 9 David Schleef 2007-03-17 17:38:36 UTC
Ping.  Please try compiling 0.3.11.
Comment 10 Benjamin Reed 2007-03-18 07:21:59 UTC
I can't reproduce this on 10.4/ppc with 0.3.11, marking 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.