Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Prefixing OS X.4 on a G3: libffi wrong cpusubtype
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on Alternative Architectures
View previous topic :: View next topic  
Author Message
dobbs
Tux's lil' helper
Tux's lil' helper


Joined: 20 Aug 2005
Posts: 92
Location: Wenatchee, WA

PostPosted: Wed Dec 28, 2011 3:02 am    Post subject: Prefixing OS X.4 on a G3: libffi wrong cpusubtype Reply with quote

So I'm installing Portage Prefix on an old G3 Powerbook running OS X Tiger, and everything's bootstrapping fine until it tries to emerge python as a portage dependency:
Code:
powerpc-apple-darwin8-gcc -bundle -undefined dynamic_lookup -Wl,-dead_strip_dylibs -L/opt/gentoo/lib -L/opt/gentoo/usr/lib -L. -Wl,-dead_strip_dylibs -L/opt/gentoo/lib -L/opt/gentoo/usr/lib -L. -fno-strict-aliasing -fno-common -dynamic -O3 -mcpu=G3 -mtune=G3 -fwrapv -I/opt/gentoo/usr/include -DNDEBUG -I. -IInclude -I./Include build/temp.macosx-10.4-ppc-2.7/opt/gentoo/var/tmp/portage/dev-lang/python-2.7.2-r3/work/Python-2.7.2/Modules/_ctypes/_ctypes.o build/temp.macosx-10.4-ppc-2.7/opt/gentoo/var/tmp/portage/dev-lang/python-2.7.2-r3/work/Python-2.7.2/Modules/_ctypes/callbacks.o build/temp.macosx-10.4-ppc-2.7/opt/gentoo/var/tmp/portage/dev-lang/python-2.7.2-r3/work/Python-2.7.2/Modules/_ctypes/callproc.o build/temp.macosx-10.4-ppc-2.7/opt/gentoo/var/tmp/portage/dev-lang/python-2.7.2-r3/work/Python-2.7.2/Modules/_ctypes/stgdict.o build/temp.macosx-10.4-ppc-2.7/opt/gentoo/var/tmp/portage/dev-lang/python-2.7.2-r3/work/Python-2.7.2/Modules/_ctypes/cfield.o build/temp.macosx-10.4-ppc-2.7/opt/gentoo/var/tmp/portage/dev-lang/python-2.7.2-r3/work/Python-2.7.2/Modules/_ctypes/malloc_closure.o build/temp.macosx-10.4-ppc-2.7/opt/gentoo/var/tmp/portage/dev-lang/python-2.7.2-r3/work/Python-2.7.2/Modules/_ctypes/darwin/dlfcn_simple.o -L/opt/gentoo/lib -L/opt/gentoo/usr/lib -L. -lffi -o build/lib.macosx-10.4-ppc-2.7/_ctypes.bundle
*** WARNING: renaming "_ctypes" since importing it failed: dlopen(build/lib.macosx-10.4-ppc-2.7/_ctypes.bundle, 2): Library not loaded: /opt/gentoo/usr/lib/libffi.5.dylib
  Referenced from: build/lib.macosx-10.4-ppc-2.7/_ctypes.bundle
  Reason: no suitable image found.  Did find:
        /opt/gentoo/usr/lib/libffi.5.dylib: incompatible cpu-subtype

Python build finished, but the necessary bits to build these modules were not found:
_bsddb             bsddb185           dbm             
gdbm               linuxaudiodev      ossaudiodev     
spwd               sunaudiodev                       
To find the necessary bits, look in setup.py in detect_modules() for the module's name.


Failed to build these modules:
_ctypes                                               


It turns out libffi is getting the ppc7400 (G4) cpusubtype in the ELF header:
Code:
dobbs@wallstreet /opt/gentoo $ otool -vh usr/lib/libffi.5.dylib
usr/lib/libffi.5.dylib:
Mach header
      magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
   MH_MAGIC     PPC    ppc7400  0x00       DYLIB     8       1088   NOUNDEFS DYLDLINK TWOLEVEL NO_REEXPORTED_DYLIBS


I did set CFLAGS="-mcpu=G3 -mtune=G3" and CXXFLAGS="${CFLAGS}" before re-emerging libffi, but that didn't help. All other libs get the proper cpusubtype.

The version of libffi installed by macports doesn't have this problem. Swapping the portage dylib with a symlink to the one from macports seems to work (they're both version 3.0.10); python builds fine with that. Trouble is, that'll get clobbered with any libffi rebuilds or updates.

I don't have a clue how to fix this properly... Should I file a bug or what?
Back to top
View user's profile Send private message
dobbs
Tux's lil' helper
Tux's lil' helper


Joined: 20 Aug 2005
Posts: 92
Location: Wenatchee, WA

PostPosted: Thu Jan 12, 2012 9:20 pm    Post subject: Reply with quote

Further adventures with this machine:

binutils-apple
binutils-apple tries to update to binutils-apple-4.2 during the emerge -e system step of the bootstrap and completely fails. I bypassed it with an emerge --resume --skipfirst, choosing to continue using binutils-apple-3.2 and everything else built fine (as long as I continued using the macports libffi).

emerge -e system also updates gcc-apple to 4.2.1_p5666. I'm a little worried about this, because the bootstrap docs say I need binutils-apple-4.2 when using gcc-apple-4.2.1. I haven't noticed any problems though. Perhaps it's only needed when using the X-Code version of gcc 4.2.1?

cutecom
This is my first major issue with the prefix. Cutecom was my primary stimulus for installing Portage Prefix. It also apparently natively supports Mac OS X, and tries to install an app bundle in /Applications, outside the prefix root:

Code:
>>> Source compiled.
>>> Test phase [not enabled]: net-dialup/cutecom-0.22.0

>>> Install cutecom-0.22.0 into /opt/gentoo/var/tmp/portage/net-dialup/cutecom-0.22.0/image/ category net-dialup
>>> Working in BUILD_DIR: "/opt/gentoo/var/tmp/portage/net-dialup/cutecom-0.22.0/work/cutecom-0.22.0_build"
make DESTDIR=/opt/gentoo/var/tmp/portage/net-dialup/cutecom-0.22.0/image/ install
[100%] Built target cutecom
Install the project...
-- Install configuration: "Gentoo"
-- Installing: /opt/gentoo/var/tmp/portage/net-dialup/cutecom-0.22.0/image/Applications/CuteCom.app
-- Installing: /opt/gentoo/var/tmp/portage/net-dialup/cutecom-0.22.0/image/Applications/CuteCom.app/Contents
-- Installing: /opt/gentoo/var/tmp/portage/net-dialup/cutecom-0.22.0/image/Applications/CuteCom.app/Contents/Info.plist
-- Installing: /opt/gentoo/var/tmp/portage/net-dialup/cutecom-0.22.0/image/Applications/CuteCom.app/Contents/MacOS
-- Installing: /opt/gentoo/var/tmp/portage/net-dialup/cutecom-0.22.0/image/Applications/CuteCom.app/Contents/MacOS/CuteCom
-- Installing: /opt/gentoo/var/tmp/portage/net-dialup/cutecom-0.22.0/image/opt/gentoo/usr/share/man/man1/cutecom.1
>>> Completed installing cutecom-0.22.0 into /opt/gentoo/var/tmp/portage/net-dialup/cutecom-0.22.0/image/

ecompressdir: bzip2 -9 /usr/share/man
 * QA Notice: the following files are outside of the prefix:
 * /Applications
 * /Applications/CuteCom.app
 * /Applications/CuteCom.app/Contents
 * /Applications/CuteCom.app/Contents/Info.plist
 * /Applications/CuteCom.app/Contents/MacOS
 * /Applications/CuteCom.app/Contents/MacOS/CuteCom
 * ERROR: net-dialup/cutecom-0.22.0 failed:
 *   Aborting due to QA concerns: there are files installed outside the prefix
 *
 * Call stack:
 *   misc-functions.sh, line 1855:  Called install_qa_check
 *   misc-functions.sh, line  253:  Called install_qa_check_prefix
 *   misc-functions.sh, line  889:  Called die
 * The specific snippet of code:
 *                      die "Aborting due to QA concerns: there are files installed outside the prefix"


I'm guessing this a bug in the ebuild; it doesn't seem like Prefix wants ebuilds installing apps like that. However, now I realize I can try building cutecom from source without the aid of a package manager...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on Alternative Architectures All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum