Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 62277 - Patch: dev-util/guile-1.6.4-r1
Summary: Patch: dev-util/guile-1.6.4-r1
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: PPC All
: High normal (vote)
Assignee: osx porters
URL:
Whiteboard:
Keywords:
Depends on: 65272
Blocks: 62308 63737 79535
  Show dependency tree
 
Reported: 2004-08-30 10:50 UTC by Robin Munn
Modified: 2005-08-27 05:16 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
guile-macos-configure.patch (guile-macos-configure.patch,2.63 KB, patch)
2004-08-30 10:53 UTC, Robin Munn
Details | Diff
guile-macos-ltmain.patch (guile-macos-ltmain.patch,28.34 KB, patch)
2004-08-30 10:53 UTC, Robin Munn
Details | Diff
guile-macos-posix.patch (guile-macos-posix.patch,405 bytes, patch)
2004-08-30 10:54 UTC, Robin Munn
Details | Diff
guile-1.6.4-r1.ebuild.patch (guile-1.6.4-r1.ebuild.patch,779 bytes, patch)
2004-08-30 10:56 UTC, Robin Munn
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Munn 2004-08-30 10:50:31 UTC
dev-util/guile-1.6.4-r1 needs several patches to make it compile and install cleanly on macos. The first symptom is "gc_os_dep.c:380: error: parse error before '--' token". gc_os_dep.c is full of "#if defined(...)" statements designed to identify the OS that guile is being compiled on and then create some #defines to describe that OS's particular stack behavior. The #ifdef's don't properly recognize OS X. The solution is to add '-Dmacosx' to CFLAGS; this triggers the proper #define's in gc_os_dep.c and several other source files.

After gc_os_dep.c is taken care of, the next problem is an "ld: Undefined symbols: _environ" error during linking. It seems that on OS X, the _environ symbol (which lives in /usr/lib/crt1.o) is only available to programs, not to shared libraries. Here it seems that adding the options "-flat_namespace -undefined suppress" to the linking step is the way to go: this suppresses the errors about undefined symbols during linking, deferring the symbol resolution to runtime. And at runtime, /usr/lib/crt1.o will be available to the executable; problem solved.

The next, and most irritating, problem was a libtool quirk. Guile has two libraries, libguile and libguile-ltdl. When the .dylib files are built, they're kept in the libguile/.libs and libguile-ltdl/.libs directories respectively. But during the install phase, after libguile-ltdl is installed into /var/tmp/portage/guile-1.6.4-r1/image//usr/lib/, libtool thinks it should be looking in /usr/lib for it instead of /var/tmp/portage/(etc). And thus it fails to install libguile properly after installing libguile-ltdl. This caused me many, *many* hours of frustration peering at libtool internals. What finally worked was a patch from DarwinPorts (thanks, DarwinPorts folks!) that actually *downgrades* the included ltmain.sh in the guile distribution. It includes ltmain.sh version 1.4.3, but the patch downgrades it to 1.4.2. I don't know exactly what changed between these versions, but that works.

That was all that was needed to make guile compile and run. There was one final patch from DarwinPorts that I also used, which patched the posix.c file to make the putenv function work properly. (putenv "foo=bar") worked as designed, but (putenv "foo") would fail with a "file not found" error. That form of putenv, (putenv "foo") with no equal sign in the parameter, is supposed to remove the variable "foo" from the process environment. The DarwinPorts patch makes that happen correctly.

Finally, credit where credit is due: the hard work that the DarwinPorts folks put into solving these problems some time ago meant that I actually had a solution available when I needed it. Three cheers for DarwinPorts! Huzzah!

Reproducible: Always
Steps to Reproduce:
1. emerge -av guile. Fails.
2. Tweak ebuild to include several patches from DarwinPorts.
3. emerge -av guile. Works.




emerge info:
Portage 20040726 (default-macos-10.3, gcc-3.3, unavailable, 7.5.0 Power
Macintosh powerpc)
=================================================================
System uname: 7.5.0 Power Macintosh powerpc
macos-20040726
distcc 2.0.1-zeroconf powerpc-apple-darwin7.0 (protocol 1) (default port 3632)
[disabled]
Autoconf: 
Automake: 
Binutils: 
ACCEPT_KEYWORDS="macos"
AUTOCLEAN="yes"
CFLAGS="-O2 -pipe"
CHOST="powerpc-apple-darwin"
COMPILER=""
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config
/usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
CXXFLAGS="-O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="collision-protect cvs keepwork"
GENTOO_MIRRORS="http://gentoo.osuosl.org/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="macos gdbm jpeg ncurses png python readline slang ssl"
Comment 1 Robin Munn 2004-08-30 10:53:04 UTC
Created attachment 38521 [details, diff]
guile-macos-configure.patch

Here's the patch that takes care of the dynamic library linking issue.
Comment 2 Robin Munn 2004-08-30 10:53:43 UTC
Created attachment 38522 [details, diff]
guile-macos-ltmain.patch

Here's the patch (from DarwinPorts) to downgrade ltmain.sh.
Comment 3 Robin Munn 2004-08-30 10:54:15 UTC
Created attachment 38523 [details, diff]
guile-macos-posix.patch

Here's the patch to posix.c to correct the putenv behavior.
Comment 4 Robin Munn 2004-08-30 10:56:01 UTC
Created attachment 38524 [details, diff]
guile-1.6.4-r1.ebuild.patch

Here's a patch to make the existing guile-1.6.4-r1 ebuild compile and work on
macos. That's the last of the patches needed to make things work for me.
Comment 5 Pieter Van den Abeele (RETIRED) gentoo-dev 2004-09-24 19:02:27 UTC
Depends on design issue 65272 - Marked as patch included
Comment 6 Mamoru KOMACHI (RETIRED) gentoo-dev 2004-10-10 10:23:32 UTC
Applied slightly modified patches and committed. Thanks!
Comment 7 Roman Dilken 2004-10-11 01:17:54 UTC
When will this patched version appear in portage? At the moment it still breaks with de gc_os_dep.c error.
Comment 8 Mamoru KOMACHI (RETIRED) gentoo-dev 2004-10-12 06:21:58 UTC
It is avaiable at the moment. Please run `emerge sync` and try again.
Comment 9 Lina Pezzella (RETIRED) gentoo-dev 2005-02-05 17:31:27 UTC
Reopening this bug to keep the history, since it might be a related issue. The new version of guile
1.6.7 dies with the following:

rm -f .libs/guile.nm .libs/guile.nmS .libs/guile.nmT
creating .libs/guileS.c
(cd .libs && gcc  -c -fno-builtin "guileS.c")
rm -f .libs/guileS.c .libs/guile.nm .libs/guile.nmS .libs/guile.nmT
gcc -fast -fPIC -mcpu=7450 -pipe -no-cpp-precomp -Dmacosx -Wall -Wmissing-prototypes -fno-strict-aliasing -o guile .libs/guileS.o guile.o  ./.libs/libguile /var/tmp/portage/guile-1.6.7/work/guile-1.6.7/libguile/.././libguile-ltdl/.libs/libguile-ltdl -ldl -lm
ld: warning multiple definitions of symbol _environ
/usr/lib/crt1.o definition of _environ in section (__DATA,__data)
./.libs/libguile(posix.o) definition of _environ
rm -f .libs/guileS.o
cat alist.doc arbiters.doc async.doc backtrace.doc boolean.doc chars.doc continuations.doc debug.doc dynl.doc dynwind.doc environments.doc eq.doc error.doc eval.doc evalext.doc extensions.doc feature.doc fluids.doc fports.doc gc.doc goops.doc gsubr.doc guardians.doc hash.doc hashtab.doc hooks.doc init.doc ioext.doc iselect.doc keywords.doc lang.doc list.doc load.doc macros.doc mallocs.doc modules.doc numbers.doc objects.doc objprop.doc options.doc pairs.doc ports.doc print.doc procprop.doc procs.doc properties.doc random.doc rdelim.doc read.doc root.doc rw.doc scmsigs.doc script.doc simpos.doc smob.doc sort.doc srcprop.doc stackchk.doc stacks.doc stime.doc strings.doc strop.doc strorder.doc strports.doc struct.doc symbols.doc throw.doc values.doc variable.doc vectors.doc version.doc vports.doc weaks.doc symbols-deprecated.doc ramap.doc unif.doc filesys.doc posix.doc net_db.doc socket.doc regex-posix.doc | GUILE="/var/tmp/portage/guile-1.6.7/work/guile-1.6.7/pre-inst-guile" ../scripts/snarf-check-and-output-texi --manual > guile.texi || { rm guile.texi; false; }
cat: stdout: Broken pipe
make[2]: *** [guile.texi] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

!!! ERROR: dev-util/guile-1.6.7 failed.
!!! Function src_compile, Line 59, Exitcode 2
!!! make failed
!!! If you need support, post the topmost build error, NOT this status message
Comment 10 Kito (RETIRED) gentoo-dev 2005-08-07 12:01:19 UTC
1.6.7 inCVS.
Comment 11 Fabian Groffen gentoo-dev 2005-08-27 05:16:40 UTC
Guile has always depended on readline, which is by default not available on OSX.

masking guile and it's use flag for OSX