
I'm new to Haskell (and GHC) and am not sure if this is the appropriate place to post this (or if it should be reported as a bug). Yesterday I downloaded the binary build of 6.6 for the PPC Mac. I am running Mac OSX 10.4.8. I have XCode 2.4.1 and X11 1.1 installed. I was trying to get the graphics for SOE working and tried the first SimpleGraphics module. I used "import Graphics.SOE" and once I discovered that I had to set DYLD_LIBRARY_PATH to the X11 libraries (in /usr/X116/lib), the module loaded in ghci. When I tried to run main0, I got the following error message: Loading package X11-1.1 ... linking ... <interactive>: /opt/local/lib/ghc-6.6/HSX11_cbits.o: unknown symbol `_printf$LDBLStub' ghc-6.6: unable to load package `X11-1.1' I ran nm on that object file and the symbol appears in it as undefined, and is not defined in any of the .o or .a files in the ghc lib directory. I subsequently built the DarwinPorts version of ghc 6.6 and have the same problem. Penny

This problem pops up sometimes for all sorts of open source software (try Googling _printf$LDBLStub), and can be due to mixing modules compiled by gcc 3.3 and gcc 4.0, and/or due to failure to link with - lSystemStubs. I've had good luck using X11 with GHC if I launch it first, and run GHC from inside Xterm rather than Terminal. That way you don't need to fiddle with DYLD_LIBRARY_PATH. I haven't tried it on PPC, though, just Intel. I'll try it at work tomorrow. You might want to do "gcc_select" and see which version of gcc is the default on your system, though is likely not the issue since you had problems with the binary distribution. Deborah On Nov 5, 2006, at 7:23 AM, Melissa Chase wrote:
I'm new to Haskell (and GHC) and am not sure if this is the appropriate place to post this (or if it should be reported as a bug). Yesterday I downloaded the binary build of 6.6 for the PPC Mac. I am running Mac OSX 10.4.8. I have XCode 2.4.1 and X11 1.1 installed.
I was trying to get the graphics for SOE working and tried the first SimpleGraphics module. I used "import Graphics.SOE" and once I discovered that I had to set DYLD_LIBRARY_PATH to the X11 libraries (in /usr/X116/lib), the module loaded in ghci. When I tried to run main0, I got the following error message:
Loading package X11-1.1 ... linking ... <interactive>: /opt/local/lib/ghc-6.6/HSX11_cbits.o: unknown symbol `_printf $LDBLStub' ghc-6.6: unable to load package `X11-1.1'
I ran nm on that object file and the symbol appears in it as undefined, and is not defined in any of the .o or .a files in the ghc lib directory.
I subsequently built the DarwinPorts version of ghc 6.6 and have the same problem.
Penny
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Hi, I have the same problem both with the binary distribution and ghc compiled from macports/ darwinports, but only with ghci. If I compile things, it appears that things are linked properly. Has anyone found a solution for this, or does anyone have an idea of what I could try? Should this be reported as a bug? Launching ghci from an xterm window, I get $ ghci -package X11-1.1 ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 6.6, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \____/\/ /_/\____/|_| Type :? for help. Loading package base ... linking ... done. Loading package X11-1.1 ... ghc-6.6: can't load .so/.DLL for: X11 (dlopen(libX11.dylib, 10): image not found) I ran a ktrace to see where it was looking for the library, and got ... 381 ghc-6.6 CALL stat(0x1b057d8,0x1b05770) 381 ghc-6.6 NAMI "/opt/local/lib/ghc-6.6/libX11_dyn.dylib" 381 ghc-6.6 RET stat -1 errno 2 No such file or directory 381 ghc-6.6 CALL stat(0x1b05888,0x1b05820) 381 ghc-6.6 NAMI "/opt/local/lib/ghc-6.6/libX11.dylib" 381 ghc-6.6 RET stat -1 errno 2 No such file or directory 381 ghc-6.6 CALL open(0x1b058b8,0,0) 381 ghc-6.6 NAMI "libX11.dylib" 381 ghc-6.6 RET open -1 errno 2 No such file or directory 381 ghc-6.6 CALL close(0xffffffff) 381 ghc-6.6 RET close -1 errno 9 Bad file descriptor 381 ghc-6.6 CALL open(0xbfffd150,0,0) 381 ghc-6.6 NAMI "/Users/username/lib/libX11.dylib" 381 ghc-6.6 RET open -1 errno 2 No such file or directory 381 ghc-6.6 CALL close(0xffffffff) 381 ghc-6.6 RET close -1 errno 9 Bad file descriptor 381 ghc-6.6 CALL open(0xbfffd150,0,0) 381 ghc-6.6 NAMI "/usr/local/lib/libX11.dylib" 381 ghc-6.6 RET open -1 errno 2 No such file or directory 381 ghc-6.6 CALL close(0xffffffff) 381 ghc-6.6 RET close -1 errno 9 Bad file descriptor 381 ghc-6.6 CALL open(0xbfffd160,0,0) 381 ghc-6.6 NAMI "/usr/lib/libX11.dylib" 381 ghc-6.6 RET open -1 errno 2 No such file or directory 381 ghc-6.6 CALL close(0xffffffff) 381 ghc-6.6 RET close -1 errno 9 Bad file descriptor ... So it is not looking in /usr/X11R6/lib. I tried the same thing with DYLD_LIBRARY_PATH=/usr/X11R6/lib and get $ DYLD_LIBRARY_PATH=/usr/X11R6/lib ghci -package X11-1.1 ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 6.6, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \____/\/ /_/\____/|_| Type :? for help. Loading package base ... linking ... done. ghc-6.6: /opt/local/lib/ghc-6.6/HSX11_cbits.o: unknown symbol `_printf$LDBLStub' Loading package X11-1.1 ... linking ... ghc-6.6: unable to load package `X11-1.1' What's the problem? Thanks. Brad

Brad, Did you apply the recent X11 update from Apple after you compiled ghc? If so, you might try uninstalling, cleaning and rebuilding the macports ghc. There is a path issue; you should not have to specify DYLIB_LIBRARY_PATH. At least in macports, this should be easy to fix. Greg On Nov 12, 2006, at 9:08 AM, Brad wrote:
Hi,
I have the same problem both with the binary distribution and ghc compiled from macports/ darwinports, but only with ghci. If I compile things, it appears that things are linked properly.
Has anyone found a solution for this, or does anyone have an idea of what I could try? Should this be reported as a bug?
Launching ghci from an xterm window, I get $ ghci -package X11-1.1 ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 6.6, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \____/\/ /_/\____/|_| Type :? for help.
Loading package base ... linking ... done. Loading package X11-1.1 ... ghc-6.6: can't load .so/.DLL for: X11 (dlopen(libX11.dylib, 10): image not found)
I ran a ktrace to see where it was looking for the library, and got ... 381 ghc-6.6 CALL stat(0x1b057d8,0x1b05770) 381 ghc-6.6 NAMI "/opt/local/lib/ghc-6.6/libX11_dyn.dylib" 381 ghc-6.6 RET stat -1 errno 2 No such file or directory 381 ghc-6.6 CALL stat(0x1b05888,0x1b05820) 381 ghc-6.6 NAMI "/opt/local/lib/ghc-6.6/libX11.dylib" 381 ghc-6.6 RET stat -1 errno 2 No such file or directory 381 ghc-6.6 CALL open(0x1b058b8,0,0) 381 ghc-6.6 NAMI "libX11.dylib" 381 ghc-6.6 RET open -1 errno 2 No such file or directory 381 ghc-6.6 CALL close(0xffffffff) 381 ghc-6.6 RET close -1 errno 9 Bad file descriptor 381 ghc-6.6 CALL open(0xbfffd150,0,0) 381 ghc-6.6 NAMI "/Users/username/lib/libX11.dylib" 381 ghc-6.6 RET open -1 errno 2 No such file or directory 381 ghc-6.6 CALL close(0xffffffff) 381 ghc-6.6 RET close -1 errno 9 Bad file descriptor 381 ghc-6.6 CALL open(0xbfffd150,0,0) 381 ghc-6.6 NAMI "/usr/local/lib/libX11.dylib" 381 ghc-6.6 RET open -1 errno 2 No such file or directory 381 ghc-6.6 CALL close(0xffffffff) 381 ghc-6.6 RET close -1 errno 9 Bad file descriptor 381 ghc-6.6 CALL open(0xbfffd160,0,0) 381 ghc-6.6 NAMI "/usr/lib/libX11.dylib" 381 ghc-6.6 RET open -1 errno 2 No such file or directory 381 ghc-6.6 CALL close(0xffffffff) 381 ghc-6.6 RET close -1 errno 9 Bad file descriptor ...
So it is not looking in /usr/X11R6/lib. I tried the same thing with DYLD_LIBRARY_PATH=/usr/X11R6/lib and get $ DYLD_LIBRARY_PATH=/usr/X11R6/lib ghci -package X11-1.1 ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 6.6, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \____/\/ /_/\____/|_| Type :? for help.
Loading package base ... linking ... done. ghc-6.6: /opt/local/lib/ghc-6.6/HSX11_cbits.o: unknown symbol `_printf $LDBLStub' Loading package X11-1.1 ... linking ... ghc-6.6: unable to load package `X11-1.1'
What's the problem?
Thanks.
Brad
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

On 13/11/06, Gregory Wright
Brad,
Did you apply the recent X11 update from Apple after you compiled ghc?
I did.
If so, you might try uninstalling, cleaning and rebuilding the macports ghc.
There is a path issue; you should not have to specify DYLIB_LIBRARY_PATH. At least in macports, this should be easy to fix. I guess so - I had a look at the portfile and it seems that the syntax is straightforward enough, but I have no experience fiddling with
I did try that, and got: $ DYLD_LIBRARY_PATH=/usr/X11R6/lib ghci -package X11-1.1 ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 6.6, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \____/\/ /_/\____/|_| Type :? for help. Loading package base ... linking ... done. ghc-6.6: /opt/local/lib/ghc-6.6/HSX11_cbits.o: unknown symbol `_printf$LDBLStub' Loading package X11-1.1 ... linking ... ghc-6.6: unable to load package `X11-1.1 ' This is after I uninstalled, removed the package, and recompiled ghc, yesterday (that is to say, after I updated the Apple X11): $ ls -lT /opt/local/bin/ghc lrwxr-xr-x 1 root admin 7 Nov 12 18:36:50 2006 /opt/local/bin/ghc -> ghc-6.6 $ ls -lT /opt/local/var/db/dports/packages/darwin/powerpc/ghc-6.6_1+darwin_8_powerpc.powerpc.tgz -rw-r--r-- 1 root admin 59818580 Nov 12 18:36:14 2006 /opt/local/var/db/dports/packages/darwin/powerpc/ghc-6.6_1+darwin_8_powerpc.powerpc.tgz Why does the Apple X11 always have to break things? that. But that's a separate issue, right? Any other ideas? In any case, thanks for your help.

Hi Brad, On Nov 13, 2006, at 7:22 AM, Brad wrote:
On 13/11/06, Gregory Wright
wrote: Brad,
Did you apply the recent X11 update from Apple after you compiled ghc?
I did.
If so, you might try uninstalling, cleaning and rebuilding the macports ghc.
I did try that, and got:
$ DYLD_LIBRARY_PATH=/usr/X11R6/lib ghci -package X11-1.1 ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 6.6, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \____/\/ /_/\____/|_| Type :? for help.
Loading package base ... linking ... done. ghc-6.6: /opt/local/lib/ghc-6.6/HSX11_cbits.o: unknown symbol `_printf $LDBLStub' Loading package X11-1.1 ... linking ... ghc-6.6: unable to load package `X11-1.1 '
I think I remember seeing something like this. I'll look into it some more.
This is after I uninstalled, removed the package, and recompiled ghc, yesterday (that is to say, after I updated the Apple X11):
$ ls -lT /opt/local/bin/ghc lrwxr-xr-x 1 root admin 7 Nov 12 18:36:50 2006 /opt/local/bin/ ghc -> ghc-6.6 $ ls -lT /opt/local/var/db/dports/packages/darwin/powerpc/ghc-6.6_1 +darwin_8_powerpc.powerpc.tgz -rw-r--r-- 1 root admin 59818580 Nov 12 18:36:14 2006 /opt/local/var/db/dports/packages/darwin/powerpc/ghc-6.6_1 +darwin_8_powerpc.powerpc.tgz
Why does the Apple X11 always have to break things?
There is a path issue; you should not have to specify DYLIB_LIBRARY_PATH. At least in macports, this should be easy to fix. I guess so - I had a look at the portfile and it seems that the syntax is straightforward enough, but I have no experience fiddling with that. But that's a separate issue, right?
I already tweak the script that invokes ghc/ghci to find the libraries installed by macports. Tweaking it a bit more is not a big deal. But I would like to understand the unknown symbol problem first. Best, Greg
Any other ideas?
In any case, thanks for your help. _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Gregory Wright schrieb:
/opt/local/lib/ghc-6.6/HSX11_cbits.o: unknown symbol `_printf$LDBLStub'
I think I remember seeing something like this. I'll look into it some more.
That's a gcc problem. I think, HSX11_cbits.o should be built with gcc-3.3. (I assume your default is gcc-4.0.) Try adding "-pgmc /usr/bin/gcc-3.3" to ghc's command-line. Christian P.S. I had to set DYLIB_LIBRARY_PATH, before it worked for me

On Nov 15, 2006, at 6:14 AM, Christian Maeder wrote:
Gregory Wright schrieb:
/opt/local/lib/ghc-6.6/HSX11_cbits.o: unknown symbol `_printf $LDBLStub'
I think I remember seeing something like this. I'll look into it some more.
That's a gcc problem. I think, HSX11_cbits.o should be built with gcc-3.3. (I assume your default is gcc-4.0.)
Try adding "-pgmc /usr/bin/gcc-3.3" to ghc's command-line.
Christian
P.S. I had to set DYLIB_LIBRARY_PATH, before it worked for me
Actually, I've been able to build GHC from source using gcc 4.0.1 with no problems or special DYLIB_LIBRARY_PATH. I've also had no problems running X11 programs (from xterm) via either ghc or ghci. I'm not sure what's going on here. If you are still getting the unknown symbol you can fix it by adding -lSystemStubs to the link. That should happen automatically if everything is building properly. I think this may be a problem with the way the macports port is set up. Maybe try building it by hand, or using the binary distribution? (Although the Intel binary distribution is broken for X11, the PPC one works). Gregory, one thing to check: if X11 was installed properly, there should be a symbolic link /usr/lib/X11 -> /usr/X11R6/lib/X11. If it's not there, then do: sudo ln -s /usr/lib/X11 /usr/X11R6/lib/X11 Also, are you running 10.3 (Panther) or 10.4 (Tiger)? Deborah

Hi Deborah: On Nov 15, 2006, at 10:37 AM, Deborah Goldsmith wrote:
On Nov 15, 2006, at 6:14 AM, Christian Maeder wrote:
Gregory Wright schrieb:
/opt/local/lib/ghc-6.6/HSX11_cbits.o: unknown symbol `_printf $LDBLStub'
I think I remember seeing something like this. I'll look into it some more.
That's a gcc problem. I think, HSX11_cbits.o should be built with gcc-3.3. (I assume your default is gcc-4.0.)
Try adding "-pgmc /usr/bin/gcc-3.3" to ghc's command-line.
Christian
P.S. I had to set DYLIB_LIBRARY_PATH, before it worked for me
Actually, I've been able to build GHC from source using gcc 4.0.1 with no problems or special DYLIB_LIBRARY_PATH. I've also had no problems running X11 programs (from xterm) via either ghc or ghci. I'm not sure what's going on here. If you are still getting the unknown symbol you can fix it by adding -lSystemStubs to the link. That should happen automatically if everything is building properly.
The build configuration does not seem to be the problem. The - lSystemStubs issue has happened before, preventing us from building gcc 4.x out of the box using the gcc shipped by Apple. (It is a sign that gcc itself is misconfigured.)
I think this may be a problem with the way the macports port is set up. Maybe try building it by hand, or using the binary distribution? (Although the Intel binary distribution is broken for X11, the PPC one works).
Gregory, one thing to check: if X11 was installed properly, there should be a symbolic link /usr/lib/X11 -> /usr/X11R6/lib/X11. If it's not there, then do:
The link is present. There might be a problem with having to set DYLIB_LIBRARY_PATH, since MacPorts supports installing its files anywhere, including installs without administrator privileges. If this is a real issue, it is simple to fix, since the script that invokes ghc is already automatically edited to include the correct paths to the libraries on which it depends. There may also be problems for people who built ghc from source and then installed the latest X11 update from Apple.
sudo ln -s /usr/lib/X11 /usr/X11R6/lib/X11
Also, are you running 10.3 (Panther) or 10.4 (Tiger)?
10.4.8 with Xcode 2.4.1. Does anyone know off the top of their head which Xcode was used to generate the binary distribution? -Greg
Deborah
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

I experienced the same problem as Greg with the binary distribution, as well as when i built ghc from Macports. Penny On Nov 15, 2006, at 1:19 PM, Gregory Wright wrote:
epends.
There may also be problems for people who built ghc from source and then installed the latest X11 update from Apple.
sudo ln -s /usr/lib/X11 /usr/X11R6/lib/X11
Also, are you running 10.3 (Panther) or 10.4 (Tiger)?
10.4.8 with Xcode 2.4.1. Does anyone know off the top of their head which Xcode was used to generate the binary distribution?
-Greg
Deborah
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

There are some notes on the Wiki: http://hackage.haskell.org/trac/ghc/wiki/X86OSXGhc that may be relevant. I know there are problems with the Intel binary distribution for OpenGL, but the PPC distribution should work... Deborah On Nov 15, 2006, at 6:39 PM, Melissa Chase wrote:
I experienced the same problem as Greg with the binary distribution, as well as when i built ghc from Macports.
Penny
On Nov 15, 2006, at 1:19 PM, Gregory Wright wrote:
epends.
There may also be problems for people who built ghc from source and then installed the latest X11 update from Apple.
sudo ln -s /usr/lib/X11 /usr/X11R6/lib/X11
Also, are you running 10.3 (Panther) or 10.4 (Tiger)?
10.4.8 with Xcode 2.4.1. Does anyone know off the top of their head which Xcode was used to generate the binary distribution?
-Greg
Deborah
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

One of the people experiencing this sent me some sample code, and now I can reproduce it too, on both PPC and Intel. I would guess that there is an issue with the way shared library loading works in interactive mode, as opposed to in the link phase when compiling. You can work around the problem by launching ghci with DYLD_LIBRARY_PATH set to include the X11 shared library directory. Deborah On Nov 16, 2006, at 4:04 PM, Deborah Goldsmith wrote:
There are some notes on the Wiki:
http://hackage.haskell.org/trac/ghc/wiki/X86OSXGhc
that may be relevant.
I know there are problems with the Intel binary distribution for OpenGL, but the PPC distribution should work...
Deborah
On Nov 15, 2006, at 6:39 PM, Melissa Chase wrote:
I experienced the same problem as Greg with the binary distribution, as well as when i built ghc from Macports.
Penny
On Nov 15, 2006, at 1:19 PM, Gregory Wright wrote:
epends.
There may also be problems for people who built ghc from source and then installed the latest X11 update from Apple.
sudo ln -s /usr/lib/X11 /usr/X11R6/lib/X11
Also, are you running 10.3 (Panther) or 10.4 (Tiger)?
10.4.8 with Xcode 2.4.1. Does anyone know off the top of their head which Xcode was used to generate the binary distribution?
-Greg
Deborah
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Hi Christian, On Nov 15, 2006, at 9:14 AM, Christian Maeder wrote:
Gregory Wright schrieb:
/opt/local/lib/ghc-6.6/HSX11_cbits.o: unknown symbol `_printf $LDBLStub'
I think I remember seeing something like this. I'll look into it some more.
That's a gcc problem. I think, HSX11_cbits.o should be built with gcc-3.3. (I assume your default is gcc-4.0.)
Try adding "-pgmc /usr/bin/gcc-3.3" to ghc's command-line.
It may be possible to keep gcc 4.0 and just link in -lSystemStubs. That were the undefined symbol lives.
Christian
P.S. I had to set DYLIB_LIBRARY_PATH, before it worked for me
Yes, it looks like I'll have to patch up the ghc script some more find find X11 properly. Greg
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
participants (5)
-
Brad
-
Christian Maeder
-
Deborah Goldsmith
-
Gregory Wright
-
Melissa Chase