discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Xpdf and linking problems


From: Sebastian Reitenbach
Subject: Re: Xpdf and linking problems
Date: Sat, 02 Jun 2012 08:46:31 +0200
User-agent: SOGoMail 1.3.15

 
On Saturday, June 2, 2012 00:13 CEST, Riccardo Mottola 
<riccardo.mottola@libero.it> wrote: 
 
> Hi,
> 
> I fixed several details in the PDFKit/xpdf build system (currently 
> available in GAP and used for example by GWorkspace by its inspector).
> 
> It contained several hacks which made it compile on linux+gcc, but not 
> well on other systems or compilers.
> I fixed some places which forced the "C" compiler to be g++ (I suppose 
> for linking purposes) which prevented building with clang and cleaned up 
> some of the cflags and ldflags.
> 
> I still can build fine and use it on linux/x86 and on freebsd8/gcc. With 
> freeBSD9 it builds (but displays white pages). On NetBSD and OpenBSD 
> however it builds, but it fails to be used by the gworkspace configure 
> script. I think that either some option is not working or that 
> gnustep-make has problems when linking objective-c and C++ file?
> I suppose that when OBJC, CC files are mixed, our make system will do 
> the right thing...
> 
> The symbols appear to be C++ symbols, or not?
> 
> Ideas/suggestions/patches welcome.
> 
> Riccardo
> 
> 
>  From NetBSD:
> 
> configure:3536: checking for PDFKit
> configure:3552: gcc -o conftest -xobjective-c -MMD -MP -DGNUSTEP 
> -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 
> -DGNUSTEP_BASE_LIBRARY=1 -fno-strict-aliasing -fexceptions 
> -fobjc-exceptions -D_NATIVE_OBJC_EXCEPTIONS -pthread -fPIC -Wall 
> -DGSWARN -DGSDIAGNOSE -Wno-import -g -O2 -fgnu-runtime 
> -fconstant-string-class=NSConstantString 
> -I/Local/Library/Headers/ObjectiveC2 -fexec-charset=UTF-8 
> -I/usr/pkg/include -I. -I/usr/pkg/include 
> -I/home/multix/GNUstep/Library/Headers -I/Local/Library/Headers 
> -I/System/Library/Headers   -rdynamic -Wl,-R/usr/pkg/lib -L/usr/pkg/lib 
> -Wl,-R/usr/X11R6/lib -L/usr/X11R6/lib -pthread -shared-libgcc 
> -fexceptions -fgnu-runtime -L/home/multix/GNUstep/Library/Libraries 
> -L/Local/Library/Libraries -L/System/Library/Libraries 
> -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lgnustep-gui -lgnustep-base -lpthread 
> -lobjc -lm conftest.c  -lPDFKit >&5
> /Local/Library/Libraries/libPDFKit.so: warning: warning: tmpnam() 
> possibly used unsafely, use mkstemp() or mkdtemp()
> /Local/Library/Libraries/libPDFKit.so: undefined reference to `operator 
> new[](unsigned int)'
> /Local/Library/Libraries/libPDFKit.so: undefined reference to `operator 
> delete[](void*)'
> /Local/Library/Libraries/libPDFKit.so: undefined reference to `operator 
> delete(void*)'
> /Local/Library/Libraries/libPDFKit.so: undefined reference to 
> `__cxa_pure_virtual'
> /Local/Library/Libraries/libPDFKit.so: undefined reference to 
> `__gxx_personality_v0'
> /Local/Library/Libraries/libPDFKit.so: undefined reference to `vtable 
> for __cxxabiv1::__class_type_info'
> /Local/Library/Libraries/libPDFKit.so: undefined reference to `operator 
> new(unsigned int)'
> /Local/Library/Libraries/libPDFKit.so: undefined reference to `vtable 
> for __cxxabiv1::__si_class_type_info'
> c
> 

On OpenBSD the GWorkspace config.log looks like this:

configure:3536: checking for PDFKit
configure:3552: cc -o conftest -xobjective-c -MMD -MP -DGNUSTEP 
-DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -
DGNU_RUNTIME=1 -DGNUSTEP_BASE_LIBRARY=1 -fno-strict-aliasing -pthread -fPIC 
-Wall -DGSWARN -DGSDIAGNOSE -Wno-i
mport -O2 -pipe -fgnu-runtime -fconstant-string-class=NSConstantString 
-I/usr/local/include/ObjectiveC2 -I. -I
/usr/local/include -I/GNUstep/Library/Headers -I/usr/local/include   -Wl,-E 
-pthread -fgnu-runtime -L/GNUstep/
Library/Libraries -L/usr/local/lib -L/usr/local/lib -lgnustep-gui 
-lgnustep-base -pthread -lobjc -lm conftest.
c  -lPDFKit >&5
/usr/lib/libobjc.so.5.0: warning: strcpy() is almost always misused, please use 
strlcpy()
/usr/local/lib/libgnustep-base.so.5.0: warning: sprintf() is often misused, 
please use snprintf()
/usr/local/lib/libicui18n.so.4.0: warning: strcat() is almost always misused, 
please use strlcat()
/usr/local/lib/libungif.so.5.4: warning: vsprintf() is often misused, please 
use vsnprintf()
/usr/local/lib/libgcrypt.so.15.0: warning: stpcpy() is dangerous GNU crap; 
don't use it
/usr/bin/ld: warning: libfreetype.so.18.1, needed by 
/usr/local/lib/libPDFKit.so.0.0, not found (try using -rp
ath or -rpath-link)
/usr/local/lib/libPDFKit.so.0.0: undefined reference to `FT_Init_FreeType'
/usr/local/lib/libPDFKit.so.0.0: undefined reference to `FT_Load_Glyph'
/usr/local/lib/libPDFKit.so.0.0: undefined reference to `FT_Done_Face'
/usr/local/lib/libPDFKit.so.0.0: undefined reference to `FT_Render_Glyph'
/usr/local/lib/libPDFKit.so.0.0: undefined reference to `FT_New_Size'
/usr/local/lib/libPDFKit.so.0.0: undefined reference to `FT_Get_Glyph'
/usr/local/lib/libPDFKit.so.0.0: undefined reference to `FT_Outline_Decompose'
/usr/local/lib/libPDFKit.so.0.0: undefined reference to `FT_Set_Pixel_Sizes'
/usr/local/lib/libPDFKit.so.0.0: undefined reference to `FT_Done_FreeType'
...

For the time being, I fixed the problem by putting:
LDFLAGS=-L/usr/X11R6/lib 
in the configure environment, and giving
LDFLAGS="-L/usr/X11R6/lib -lfreetype"
as make flags when compiling.

but I just got curious about the -rpath or -rpath-link, and found this:
http://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_node/ld_3.html
So now I came up with the following patch to PDFKit
to not need the environment variables and make flags anymore
when configuring and compiling GWorkspace:

$OpenBSD$
--- GNUmakefile.in.orig Sat Jun  2 08:30:55 2012
+++ GNUmakefile.in      Sat Jun  2 08:31:56 2012
@@ -64,7 +64,7 @@ PDFKit_RESOURCE_FILES = \
 
 ADDITIONAL_INCLUDE_DIRS = -Ixpdf/bridge
 ADDITIONAL_OBJCFLAGS = -Wall
-ADDITIONAL_LDFLAGS += -L$(LIB_FREETYPE_LIBS)
+ADDITIONAL_LDFLAGS += -L$(LIB_FREETYPE_LIBS) -Wl,-rpath,$(LIB_FREETYPE_LIBS)
 ADDITIONAL_LDFLAGS += $(XPDF_OBJ_FILES) -lfreetype -lm
 
 # Use C++ to link library (this won't work if g++ is not the obj-c compiler!)


I'm not sure, whether encoding the the library path with -rpath is the 
right/best solution.
Also no idea whether it would break things on other OSs. Maybe it only should 
need to be
added on OpenBSD?

But Riccardos problem on NetBSD seems to be a bit different.

Sebastian


> _______________________________________________
> Discuss-gnustep mailing list
> Discuss-gnustep@gnu.org
> https://lists.gnu.org/mailman/listinfo/discuss-gnustep
 
 
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]