Anyone knows the paths of guile module searched by "load-extension"?

197 views
Skip to first unread message

Shujing Ke

unread,
Mar 28, 2017, 11:19:53 AM3/28/17
to opencog, Nil Geisweiller
Hi, 

Anyone know is there a file or somewhere that specify the paths that "load-extension" will search? I am adding a new module , it always says "ERROR: In procedure dynamic-link: file: "libguile-patternminer", message: "file not found"". 
libguile-patternminer.so is in build/opencog/learning/PatternMiner/
patternminer.scm is in build/opencog/scm/opencog/learning/
When I load patternminer.scm manually from guile shell, it gives the above error. 

I look at the other existing modules, I cannot find the place to specify the path. In files cogserver.scm and atom_types.scm, they say:
; libguile-cogserver.so is located in /usr/local/lib/opencog
; libnlp-types.so is in /usr/local/lib/opencog/modules
But libguile-cogserver.so and libnlp-types.so are not there.

Anyone can help? 
Thanks,
Shujing

Linas Vepstas

unread,
Mar 28, 2017, 11:35:13 AM3/28/17
to opencog, Nil Geisweiller
they should all be in /usr/local/lib/opencog

Did you run 'make install'?  I'm pretty sure that none of the scheme modules work, until you install them.

--linas



--
You received this message because you are subscribed to the Google Groups "opencog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opencog+unsubscribe@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
Visit this group at https://groups.google.com/group/opencog.
To view this discussion on the web visit https://groups.google.com/d/msgid/opencog/CALpD4-KNG0u-oUOaw8aXfcJ66%3D_GyAX2vMeFNRO9r4TMZS9c8w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Shujing Ke

unread,
Mar 28, 2017, 12:10:32 PM3/28/17
to opencog
Thanks, Linas, it works. I forgot that OpenCog does make install now.

Shujing

Shujing Ke

unread,
Mar 28, 2017, 3:38:29 PM3/28/17
to opencog
Actually, it still doesn't work.... 


After I did make install, I found libguile-patternminer.so in /usr/local/lib/opencog/ but  when I load patternminer.scm in guile manually , it still cannot find the so file:

guile> (load "opencog/scm/opencog/learning/patternminer.scm")

....ERROR: In procedure dynamic-link: file: "libguile-patternminer", message: "file not found"

Also I cannot find the place to add pre-load scm modules... When I do (use-modules (opencog patternminer)), it gives error:
....ERROR: no code for module (opencog patternminer)




AmeBel

unread,
Mar 28, 2017, 9:54:56 PM3/28/17
to opencog
Place  https://github.com/opencog/docker/blob/master/opencog/base/scripts/.guile in your home directory, or or execute the second line in your guile shell.
To unsubscribe from this group and stop receiving emails from it, send an email to opencog+u...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "opencog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opencog+u...@googlegroups.com.

Shujing Ke

unread,
Mar 29, 2017, 6:02:24 AM3/29/17
to opencog
Thanks Amen. 

I found that ADD_GUILE_MODULE (xxxxx.scm) will install xxxxx.scm to 
/usr/local/share/opencog/scm/opencog/xxxxx's dictionary, like patternminer.scm is installed in: /usr/local/share/opencog/scm/opencog/learning/ , but this dictionary will not be searched by guile (use-modules (opencog xxxxx)), even I added this path to config.scm in cogserver folder or I do 
guile> (add-to-load-path "/usr/local/share/opencog/scm/opencog/learning")
It still cannot be found.Only if I copy patternminer.scm to i/usr/local/share/opencog/scm/opencog/ , then it will be found by guile. 
When I do  (use-modules (opencog patternminer)),  it won't say "no code for opencog patternminer" any more; but it still cannot find libguile-patternminer.so, even libguile-patternminer.so is right located in /usr/local/lib/opencog/ . 



To unsubscribe from this group and stop receiving emails from it, send an email to opencog+unsubscribe@googlegroups.com.

To post to this group, send email to ope...@googlegroups.com.
Visit this group at https://groups.google.com/group/opencog.

Shujing Ke

unread,
Mar 29, 2017, 10:40:47 AM3/29/17
to opencog
Let me make the problem more clearly:

I start cogserver, and enter guile by rlwrap telnet localhost 17001
If I do  (load-extension "libguile-cogserver" "opencog_cogserver_init") , it works, but If I do (load-extension "libguile-patternminer.so" "opencog_patternminer_init") , it gives the below error:
In ice-9/boot-9.scm:
 157: 10 [catch #t #<catch-closure 2047b20> ...]
In unknown file:
   ?: 9 [apply-smob/1 #<catch-closure 2047b20>]
In ice-9/boot-9.scm:
 157: 8 [catch #t #<catch-closure 212ce40> ...]
In unknown file:
   ?: 7 [apply-smob/1 #<catch-closure 212ce40>]
   ?: 6 [call-with-input-string "(load-extension \"libguile-patternminer.so\" \"opencog_patternminer_init\")\n" ...]
In ice-9/boot-9.scm:
2320: 5 [save-module-excursion #<procedure 209cf30 at ice-9/eval-string.scm:65:9 ()>]
In ice-9/eval-string.scm:
  44: 4 [read-and-eval #<input: string 205fb60> #:lang ...]
  37: 3 [lp (load-extension "libguile-patternminer.so" "opencog_patternminer_init")]
In unknown file:
   ?: 2 [load-extension "libguile-patternminer.so" "opencog_patternminer_init"]
In ice-9/boot-9.scm:
 102: 1 [#<procedure 209dd40 at ice-9/boot-9.scm:97:6 (thrown-k . args)> misc-error ...]
In unknown file:
   ?: 0 [apply-smob/1 #<catch-closure 212ce00> misc-error ...]

ERROR: In procedure apply-smob/1:
ERROR: In procedure dynamic-link: file: "libguile-patternminer.so", message: "file not found"
ABORT: misc-error


libguile-patternminer.so is right in /usr/local/lib/opencog , the same as libguile-cogserver.so and other modules. Why guile cannot find it?

Thanks,
Shujing



AmeBel

unread,
Mar 29, 2017, 11:49:08 PM3/29/17
to opencog


On Wednesday, March 29, 2017 at 6:02:24 PM UTC+8, shujingke wrote:
Thanks Amen. 

I found that ADD_GUILE_MODULE (xxxxx.scm) will install xxxxx.scm to 
/usr/local/share/opencog/scm/opencog/xxxxx's dictionary, like patternminer.scm is installed in: /usr/local/share/opencog/scm/opencog/learning/ , but this dictionary will not be searched by guile (use-modules (opencog xxxxx)), even I added this path to config.scm in cogserver folder or I do 
guile> (add-to-load-path "/usr/local/share/opencog/scm/opencog/learning")
It still cannot be found.Only if I copy patternminer.scm to i/usr/local/share/opencog/scm/opencog/ , then it will be found by guile. 
When I do  (use-modules (opencog patternminer)),  it won't say "no code for opencog patternminer" any more; but it still cannot find libguile-patternminer.so, even libguile-patternminer.so is right located in /usr/local/lib/opencog/ . 

yes that is a correct behavior, A brief intro on how guile module's file-system structure work, https://www.gnu.org/software/guile/manual/guile.html#Modules-and-the-File-System 

The openpsi.scm file has the same name as the directory and has the define-module content. So when it is installed it is copied to /usr/local/share/opencog/scm/opencog/openpsi.scm while the rest of the files are copied to  /usr/local/share/opencog/scm/opencog/openpsi/other-files.scm





Shujing Ke

unread,
Mar 30, 2017, 3:23:44 PM3/30/17
to opencog
Thanks Amen. It turned out to be a dependency problem, not really cannot find the lib file, but cannot find another lib that this lib depends on. Guile gives a wrong error message.

To unsubscribe from this group and stop receiving emails from it, send an email to opencog+unsubscribe@googlegroups.com.

To post to this group, send email to ope...@googlegroups.com.
Visit this group at https://groups.google.com/group/opencog.
Reply all
Reply to author
Forward
0 new messages