3

I'm coding a program in Java and I would like to connect to Prolog. Thus, I decided to use JPL. It is perfectly to use JPL on Windows Vista. Later, I have to change the OS platform to be Ubuntu 11.04. Unfortunately, there is an error:

symbol lookup error: /usr/lib/swi-prolog/lib/i386/libjpl.so: undefined symbol: PL_is_initialised

Environment:

  1. Ubuntu 11.04
  2. Java version 1.6.0_24
  3. Eclipse Galileo Version: 3.5.2
  4. SWI-Prolog version 5.10.1 for i386
  5. Jpl (apt-get install swi-prolog-java)
  6. Family.java + family.pl

I explain steps of working and problems as follows. step1: Install swi-prolog + jpl using Synaptic Package Manager Swi-prolog Installation

step2: Run Family.java , found an error JPL not found Error

step3: Configure the library path at VMarguments Set VMarguments step4: Run again, there is an error /usr/lib/jvm/java-6-sun-1.6.0.24/bin/java: symbol lookup error: /usr/lib/swi-prolog/lib/i386/libjpl.so: undefined symbol: PL_is_initialised step5: I also config the environment but the error still the same. set environment arguments

The method that I used to solve the problem as in step 3 and 5 I searched from the internet. I can not find other solutions to try. Does anyone have any idea?
Thanks in advance.

NoBugs
  • 9,310
  • 13
  • 80
  • 146
BB.
  • 707
  • 2
  • 11
  • 22
  • Apparently this bug has been reported here: https://bugs.launchpad.net/ubuntu/+source/swi-prolog/+bug/597619 – NoBugs Mar 20 '12 at 21:04

2 Answers2

1

You have to config the LD_LIBRARY_PATH, I think. Try to add the location of the so-library file. And make sure, your System.loadLibrary(); call is relative.

Martijn Courteaux
  • 67,591
  • 47
  • 198
  • 287
  • Thanks for your answer. I have done according to your suggestions but it doesn't work. the java library path =/usr/lib/swi-prolog/lib/i386/ but there is an error "java.lang.UnsatisfiedLinkError: no libjpl.so in java.library.path" even if there is a libjpl.so at "/usr/lib/swi-prolog/lib/i386/libjpl.so" – BB. Jul 01 '11 at 09:08
1

Thank you very much for every supports. Now,i can manage this problem. I found a suggestion from page http://code.google.com/p/javanaproche/wiki/HowToJPL

Following the instructions, i change the swi-prolog version to be a building form source pl-5.10.1. Finally, it works. I think the problem happens because the swi-prolog getting from synaptic manager doesn't set to be a shared library. If anyone knows how to set a share library , it might be work.

BB.
  • 707
  • 2
  • 11
  • 22
  • Good answer, it worked on one 32-bit machine I tried, but I'm getting an error on 64bit. Any ideas why? http://stackoverflow.com/questions/9336371/compiling-prolog-jpl-on-ubuntu-11-10-64-bit – NoBugs Feb 19 '12 at 22:26