Opened 14 years ago

Closed 14 years ago

#24238 closed defect (fixed)

yajl-1.0.6: Dynamically linking programs with -lyajl and running causes Trace/BPT trap

Reported by: endgame.dos@… Owned by: benjaminlyu@…
Priority: Normal Milestone:
Component: ports Version: 1.8.2
Keywords: haspatch Cc: ryandesign (Ryan Carsten Schmidt)
Port: yajl

Description

OS: OSX 10.6 on Intel.

After installing yajl, I find that I cannot dynamically link programs against libyajl.dylib. Minimal example:

#include <stdlib.h>
int main(int argc, char *argv[]) {
  exit(EXIT_SUCCESS);
}

Running "gcc -o test test.c -L/opt/local/lib -lyajl" and "./test" fails with:

$ ./test 
dyld: Library not loaded: libyajl.1.dylib
  Referenced from: /Users/endgame/code/mudflat/./test
  Reason: image not found
Trace/BPT trap

otool -L test:

$ otool -L ./test
./test:
	libyajl.1.dylib (compatibility version 1.0.0, current version 1.0.6)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 123.0.0)

The lack of an absolute path on libyajl1.dylib looks problematic.

I was able to fix this by adding a call to install_name_tool in the portfile. I don't if that's the best way to fix it or if you want to push on upstream, but I'll attach a patch to the portfile anyhow.

Attachments (1)

yajl-Portfile-install_name_tool.patch (354 bytes) - added by endgame.dos@… 14 years ago.
Patch Portfile to call install_name_tool to fix libyajl.1.dylib

Download all attachments as: .zip

Change History (8)

Changed 14 years ago by endgame.dos@…

Patch Portfile to call install_name_tool to fix libyajl.1.dylib

comment:1 Changed 14 years ago by mf2k (Frank Schima)

Cc: endgame.dos@… removed
Keywords: haspatch added
Owner: changed from macports-tickets@… to benjaminlyu@…

comment:2 Changed 14 years ago by benjaminlyu@…

Notes to submitter:

  1. even though I'm the "maintainer" for yajl, I don't have commit privileges.
  2. We'll have to ask the other macports maintainers if using the install_name_tool is ok since i think it's a system level tool and not built in the macports system.

If there isn't a problem with the install_name_tool, then I am ok with this Portfile change.

-Ben

comment:3 Changed 14 years ago by endgame.dos@…

Thanks Ben. I just assumed it was established practise:

$ pwd
/opt/local/var/macports/sources/rsync.macports.org/release/ports
$ grep -r install_name_tool * | wc -l
     123

I will file a bugreport upstream also.

comment:4 Changed 14 years ago by endgame.dos@…

Upstream bug: http://github.com/lloyd/yajl/issues/issue/11

If the CMakeLists.txt fix I proposed there is accepted quickly, then perhaps it would be better to bump yajl rather than patching the portfile?

comment:5 Changed 14 years ago by benjaminlyu@…

Yes. If yajl upstream accepts your fix, then version bump would be easier than maintaining more changes in a Portfile.

comment:6 Changed 14 years ago by endgame.dos@…

Upsteam hasn't responded to my issue in github and it's been nearly 2 weeks. The latest version on github (1.0.9) still has this defect. Simply bumping the port version to 1.0.9 appears to work. Yajl doesn't feature in my plans any more, so I haven't actually tested it.

comment:7 Changed 14 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign@… added
Resolution: fixed
Status: newclosed

I applied the patch in r66781. If upstream fixes the problem on their end, we can remove the workaround from the portfile again.

Note: See TracTickets for help on using tickets.