Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dyld: Library not loaded #1837

Closed
DomT4 opened this issue Oct 22, 2014 · 21 comments
Closed

dyld: Library not loaded #1837

DomT4 opened this issue Oct 22, 2014 · 21 comments

Comments

@DomT4
Copy link
Contributor

DomT4 commented Oct 22, 2014

On OS X:

fontforge --version
dyld: Library not loaded: /usr/local/lib/libzmq.3.dylib
  Referenced from: /usr/local/lib/libczmq.1.dylib
  Reason: image not found
[1]    52205 trace trap  fontforge --version

The czmq we're using is version 2.2.0 which should be sufficient according to the build documentation, but Fontforge seems to be ignoring the pkg-config file and refusing to see this dependency is present and consequently when attempting to load Fontforge from the command-line we see the dylib failure displayed above.

Any ideas? For now, I may just turn the collab dependencies into optional dependencies for Homebrew and change that when we fix this little issue.

@adrientetar
Copy link
Member

cc @monkeyiq

@monkeyiq
Copy link
Contributor

It is interesting that it is finding and linking to czmq for you. Otherwise it wouldn't have the failing reference. So it seems that some of the pkg-config stuff is working, it's just not linking the zmq too by the looks.

What do you have in /opt/local/lib by way of zmq?

-rwxr-xr-x  1 ben   wheel   614K Oct 21 17:47 libczmq.1.dylib
-rwxr-xr-x  1 root  admin   459K Oct 15 20:49 libczmq.1.dylib.orig
-rwxr-xr-x  1 ben   wheel   614K Oct 21 17:47 libczmq.1.dylib.updated
-rw-r--r--  1 root  admin   1.4M Oct 15 20:49 libczmq.a
lrwxr-xr-x  1 root  admin    15B Oct 15 20:49 libczmq.dylib -> libczmq.1.dylib
-rwxr-xr-x  1 root  admin   727K Oct 15 20:49 libzmq.3.dylib
-rw-r--r--  1 root  admin   1.4M Oct 15 20:49 libzmq.a
lrwxr-xr-x  1 root  admin    14B Oct 15 20:49 libzmq.dylib -> libzmq.3.dylib
-rwxr-xr-x  1 root  admin   158K Oct 24 14:05 libzmqcollab.2.dylib
-rw-r--r--  1 root  admin   262K Oct 24 14:05 libzmqcollab.a
lrwxr-xr-x  1 root  admin    20B Oct 24 14:05 libzmqcollab.dylib -> libzmqcollab.2.dylib

For reference this is what I have on my main build machine:

$ port installed |grep -E '(czmq|zmq)'
  czmq @2.2.0_0+universal (active)
  zmq-devel @4.0.4_2+universal (active)

In the top fontforge build directory:

# grep LIBZMQ Makefile
LIBZMQCOLLAB_VERSION = 2:0:0
LIBZMQ_CFLAGS = -I/opt/local/include  -I/opt/local/include  -I/opt/local/include/uuid 
LIBZMQ_LIBS = -L/opt/local/lib -lczmq -lzmq  -L/opt/local/lib -luuid 

The relevant section of config.log:

configure:20555: checking for LIBZMQ
configure:20562: $PKG_CONFIG --exists --print-errors " libczmq >= 2.2.0 libzmq >= 4.0.4 "
configure:20565: $? = 0
configure:20579: $PKG_CONFIG --exists --print-errors " libczmq >= 2.2.0 libzmq >= 4.0.4 "
configure:20582: $? = 0
configure:20620: result: yes
configure:20643: WARNING: Using zeromq enables collab, which needs libuuid, so I'm checking for that now...

@DomT4
Copy link
Contributor Author

DomT4 commented Oct 24, 2014

What do you have in /opt/local/lib by way of zmq?

/usr/local/lib for me 😉. I use Homebrew rather than MacPorts.

# ls -l /usr/local/opt/czmq/lib
total 1040
-r--r--r--  1 Dominyk  admin  175264 Aug 28 21:15 libczmq.1.dylib
-r--r--r--  1 Dominyk  admin  352224 Aug 28 21:15 libczmq.a
lrwxr-xr-x  1 Dominyk  admin      15 Aug 28 21:15 libczmq.dylib -> libczmq.1.dylib
drwxr-xr-x  3 Dominyk  admin     102 Aug 28 21:15 pkgconfig

And:

# ls -l /usr/local/opt/zeromq/lib
total 2584
-r--r--r--  1 Dominyk  admin  365656 Oct 16 16:01 libzmq.4.dylib
-r--r--r--  1 Dominyk  admin  947960 Oct 16 16:01 libzmq.a
lrwxr-xr-x  1 Dominyk  admin      14 Oct 16 16:01 libzmq.dylib -> libzmq.4.dylib
drwxr-xr-x  3 Dominyk  admin     102 Oct 16 16:01 pkgconfig

@monkeyiq
Copy link
Contributor

I assume that when you 'grep LIBZMQ Makefile' after a configure then you only see the link line for czmq and no -lzmq (and matching -L to your zeromq/lib subdir)?

@monkeyiq
Copy link
Contributor

OK, switching over to osx 10.8 using brew I have:

$ ls -l libczmq* libzmq*
lrwxr-xr-x  1 ben  admin  40 Jul 31 06:49 libczmq.1.dylib -> ../Cellar/czmq/2.2.0/lib/libczmq.1.dylib
lrwxr-xr-x  1 ben  admin  34 Jul 31 06:49 libczmq.a -> ../Cellar/czmq/2.2.0/lib/libczmq.a
lrwxr-xr-x  1 ben  admin  38 Jul 31 06:49 libczmq.dylib -> ../Cellar/czmq/2.2.0/lib/libczmq.dylib
lrwxr-xr-x  1 ben  admin  41 Jul 31 06:49 libzmq.3.dylib -> ../Cellar/zeromq/4.0.4/lib/libzmq.3.dylib
lrwxr-xr-x  1 ben  admin  35 Jul 31 06:49 libzmq.a -> ../Cellar/zeromq/4.0.4/lib/libzmq.a
lrwxr-xr-x  1 ben  admin  39 Jul 31 06:49 libzmq.dylib -> ../Cellar/zeromq/4.0.4/lib/libzmq.dylib

If I also see the link dependencies of fontforge on that brew based machine I get the following:

otool -L /usr/local/Cellar/fontforge/HEAD/bin/fontforge
...
    /usr/local/lib/libczmq.1.dylib (compatibility version 3.0.0, current version 3.0.0)
    /usr/local/lib/libzmq.3.dylib (compatibility version 5.0.0, current version 5.0.0)

Maybe there are some differences between our machines there.

I will also check if current master is ok to build on that machine.

@DomT4
Copy link
Contributor Author

DomT4 commented Oct 24, 2014

Dominyks-MacBook-Pro # grep LIBZMQ /private/tmp/fontforge-ws3pdG/fontforge-20141014/Makefile
LIBZMQCOLLAB_VERSION = 2:0:0
LIBZMQ_CFLAGS =  -I/usr/local/Cellar/ossp-uuid/1.6.2_1/include
LIBZMQ_LIBS =  -L/usr/local/Cellar/ossp-uuid/1.6.2_1/lib

@DomT4
Copy link
Contributor Author

DomT4 commented Oct 24, 2014

otool -L /usr/local/bin/fontforge
/usr/local/bin/fontforge:
    /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 21.0.0)
    /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 62.0.0)
    /usr/local/Cellar/fontforge/20141014/lib/libfontforgeexe.2.dylib (compatibility version 3.0.0, current version 3.0.0)
    /usr/local/Cellar/fontforge/20141014/lib/libgdraw.5.dylib (compatibility version 6.0.0, current version 6.0.0)
    /usr/local/Cellar/fontforge/20141014/lib/libgunicode.4.dylib (compatibility version 5.0.0, current version 5.0.0)
    /usr/local/Cellar/fontforge/20141014/lib/libgutils.2.dylib (compatibility version 3.0.0, current version 3.0.0)
    /usr/local/Cellar/fontforge/20141014/lib/libgioftp.2.dylib (compatibility version 3.0.0, current version 3.0.0)
    /usr/local/Cellar/fontforge/20141014/lib/libfontforge.2.dylib (compatibility version 3.0.0, current version 3.0.0)
    /usr/local/lib/libjpeg.8.dylib (compatibility version 13.0.0, current version 13.0.0)
    /usr/local/lib/libpng16.16.dylib (compatibility version 30.0.0, current version 30.0.0)
    /usr/local/lib/libtiff.5.dylib (compatibility version 8.0.0, current version 8.0.0)
    /usr/local/lib/libpangocairo-1.0.0.dylib (compatibility version 3601.0.0, current version 3601.8.0)
    /usr/local/lib/libcairo.2.dylib (compatibility version 11203.0.0, current version 11203.16.0)
    /usr/local/lib/libpangoxft-1.0.0.dylib (compatibility version 3601.0.0, current version 3601.8.0)
    /usr/local/lib/libpangoft2-1.0.0.dylib (compatibility version 3601.0.0, current version 3601.8.0)
    /usr/local/lib/libpango-1.0.0.dylib (compatibility version 3601.0.0, current version 3601.8.0)
    /usr/local/lib/libfontconfig.1.dylib (compatibility version 10.0.0, current version 10.0.0)
    /opt/X11/lib/libXft.2.dylib (compatibility version 6.0.0, current version 6.2.0)
    /opt/X11/lib/libSM.6.dylib (compatibility version 7.0.0, current version 7.1.0)
    /opt/X11/lib/libICE.6.dylib (compatibility version 10.0.0, current version 10.0.0)
    /usr/lib/libedit.3.dylib (compatibility version 2.0.0, current version 3.0.0)
    /usr/local/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.0)
    /usr/local/lib/libfreetype.6.dylib (compatibility version 18.0.0, current version 18.2.0)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
    /usr/local/lib/libgio-2.0.0.dylib (compatibility version 4201.0.0, current version 4201.0.0)
    /usr/local/lib/libgobject-2.0.0.dylib (compatibility version 4201.0.0, current version 4201.0.0)
    /usr/local/lib/libglib-2.0.0.dylib (compatibility version 4201.0.0, current version 4201.0.0)
    /usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.9.0)
    /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
    /usr/local/opt/gettext/lib/libintl.8.dylib (compatibility version 10.0.0, current version 10.2.0)
    /opt/X11/lib/libXi.6.dylib (compatibility version 8.0.0, current version 8.0.0)
    /opt/X11/lib/libX11.6.dylib (compatibility version 10.0.0, current version 10.0.0)
    /usr/local/lib/libltdl.7.dylib (compatibility version 11.0.0, current version 11.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)

@monkeyiq
Copy link
Contributor

is the above for a fontforge that is meant to have collab enabled? the binary doesn't seem to want czmq at all, so the fontforge --version should work for it?

@DomT4
Copy link
Contributor Author

DomT4 commented Oct 24, 2014

No, I had to turn collab off to get it to launch at all after compile. I'll turn it back on now for testing and check again.

@monkeyiq
Copy link
Contributor

I am now also recompiling head on that machine using

brew install --verbose --debug fontforge --HEAD --with-x

@DomT4
Copy link
Contributor Author

DomT4 commented Oct 24, 2014

Alright, with collab turned on:

Dominyks-MacBook-Pro # otool -L /usr/local/bin/fontforge                                                            [~]
/usr/local/bin/fontforge:
    /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 21.0.0)
    /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 62.0.0)
    /usr/local/Cellar/fontforge/20141014/lib/libfontforgeexe.2.dylib (compatibility version 3.0.0, current version 3.0.0)
    /usr/local/Cellar/fontforge/20141014/lib/libgdraw.5.dylib (compatibility version 6.0.0, current version 6.0.0)
    /usr/local/Cellar/fontforge/20141014/lib/libgunicode.4.dylib (compatibility version 5.0.0, current version 5.0.0)
    /usr/local/Cellar/fontforge/20141014/lib/libgutils.2.dylib (compatibility version 3.0.0, current version 3.0.0)
    /usr/local/Cellar/fontforge/20141014/lib/libgioftp.2.dylib (compatibility version 3.0.0, current version 3.0.0)
    /usr/local/Cellar/fontforge/20141014/lib/libfontforge.2.dylib (compatibility version 3.0.0, current version 3.0.0)
    /usr/local/Cellar/fontforge/20141014/lib/libzmqcollab.2.dylib (compatibility version 3.0.0, current version 3.0.0)
    /opt/X11/lib/libXi.6.dylib (compatibility version 8.0.0, current version 8.0.0)
    /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
    /usr/local/lib/libjpeg.8.dylib (compatibility version 13.0.0, current version 13.0.0)
    /usr/local/lib/libpng16.16.dylib (compatibility version 30.0.0, current version 30.0.0)
    /usr/local/lib/libtiff.5.dylib (compatibility version 8.0.0, current version 8.0.0)
    /usr/local/lib/libpangocairo-1.0.0.dylib (compatibility version 3601.0.0, current version 3601.8.0)
    /usr/local/lib/libcairo.2.dylib (compatibility version 11203.0.0, current version 11203.16.0)
    /usr/local/lib/libpangoxft-1.0.0.dylib (compatibility version 3601.0.0, current version 3601.8.0)
    /usr/local/lib/libpangoft2-1.0.0.dylib (compatibility version 3601.0.0, current version 3601.8.0)
    /usr/local/lib/libpango-1.0.0.dylib (compatibility version 3601.0.0, current version 3601.8.0)
    /usr/local/lib/libfontconfig.1.dylib (compatibility version 10.0.0, current version 10.0.0)
    /opt/X11/lib/libXft.2.dylib (compatibility version 6.0.0, current version 6.2.0)
    /opt/X11/lib/libSM.6.dylib (compatibility version 7.0.0, current version 7.1.0)
    /opt/X11/lib/libICE.6.dylib (compatibility version 10.0.0, current version 10.0.0)
    /usr/lib/libedit.3.dylib (compatibility version 2.0.0, current version 3.0.0)
    /usr/local/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.0)
    /usr/local/lib/libfreetype.6.dylib (compatibility version 18.0.0, current version 18.2.0)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
    /usr/local/lib/libgio-2.0.0.dylib (compatibility version 4201.0.0, current version 4201.0.0)
    /usr/local/lib/libgobject-2.0.0.dylib (compatibility version 4201.0.0, current version 4201.0.0)
    /usr/local/lib/libglib-2.0.0.dylib (compatibility version 4201.0.0, current version 4201.0.0)
    /usr/local/opt/gettext/lib/libintl.8.dylib (compatibility version 10.0.0, current version 10.2.0)
    /usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.9.0)
    /usr/local/lib/libczmq.1.dylib (compatibility version 3.0.0, current version 3.0.0)
    /usr/local/lib/libzmq.4.dylib (compatibility version 5.0.0, current version 5.0.0)
    /opt/X11/lib/libX11.6.dylib (compatibility version 10.0.0, current version 10.0.0)
    /usr/local/lib/libltdl.7.dylib (compatibility version 11.0.0, current version 11.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)

@monkeyiq
Copy link
Contributor

And when you run "fontforge --version" you still get dyld: Library not loaded: /usr/local/lib/libzmq.3.dylib?

I assume that "otool -L /usr/local/lib/libczmq.1.dylib " shows that czmq wants to link to that libzmq.3.dylib file instead of the libzmq.4.dylib that the fontforge binary is after?

@DomT4
Copy link
Contributor Author

DomT4 commented Oct 24, 2014

Oh. Okay, this is curious. Now it works. I did a complete removal and re-installation of the two zmq dependencies, so maybe that was the issue 😕

fontforge --version
Dominyks-MacBook-Pro # fontforge --version                                                                          [~]
Copyright (c) 2000-2014 by George Williams. See AUTHORS for Contributors.
 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
 with many parts BSD <http://fontforge.org/license.html>. Please read LICENSE.
 Based on sources from 13:34 BST 24-Oct-2014-ML-D.
 Based on source from git with hash:f6ffb25d7732adcc8d32dae75bd90bda90250304
fontforge 13:34 BST 24-Oct-2014
libfontforge 20141024

@monkeyiq
Copy link
Contributor

For reference I get the following otool for fontforge...

$ otool -L /usr/local/bin/fontforge | grep -E '(czmq|zmq)'
        /usr/local/Cellar/fontforge/HEAD/lib/libzmqcollab.2.dylib (compatibility version 3.0.0, current version 3.0.0)
        /usr/local/lib/libczmq.1.dylib (compatibility version 3.0.0, current version 3.0.0)
        /usr/local/lib/libzmq.3.dylib (compatibility version 5.0.0, current version 5.0.0)

@DomT4
Copy link
Contributor Author

DomT4 commented Oct 24, 2014

Did Fontforge do anything in the last change that would require the two dependencies to be built fresh rather than used already on the system? This is odd.

@monkeyiq
Copy link
Contributor

I haven't changed the brew file for ages. It seemed you might have had a dangling libzmq.3 link somewhere. I notice your /usr/local/opt/zeromq/lib listing above only had libzmq.4.dylib.

My machine only has libzmq.3.dylib, but for me nothing wants libzmq.4.dylib instead. Perhaps if I update the zmq dep on the machine then it will move over to libzmq.4.dylib.

$ ls -l /usr/local/opt/zeromq/lib
-r--r--r-- 1 ben admin 350860 Jul 31 06:49 libzmq.3.dylib
-r--r--r-- 1 ben admin 786248 Jun 9 09:01 libzmq.a
lrwxr-xr-x 1 ben admin 14 Jun 9 09:01 libzmq.dylib -> libzmq.3.dylib
drwxr-xr-x 3 ben admin 102 Jul 31 06:49 pkgconfig

@DomT4
Copy link
Contributor Author

DomT4 commented Oct 24, 2014

Yeah, It looks possibly like the libzmq library was hanging around Homebrew for some reason. I may well revision the two zmq libraries to make sure this problem doesn't whack anyone else.

Now I've recompiled the two zmq dependencies that libzmq.3 library is completely gone.

@monkeyiq
Copy link
Contributor

At least we seem to have solved the problem, from fontforge's perspective ;) I knew having that brew machine available was the right choice ;-)

@DomT4
Copy link
Contributor Author

DomT4 commented Oct 24, 2014

Alright, I've made the necessary changes locally to fix this. Just waiting on feedback on the UUID issue and then I'll petition Homebrew to accept the changes. Closing this in the hope of not having to reopen it later. Thanks for the help 😃

@DomT4 DomT4 closed this as completed Oct 24, 2014
@monkeyiq
Copy link
Contributor

Cool, let me know if you need any support on getting homebrew to accept the changes. I don't have any privilege there, but if I can help even in a minor way to make fontforge easier to build I'm all for it!

MikeMcQuaid pushed a commit to Homebrew/legacy-homebrew that referenced this issue Oct 25, 2014
Some fixes for the Fontforge, pending the next imminent stable release.
Also bumping czmq and zeromq following a discussion [on
this](fontforge/fontforge#1837) this morning,
during which I stumbled across a fix by removing the two and
reinstalling them afresh, so I’m recommending we do that for everyone
given the two libraries are tiny and it’ll flush out any configuration
or bottle issues that could be lingering.
@dcboy
Copy link

dcboy commented May 3, 2016

just use ln

ln -s /usr/local/opt/zeromq/lib/libzmq.5.dylib /usr/local/lib/libczmq.3.dylib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants