Summary: | [patch] graphics/mupdf add -fPic option | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | Ports & Packages | Reporter: | Zsolt Udvari <uzsolt> | ||||||||
Component: | Individual Port(s) | Assignee: | Tijl Coosemans <tijl> | ||||||||
Status: | Closed FIXED | ||||||||||
Severity: | Affects Only Me | CC: | tijl | ||||||||
Priority: | --- | ||||||||||
Version: | Latest | ||||||||||
Hardware: | Any | ||||||||||
OS: | Any | ||||||||||
Attachments: |
|
Why do you need this? The package builds fine without. (In reply to Tijl Coosemans from comment #1) > Why do you need this? The package builds fine without. I'm working on graphics/zathura-pdf-mupdf port ( http://pwmt.org/projects/zathura-pdf-mupdf/ ) and doesn't build it without -fPIC (and prints an error message about rebuilding with -fPIC). With -fPIC builds fine. (In reply to Zsolt Udvari from comment #2) > (In reply to Tijl Coosemans from comment #1) > > Why do you need this? The package builds fine without. > > I'm working on graphics/zathura-pdf-mupdf port ( > http://pwmt.org/projects/zathura-pdf-mupdf/ ) and doesn't build it without > -fPIC (and prints an error message about rebuilding with -fPIC). With -fPIC > builds fine. Check this log: https://redports.org/~uzsolt/20140805110937-15588-230356/zathura-pdf-mupdf-0.2.6.log : /usr/bin/ld: /usr/local/lib/libmupdf.a(list-device.o): relocation R_X86_64_32S against `a local symbol' can not be used when making a shared object; recompile with -fPIC /usr/local/lib/libmupdf.a: could not read symbols: Bad value zathura is trying to statically a shared object to libmupdf.a which case would expect PIC object in libmupdf.a on 64bits arches. but PIC object in a .a can have some unwanted side effects this patch is for sure not the right solution What you probably want to do is create 2 .a: libmupdf.a and libmupdf_shared.a the second built with -fPIC and make zathura use the second (In reply to Baptiste Daroussin from comment #5) > What you probably want to do is create 2 .a: > libmupdf.a and libmupdf_shared.a the second built with -fPIC and make > zathura use the second Okay, I'll try it. Thanks for information and suggestion. Created attachment 145393 [details]
preliminary patch
Here's a preliminary patch. The redports builds are still running.
(In reply to Tijl Coosemans from comment #7) > Created attachment 145393 [details] > preliminary patch > > Here's a preliminary patch. The redports builds are still running. Thank you. I didn't create similar thing (two versions of lib) in FreeBSD so the idea is very useful for me. Created attachment 145397 [details]
proposed patch
This patch actually builds.
(In reply to Tijl Coosemans from comment #9) > Created attachment 145397 [details] > proposed patch > > This patch actually builds. This patch builds well but zathura can't run: error: could not load plugin /usr/local/lib/zathura/pdf.so (/usr/local/lib/zathura/pdf.so: Undefined symbol "fz_identity") libmupdf_pic.a doesn't contain "fz_identity" but libmupdf.a contains: $ grep fz_identity /usr/local/lib/libmupdf* Binary file /usr/local/lib/libmupdf.a matches (In reply to Zsolt Udvari from comment #10) > error: could not load plugin /usr/local/lib/zathura/pdf.so > (/usr/local/lib/zathura/pdf.so: Undefined symbol "fz_identity") > > libmupdf_pic.a doesn't contain "fz_identity" but libmupdf.a contains: > $ grep fz_identity /usr/local/lib/libmupdf* > Binary file /usr/local/lib/libmupdf.a matches When I add "XCFLAGS=-fPIC" to MAKE_ARGS (globally) I can build and run zathura-pdf-mupdf well. But I've notice some (for me) interesting thing: $ ls -l /usr/local/lib/libmupdf* -rwxr-xr-x 1 root wheel 10020966 aug 5 20:11 /usr/local/lib/libmupdf.a -r--r--r-- 1 root wheel 9026504 aug 5 20:11 /usr/local/lib/libmupdf_pic.a I think libmupdf.a and libmupdf_pic.a should same but their size are different. (In reply to Tijl Coosemans from comment #9) > Created attachment 145397 [details] > proposed patch > > This patch actually builds. Tijl: in section 'post-install' should use ${INSTALL_DATA} instead of ${INSTALL_LIB} ( https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/install.html ). With ${INSTALL_DATA} works well, zathura-pdf-mupdf too. So I think with this modification can apply your patch. A commit references this bug: Author: tijl Date: Tue Aug 5 19:05:34 UTC 2014 New revision: 364135 URL: http://svnweb.freebsd.org/changeset/ports/364135 Log: - Add dependency on libcurl - Remove a patch and simplify the Makefile a bit - Create and install libmupdf_pic.a which can be linked into shared libraries such as the zathura-pdf-mupdf plugin PR: 192397 Approved by: Zsolt Udvari <udvzsolt@gmail.com> (maintainer) Changes: head/graphics/mupdf/Makefile head/graphics/mupdf/files/patch-Makefile head/graphics/mupdf/pkg-plist Committed in r364135. |
Created attachment 145387 [details] The patch * Added -fPIC option to XCFLAGS * PORTREVISION bump