Subject: problem building magicpoint-1.10a on MacOSX 10.3.3
To: None <>
From: Ronald van der Pol <>
List: tech-pkg
Date: 05/24/2004 22:17:01
(magicpoint-1.10a builds fine on NetBSD/i386)

Building magicpoint-1.10a on MacOSX 10.3.3 fails with:

=2E... /usr/pkg/bin/bmake ctlwords.h
/usr/bin/cc -o ./ctlwords ./ctlwords.c
=2E/ctlwords < ./globals.c > ctlwords.h
*** Error code 138



The ctlwords executable does not work:
spock# cd work/magicpoint-1.10a/
spock# ./ctlwords=20
Bus error


This is the MacOSX coredump info:

Host Name:      spock-rfc1918
Date/Time:      2004-05-24 22:03:43 +0200
OS Version:     10.3.3 (Build 7F44)
Report Version: 2

Command: ctlwords
Path:    ./ctlwords
Version: ??? (???)
PID:     24662
Thread:  0

Exception:  EXC_BAD_ACCESS (0x0001)
Codes:      KERN_PROTECTION_FAILURE (0x0002) at 0x00000000

Thread 0 Crashed:
0   libSystem.B.dylib   0x9001f754 malloc_create_zone + 0x34
1   libSystem.B.dylib   0x9002bea4 _malloc_initialize + 0x24
2   libSystem.B.dylib   0x90001f50 malloc + 0x30
3   libSystem.B.dylib   0x90021198 __smakebuf + 0x58
4   libSystem.B.dylib   0x90033c90 __swsetup + 0xb0
5   libSystem.B.dylib   0x90003938 __vfprintf + 0x78
6   libSystem.B.dylib   0x9000c76c vfprintf + 0x4c
7   libSystem.B.dylib   0x9002ad1c printf + 0x3c
8   ctlwords            0x00001738 main + 0x38

PPC Thread State:
  srr0: 0x9001f754 srr1: 0x0000f030                vrsave: 0x00000000
    cr: 0x22000448  xer: 0x0000001d   lr: 0x9001f750  ctr: 0x8fe12c5c
    r0: 0x9001f750   r1: 0xbffff424   r2: 0x8fe507cc   r3: 0x00002008
    r4: 0x00000000   r5: 0x00000000   r6: 0x8fe5322c   r7: 0x000034bc
    r8: 0x000034b0   r9: 0x000034bc  r10: 0x00000000  r11: 0x22000448
   r12: 0x00000005  r13: 0x00000000  r14: 0x00000000  r15: 0x00000000
   r16: 0x00000000  r17: 0x00000000  r18: 0xa00010a4  r19: 0x00000000
   r20: 0x00000000  r21: 0x00000000  r22: 0x00000000  r23: 0x00000000
   r24: 0x00000000  r25: 0x00000000  r26: 0xbffffe00  r27: 0xbffff9c0
   r28: 0x00001f08  r29: 0x00000000  r30: 0x00000000  r31: 0x9001f728

Binary Images Description:
    0x1000 -     0x1fff ctlwords        ./ctlwords
0x8fe00000 - 0x8fe4ffff dyld    /usr/lib/dyld
0x90000000 - 0x90122fff libSystem.B.dylib       /usr/lib/libSystem.B.dylib
0x939d0000 - 0x939d4fff libmathCommon.A.dylib   /usr/lib/system/libmathComm=


spock#  gdb ctlwords
GNU gdb 5.3-20030128 (Apple version gdb-309) (Thu Dec  4 15:41:30 GMT 2003)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain condition=
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "powerpc-apple-darwin".
Reading symbols for shared libraries .. done
(gdb) run
Starting program: /Volumes/misc/pkgsrc/graphics/magicpoint/work/magicpoint-=
Reading symbols for shared libraries . done

Program received signal EXC_BAD_ACCESS, Could not access memory.
0x9001f754 in malloc_create_zone ()


This is the command that built ctlwords:

cd /Volumes/misc/pkgsrc/graphics/magicpoint/work/magicpoint-1.10a; /usr/bin=
/env USETOOLS=3Dno MAKECONF=3D/dev/null USETOOLS=3D"no" OBJECT_FMT=3D"Mach-=
O" LDFLAGS=3D" -L/usr/pkg/lib -L/usr/X11R6/lib" RPATH_FLAG=3D"-L" WHOLE_ARC=
HIVE_FLAG=3D"-Wl,--whole-archive" NO_WHOLE_ARCHIVE_FLAG=3D"-Wl,--no-whole-a=
rchive" LINK_ALL_LIBGCC_HACK=3D"" PATH=3D/Volumes/misc/pkgsrc/graphics/magi=
in:/usr/sbin:/usr/pkg/bin:/usr/X11R6/bin PREFIX=3D/usr/pkg LOCALBASE=3D/usr=
/pkg X11BASE=3D/usr/X11R6 CFLAGS=3D"-O2 -I/usr/pkg/include -I/usr/pkg/inclu=
de/freetype2" CPPFLAGS=3D" -no-cpp-precomp -I/usr/pkg/include -I/usr/pkg/in=
clude/freetype2" FFLAGS=3D"-O" X11PREFIX=3D/usr/pkg CC=3D"gcc" CXX=3D"g++" =
"install -c -s -o root -g wheel -m 555"                 BSD_INSTALL_SCRIPT=
=3D"install -c -o root -g wheel -m 555" BSD_INSTALL_LIB=3D"install -c -o ro=
ot -g wheel -m 555"                    BSD_INSTALL_DATA=3D"install -c -o ro=
ot -g wheel -m 444"                   BSD_INSTALL_MAN=3D"install -c -o root=
 -g wheel -m 444"                    BSD_INSTALL=3D"install"  BSD_INSTALL_P=
ROGRAM_DIR=3D"install -d -o root -g wheel -m 755"     BSD_INSTALL_SCRIPT_DI=
R=3D"install -d -o root -g wheel -m 755"             BSD_INSTALL_LIB_DIR=3D=
"install -d -o root -g wheel -m 755"                BSD_INSTALL_DATA_DIR=3D=
"install -d -o root -g wheel -m 755"               BSD_INSTALL_MAN_DIR=3D"i=
nstall -d -o root -g wheel -m 755"                BSD_INSTALL_GAME=3D"insta=
ll -c -s -o root -g wheel -m 555" PKG_SYSCONFDIR=3D"/usr/pkg/etc" INSTALL_I=
o" MAKEINFO=3D"/Volumes/misc/pkgsrc/graphics/magicpoint/work/.tools/bin/mak=
einfo" BUILDLINK_CACHE_ALL=3Dyes  VIEWBASE=3D/usr/pkg /usr/pkg/bin/bmake ct=


The problem lies with the PATH environment variable. When I remove
/Volumes/misc/pkgsrc/graphics/magicpoint/work/.buildlink/bin from
the PATH, the problem disappears.

spock# cd /Volumes/misc/pkgsrc/graphics/magicpoint/work/magicpoint-1.10a; /=
usr/bin/env USETOOLS=3Dno MAKECONF=3D/dev/null USETOOLS=3D"no" OBJECT_FMT=
=3D"Mach-O" LDFLAGS=3D" -L/usr/pkg/lib -L/usr/X11R6/lib" RPATH_FLAG=3D"-L" =
WHOLE_ARCHIVE_FLAG=3D"-Wl,--whole-archive" NO_WHOLE_ARCHIVE_FLAG=3D"-Wl,--n=
o-whole-archive" LINK_ALL_LIBGCC_HACK=3D"" PATH=3D/Volumes/misc/pkgsrc/grap=
/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/pkg/bin:/usr/X11R6/bin PREFIX=3D/u=
sr/pkg LOCALBASE=3D/usr/pkg X11BASE=3D/usr/X11R6 CFLAGS=3D"-O2 -I/usr/pkg/i=
nclude -I/usr/pkg/include/freetype2" CPPFLAGS=3D" -no-cpp-precomp -I/usr/pk=
g/include -I/usr/pkg/include/freetype2" FFLAGS=3D"-O" X11PREFIX=3D/usr/pkg =
 BSD_INSTALL_PROGRAM=3D"install -c -s -o root -g wheel -m 555"             =
    BSD_INSTALL_SCRIPT=3D"install -c -o root -g wheel -m 555" BSD_INSTALL_L=
IB=3D"install -c -o root -g wheel -m 555"                    BSD_INSTALL_DA=
TA=3D"install -c -o root -g wheel -m 444"                   BSD_INSTALL_MAN=
=3D"install -c -o root -g wheel -m 444"                    BSD_INSTALL=3D"i=
nstall"  BSD_INSTALL_PROGRAM_DIR=3D"install -d -o root -g wheel -m 755"    =
 BSD_INSTALL_SCRIPT_DIR=3D"install -d -o root -g wheel -m 755"             =
BSD_INSTALL_LIB_DIR=3D"install -d -o root -g wheel -m 755"                B=
SD_INSTALL_DATA_DIR=3D"install -d -o root -g wheel -m 755"               BS=
D_INSTALL_MAN_DIR=3D"install -d -o root -g wheel -m 755"                BSD=
_INSTALL_GAME=3D"install -c -s -o root -g wheel -m 555" PKG_SYSCONFDIR=3D"/=
usr/pkg/etc" INSTALL_INFO=3D"/Volumes/misc/pkgsrc/graphics/magicpoint/work/=
.tools/bin/install-info" MAKEINFO=3D"/Volumes/misc/pkgsrc/graphics/magicpoi=
nt/work/.tools/bin/makeinfo" BUILDLINK_CACHE_ALL=3Dyes  VIEWBASE=3D/usr/pkg=
 /usr/pkg/bin/bmake ctlwords.h
/usr/bin/cc -o ./ctlwords ./ctlwords.c
=2E/ctlwords < ./globals.c > ctlwords.h


Any idea what is going on?