LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   pdftk for Slackware64-current. (http://www.linuxquestions.org/questions/slackware-14/pdftk-for-slackware64-current-767304/)

Martinezio 11-06-2009 07:55 AM

pdftk for Slackware64-current.
 
Hi,

recently I've tried to compile pdftk package for my Slack64-current box.
But the compile process has failed with such info:
Code:

Exception in thread "main" java.io.IOException: can't find class file java_local/security/Provider.class in java.net.URLClassLoader{urls=[file:/tmp/pdftk-1.41/java_libs/gnu_local/java/security/provider/./,file:/usr/share/java/libgcj-4.3.3.jar], parent=gnu.gcj.runtime.SystemClassLoader{urls=[file:./], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}}                                                                                                                 
  at gnu.classpath.tools.javah.Main.getClass(libgcj-tools.so.9)                                                       
  at gnu.classpath.tools.javah.ClassWrapper.linkSupers(libgcj-tools.so.9)                                             
  at gnu.classpath.tools.javah.ClassWrapper.printFully(libgcj-tools.so.9)                                             
  at gnu.classpath.tools.javah.CniIncludePrinter.printClass(libgcj-tools.so.9)                                         
  at gnu.classpath.tools.javah.Main.writeHeaders(libgcj-tools.so.9)                                                   
  at gnu.classpath.tools.javah.Main.run(libgcj-tools.so.9)                                                             
  at gnu.classpath.tools.javah.GcjhMain.main(libgcj-tools.so.9)                                                       
make[2]: *** [Gnu.h] Error 1                                                                                             
rm Gnu.class                                                                                                           
make[2]: Leaving directory `/tmp/pdftk-1.41/java_libs/gnu_local/java/security/provider'                             
make[1]: *** [libgcj_local] Error 2                                                                                     
make[1]: Leaving directory `/tmp/pdftk-1.41/java_libs'                                                               
make: *** [java_libs] Error 2

I found some info, checked the Debian packages, and made some edits in Makefiles. Problem was solver partialy. Still cannot make the package, but the error messages are different:
Code:

Exception in thread "main" java.io.IOException: can't find class file com/lowagie/text/Phrase.class in java.net.URLClassLoader{urls=[file:/tmp/pdftk-1.41/java_libs/com/lowagie/text/./,file:/usr/share/java/libgcj-4.3.3.jar], parent=gnu.gcj.runtime.SystemClassLoader{urls=[file:./], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}}
  at gnu.classpath.tools.javah.Main.getClass(libgcj-tools.so.9)
  at gnu.classpath.tools.javah.ClassWrapper.linkSupers(libgcj-tools.so.9)
  at gnu.classpath.tools.javah.ClassWrapper.printFully(libgcj-tools.so.9)
  at gnu.classpath.tools.javah.CniIncludePrinter.printClass(libgcj-tools.so.9)
  at gnu.classpath.tools.javah.Main.writeHeaders(libgcj-tools.so.9)
  at gnu.classpath.tools.javah.Main.run(libgcj-tools.so.9)
  at gnu.classpath.tools.javah.GcjhMain.main(libgcj-tools.so.9)
make[2]: *** [Anchor.h] Error 1
rm Anchor.class
make[2]: Leaving directory `/tmp/pdftk-1.41/java_libs/com/lowagie/text'
make[1]: *** [itext] Error 2
make[1]: Leaving directory `/tmp/pdftk-1.41/java_libs'
make: *** [java_libs] Error 2

Any helps or hints?
Or maybe some one of You knows there is somewhere a ready to use package for Slack64-13 (or -current)?

TIA.

escaflown 11-06-2009 09:51 PM

I recently got into the same trouble while compiling pdftk in my x86 slackware 13. I used to run it in my slack 12.2 but no way to get it to run in slackware 13. I would be interessed if someone got it to work.

Martinezio 11-09-2009 07:15 AM

Hi :)

Almost done. I found on slacky.eu repository a SlackBuild script for this tool, and a patch to enable compilation on gcc 4.3.
Here is the patch:
http://repository.slacky.eu/slackwar...-gcc-4.3.patch

But the source files are not clean, and this patch is not applied for every file they should. You probably get some rejection on 3 Makefiles:

$SRC-DIR/java_libs/com/lowagie/text/pdf/codec/Makefile
$SRC-DIR/java_libs/com/lowagie/text/pdf/codec/postscript/Makefile
$SRC-DIR/java_libs/com/lowagie/text/pdf/codec/wmf/Makefile

You need to change the files by hand. It's easy. You should replace gcjh command for generating headers from classes, and provide FQDN classpath as this:
Code:

# gcjh doesn't want the ".class" extension, so use
# the "$*" automatic variable, here
#
%.h : %.class
        $(GCJH) --classpath="$(java_libs_root):." $*;
#                            ^^^^^^^^^^^^^^^^^^ this is what You need to add ;)

Edit: I forgot to mention, that You shoud also remove the command just after gcjh command ($(RM) ... ). It's important.

Currently trying to make the package for x86_64...
(tfu tfu ;))

Martinezio 11-09-2009 07:45 AM

Hmm... Still something wrong, but this time I was able to compile java-things of pdftk.

Currently I get this errors:
Code:

../java_libs/com/lowagie/text/pdf/pdf.a(PdfEncryption.o): In function `com::lowagie::text::pdf::PdfEncryption::PdfEncryption()':
ccWMwkN3.jar:(.text+0x343): undefined reference to `java_local::security::MessageDigest* java_local::security::MessageDigest::getInstance(java::lang::String*)'
../java_libs/com/lowagie/text/pdf/pdf.a(PdfEncryption.o): In function `JArray<char>* com::lowagie::text::pdf::PdfEncryption::createDocumentId()':
ccWMwkN3.jar:(.text+0x9fc): undefined reference to `java_local::security::MessageDigest* java_local::security::MessageDigest::getInstance(java::lang::String*)'
../java_libs/com/lowagie/text/pdf/pdf.a(PdfEncryption.o):(.data+0x1e8): undefined reference to `java_local::security::MessageDigest::class$'
collect2: ld returned 1 exit status
make: *** [pdftk] Error 1

Ehh... Still lookin' for reason and solution...

Martinezio 11-09-2009 08:28 AM

Looks, like the itext part of pdftk is staticaly linked for internal version of gcj part available in source tree... This patch available in slacky repository doesn't repair the makefiles in gcj-tree, but removes build commands from main makefile of java's tree.
Restoring those command and repairing the makefiles as mentioned above is the solution, I think :)

How to produce a patch file for entire tree?

Martinezio 11-09-2009 09:01 AM

Damn... Compilation still unsuccesfull :/ The same result, as above... Still, undefinied reference.

Martinezio 11-09-2009 09:13 AM

I am stupid! :redface:
I said previously, that the patch from Slacky.eu removes some commands from javas-part makefile, but I forgot to check the main makefile of whole source tree!.

Well, the patch removes definition of gcj libraries, so the ld tool cannot collect all information ;)

Restoring these lines solute all!

I was able to make pdftk tool :)

I try to make the patch file, so I pase it into this thread soon...

escaflown 11-09-2009 07:45 PM

If you succeed, you should try to contact the maintainer of the slackbuild for an update for slackware 13.

hemp4fuel 11-09-2009 11:22 PM

I have been fighting this one for awhile, thanks for getting on the right track.

escaflown 11-09-2009 11:34 PM

Quote:

Originally Posted by hemp4fuel (Post 3751138)
I have been fighting this one for awhile, thanks for getting on the right track.

:) Welcome in the club.

Martinezio 11-10-2009 02:44 AM

There is some incompatibility with the recent gcj library - when I try to run pdftk made by myself, I got "Wrong ABI version" error message.
Still fighting ;)

larryhaja 11-10-2009 03:27 PM

Quote:

Originally Posted by Martinezio (Post 3750216)
Almost done. I found on slacky.eu repository a SlackBuild script for this tool, and a patch to enable compilation on gcc 4.3.
Here is the patch:
http://repository.slacky.eu/slackwar...-gcc-4.3.patch

But the source files are not clean, and this patch is not applied for every file they should. You probably get some rejection on 3 Makefiles:

$SRC-DIR/java_libs/com/lowagie/text/pdf/codec/Makefile
$SRC-DIR/java_libs/com/lowagie/text/pdf/codec/postscript/Makefile
$SRC-DIR/java_libs/com/lowagie/text/pdf/codec/wmf/Makefile

The problem with the patch from slacky.eu is that it is entirely UNIX formatted and the files you mentioned above are in DOS format. If you want to get a patch that actually works try this.
Code:

# wget http://sources.gentoo.org/viewcvs.py/*checkout*/gentoo-x86/app-text/pdftk/files/pdftk-1.41-gcc-4.3.patch
Don't open this up in a text editor as it may change the formatting. I used this patch in conjunction with another patch for gcc 4.4 on Slackware 13.0 and pdftk runs fine. I tested converting and combining some pdf's and it worked without any issues.
Code:

# wget http://sources.gentoo.org/viewcvs.py/*checkout*/gentoo-x86/app-text/pdftk/files/pdftk-1.41-gcc-4.4.patch
This patch may be needed for people running current with the newer gcc 4.4.2.

I've tried this on i486 so I don't know if the above works on x86_64.

escaflown 11-10-2009 09:03 PM

Just tried larryhaja's patch and it worked. Thanks!

hemp4fuel 11-11-2009 12:04 AM

Doesn't seem to work on x86_64 but it is good to have it working on my 32bit machine, thanks!

Martinezio 11-12-2009 08:05 AM

Disagree - works for me on x86_64 platform with small change :)

In Makefile.Generic You need to add -fPIC option into CPPFLAGS and CXXFLAGS vars, and run the make with LDFLAGS="-L/usr/lib64" envar :)

No more "Incorrect ABI version" issues, and pdftk is fully working now!
Thanks for the patches :hattip:


All times are GMT -5. The time now is 04:14 PM.