On Thu, Oct 01, 2009 at 11:49:50PM -0500, DRC wrote:
> I've uncovered a pretty serious problem with libjpeg/SIMD whenever it is
> built with Xcode 3.x on OS X 10.5 or 10.6.  It basically generates a
> corrupted JPEG stream.  This problem occurs only with the SIMD
> extensions enabled, but it also occurs on older revisions of the library
> (prior to any modifications I made.)  Curiously, if I build on an older
> system running 10.4 and Xcode 2.5 and bring the binary over to the 10.6
> system, everything works fine.  It's just the act of building on 10.6
> with Xcode 3.2 or 10.5 using Xcode 3.1 that causes issues.

Hm, this is a nasty problem and finding the solution will be even nastier.

I have no experience with Xcode but I would recommend to build library
without all optimizations (disable both compiler and nasm
optimizations) and check if it is still broken.

If yes then I don't know better approach than compile libjpeg
with no optimizations via old and new Xcode, disassemble affected
parts of code (probably simd/*.o object files) and try to figure
differences and isolate what exactly is broken. I can help you (hopefully)
if you upload old/new files somewhere.

> I've tried building the code both with and without PIC, using the 10.4,
> 10.5, and 10.6 compatibility SDK's, using NASM 0.98, 2.05.01, and 2.07.
>  Curiously, with NASM 2.07, it doesn't build at all, giving me the
> following error:
> ld: in ./.libs/libjpeg.a(jcsammmx.o), malformed .o file, symbol
> const_base with address 0x1B4 is not with section 2 (__DATA,__const)
> address range of 0x1C0 to 0x1C0
> I suspect the latter may be related to this NASM bug:
> http://www.nabble.com/--nasm-Bugs-2840300---Macho-alignment-broken-td25044061.html

I'm quite sure you are right.

> However, the more general problem is, I suspect, related to PIC
> generation.  I'm not quite sure what may have changed about this in
> Xcode 3.x vs. 2.5, but whatever it was, it seems to have broken our
> build.  Hoping someone might have any ideas about other things to try.

Hm, PIC code shouln't be needed at all in our project because we are
shipping no libraries. In GNU build chain it is possible to disable
PIC generation with `--disable-shared` configure flag. Is it possible
to disable PIC code in Xcode as well?

Regards, Adam

Adam Tkac, Red Hat, Inc.

Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
Tigervnc-devel mailing list

Reply via email to