Dynamic libraries, gtk-sharp

bob spamnot bob.spamnot at gmail.com
Sat Sep 15 11:14:43 PDT 2007


I am trying to build gtk-sharp-2.0 from source since there is no working
port of this (and there isn't on Fink either at the moment).  If I can get
this to work I can make a portfile for it, so I guess it does relate to
Macports:-).  But I cannot get the dynamic library situation sorted.  In
fact I am quite mystified by the apple DYLN_LIBRARY_PATH variable.  Any help
or pointers will be greatly appreciated.  Sorry about the long post, I've
tried to condense it down.  Here is the steps I have done (note I am on a
PowerBook G4, OS X 10.4.10, XCode 2.4.1):

1a. Install gnome: sudo port install gnome

Actually I haven't (yet) got it to fully install but it makes it most of the
way (certainly far enough for the bits needed by gtk-sharp-2.0).

1b. Install mono: sudo port install mono

2. Download gtk-sharp from gnome snv to a local src directory.  I've
tried both the HEAD version and tagged version 2.10.2.

3. Make it in  the following way:

bash> echo $PATH
usr/local/bin:/opt/local/bin:/opt/local/sbin:/usr/X11R6/bin:/bin:/sbin:/usr/bin:/usr/sbin
bash> ./configure --prefix=/Users/name/local-sharp
bash> make
bash> make install

This all works, so now gtk-sharp is install in local-sharp in my home
directory.

4. Now I try to compile a simple program:

bash> which mcs
mcs is hashed (/opt/local/bin/mcs)

bash> export
PKG_CONFIG_PATH=/opt/local/lib/pkgconfig:/usr/X11R6/lib/pkgconfig:/Users/name/local-sharp/lib/pkgconfig

bash> mcs -pkg:gtk-sharp-2.0 HelloWorldGtk.cs

bash> mono HelloWorldGtk.exe

** (HelloWorldGtk.exe:10680): WARNING **: The following assembly referenced
from /Users/name/src/gtk-sharp-cvs/test/HelloWorldGtk.exe could not be
loaded:
     Assembly:   gtk-sharp    (assemblyref_index=1)
     Version:    2.10.0.0
     Public Key: 35e10195dab3c99f
System error: Unknown error: 0


** (HelloWorldGtk.exe:10680): WARNING **: Could not load file or assembly
'gtk-sharp, Version=2.10.0.0, Culture=neutral,
PublicKeyToken=35e10195dab3c99f' or one of its dependencies.

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or
assembly 'gtk-sharp, Version=2.10.0.0, Culture=neutral,
PublicKeyToken=35e10195dab3c99f' or one of its dependencies.
File name: "gtk-sharp, Version=2.10.0.0, Culture=neutral,
PublicKeyToken=35e10195dab3c99f"

OK, I guess I need to set DYLD_LIBRARY_PATH
bash> export DYLD_LIBRARY_PATH=/opt/local/lib:/Users/name/local-sharp/lib
(note leaving out /opt/local/lib doesn't work either)

bash> mono HelloWorldGtk.exe
dyld: Symbol not found: __cg_jpeg_resync_to_restart
  Referenced from:
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /opt/local/lib/libJPEG.dylib

Trace/BPT trap

Here is where I'm stuck.  I've tried lots of variations but they all either
give me this error or they cannot find gtk-sharp-2.0 or the regular gtk libs
(which  are in /opt/local/lib).  I'll spare you the details of the other
variations except one.  If I set DYLD_LIBRARY_PATH=/opt/local/lib and just
try to use eog or mcs I get this same error (note they both work fine if
DYLN is not set).  E.G.:

bash> export DYLD_LIBRARY_PATH=/opt/local/lib
bash> eog
dyld: Symbol not found: __cg_jpeg_resync_to_restart
  Referenced from:
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /opt/local/lib/libjpeg.62.dylib

Trace/BPT trap
bash> mcs HelloWorld.cs    (very simple helloworld which just writes to
console and works if DYLN not set)
dyld: Symbol not found: __cg_jpeg_resync_to_restart
  Referenced from:
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /opt/local/lib/libJPEG.dylib

Trace/BPT trap

This seems completely bizarre to me.  Both eog and mcs were made by Macports
and linked against stuff in /opt/local/lib, so why should adding
/opt/local/lib to DYLD_LIBRARY_PATH make libJPEG look into the framework
listed above.  Maybe someone could explain to me what DYLN_LIBRARY_PATH is
doing (the man page doesn't really help)?

I've try searching google on the above "Symbol not found" error and get lots
of hits (so I'm not alone) but none of the suggestions seem to help.  I'd be
glad to show some of the other things I've tried but this post is long
enough and I'm hoping someone will have an easy answer:-)  I hope I was
clear enough, feel free to ask for clarification.

Thanks,
Bob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-dev/attachments/20070915/522074c5/attachment.html


More information about the macports-dev mailing list