Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Could not find dynamic library: p_Procs_FieldIndep.so (path)
PostPosted: Tue Mar 21, 2017 6:58 pm 

Joined: Thu Mar 09, 2017 5:30 pm
Posts: 11
I downloaded the source code for Singular from https://github.com/Singular/Sources and compiled it succesfully.
Now I want to create my own code and link it to the Singular libs.
My (very simple) code is:
Code:
#include <libsingular.h>
int main()
{
   char** n = (char**) omalloc( 3*sizeof(char*) );
   n[0]=omStrDup("x");
   n[1]=omStrDup("y");
   n[2]=omStrDup("z");
   ring R = rDefault(0, 3, n);
}

I compile this with:
Quote:
SINGULAR_BASE=/home/mkolstein/Singular/Sources-spielwiese/
FOO=$SINGULAR_BASE/libpolys/polys/.libs/p_Procs_FieldIndep.so
g++ -I$SINGULAR_BASE/Singular/ -I$SINGULAR_BASE/ -I$SINGULAR_BASE/libpolys/ -I$SINGULAR_BASE/factory/include/ -I$SINGULAR_BASE/libpolys/polys/.libs/ -o mysingular mySingular.cxx -L$SINGULAR_BASE/Singular/.libs/ -lSingular -L$SINGULAR_BASE/libpolys/polys/.libs/ -lpolys $FOO -L$SINGULAR_BASE/resources/.libs/ -lsingular_resources -L$SINGULAR_BASE/omalloc/.libs/ -lomalloc

and before running my executable, also make sure LD_LIBRARY_PATH can find all ".so" files:
Quote:
export SINGULAR_BASE=/home/mkolstein/Singular/Sources-spielwiese/
export SINGULAR_LIB_DIR=$SINGULAR_BASE/Singular/.libs/
export SINGULAR_LIB_2=$SINGULAR_BASE/libpolys/polys/.libs/
export SINGULAR_LIB_3=$SINGULAR_BASE/resources/.libs/
export SINGULAR_LIB_4=$SINGULAR_BASE/omalloc/.libs/
export SINGULAR_LIB_5=$SINGULAR_BASE/libpolys/polys/.libs/p_Procs_FieldIndep.so
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SINGULAR_LIB_DIR:$SINGULAR_LIB_2:$SINGULAR_LIB_3:$SINGULAR_LIB_4:$SINGULAR_LIB_5

However, when I run my executable "mysingular", I get the following warning:
Quote:
Bug >>feArgv0 == NULL<< at feResource.cc:403
// ** Could not find dynamic library: p_Procs_FieldIndep.so (path )
// ** Singular will work properly, but much slower.
// ** See the INSTALL section in the Singular manual for details.

How can I avoid this?


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Could not find dynamic library: p_Procs_FieldIndep.so (path)
PostPosted: Wed Mar 22, 2017 11:05 am 

Joined: Wed May 25, 2005 4:16 pm
Posts: 275
You are missing the initialization:
Code:
void main()
{
  // init path names etc.: the string should point to an existing
  //            executable in a directory $B
  //            LIBs are searched in $B/LIB, $B/../LIB,
  //            see kernel/feRessource.cc
  // also needed to find its dynamic modules in $B/MOD, $B/../lib/singular/MOD, $B/../libexec/singular/MOD,...
  siInit((char *)"./Singular/libsingular.so");
....


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Could not find dynamic library: p_Procs_FieldIndep.so (path)
PostPosted: Wed Mar 22, 2017 1:04 pm 

Joined: Thu Mar 09, 2017 5:30 pm
Posts: 11
Adding
Quote:
siInit((char *)"./Singular/libsingular.so");

still gives me:
Quote:
? cannot open `standard.lib`
// ** Could not find dynamic library: p_Procs_FieldIndep.so (path )
// ** Singular will work properly, but much slower.
// ** See the INSTALL section in the Singular manual for details.

Adding both lines like:
Quote:
siInit((char *)"../../Singular/.libs/libSingular.so");
siInit((char *)"../../libpolys/polys/.libs/p_Procs_FieldIndep.so");

gives me:
Quote:
? cannot open `standard.lib`
coeff 7 already initialized
coeff 8 already initialized
? cannot open `standard.lib`
// ** Could not find dynamic library: p_Procs_FieldIndep.so (path )
// ** Singular will work properly, but much slower.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Could not find dynamic library: p_Procs_FieldIndep.so (path)
PostPosted: Thu Mar 23, 2017 12:27 pm 

Joined: Wed May 25, 2005 4:16 pm
Posts: 275
First of all: siInit must only be called once.

Its arguments should be a readable file (usually it is the main binary Singular,
derived from argv[0]).
If the directory this file is in is %b, and %r is the prefix given in the configuration (or /usr/local
if nothing was given)
then Singulars *.lib files are searched in %b/../share/singular/LIB, and %b/LIB,
dynamic modules are searched in "%b/MOD;" "%r/lib/singular/MOD;" "%r/libexec/singular/MOD;".
(see ressources/feRessources.cc).
Otherwise, one may set the environment variables
SINGULAR_PROCS_DIR for the dynamic modules,
SINGULARPATH for *.lib files,


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Could not find dynamic library: p_Procs_FieldIndep.so (path)
PostPosted: Fri Mar 24, 2017 5:43 pm 

Joined: Thu Mar 09, 2017 5:30 pm
Posts: 11
From where my own code is located, the Singular directory is 2 directories up.
So I make this call in my code:
Quote:
siInit((char *)"../../Singular/.libs/libSingular.so");

Next, I do an export, as you suggested, for the following directories:
Quote:
export SINGULAR_PROCS_DIR=../../Singular/MOD/
export SINGULARPATH=../../Singular/LIB/

Now, when running my code it complains:
Quote:
./mysingular: error while loading shared libraries: libSingular-4.1.0.so: cannot open shared object file: No such file or directory

The only "libSingular-4.1.0.so" I can find is this one:
Quote:
../../Singular/.libs/libSingular-4.1.0.so

Do I have to link this to the "MOD" directory?


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Could not find dynamic library: p_Procs_FieldIndep.so (path)
PostPosted: Tue Mar 28, 2017 11:03 am 

Joined: Wed May 25, 2005 4:16 pm
Posts: 275
These are 2 different things:

A) shared libraries: the rules for your OS apply: i.e. set LD_LIBRARY_PATH for the dynamic linker to find then
(see "man ld", "man ldconfig", "info gcc").
They are called lib*.so and can be found (on Linux) by "ldd libSingular.so"

B) dynamic modules for Singular: their name does not start with lib, and they are searched in the places given by SINGULAR_PROCS_DIR (and ...., see my previous post)


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Could not find dynamic library: p_Procs_FieldIndep.so (path)
PostPosted: Fri Mar 31, 2017 3:17 pm 

Joined: Thu Mar 09, 2017 5:30 pm
Posts: 11
Thanks for your help. Indeed, doing this did the trick:

Code:
export SINGULAR_BASE=/home/mydir/Sources-spielwiese/
export SINGULAR_LIB_DIR=$SINGULAR_BASE/Singular/.libs/
export SINGULAR_LIB_2=$SINGULAR_BASE/libpolys/polys/.libs/
export SINGULAR_LIB_3=$SINGULAR_BASE/resources/.libs/
export SINGULAR_LIB_4=$SINGULAR_BASE/omalloc/.libs/

export SINGULAR_LIB_5=$SINGULAR_BASE/libpolys/polys/.libs/p_Procs_FieldIndep.so

export SINGULAR_PROCS_DIR=$SINGULAR_BASE/Singular/MOD/
export SINGULARPATH=$SINGULAR_BASE/Singular/LIB/

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SINGULAR_LIB_DIR:$SINGULAR_LIB_2:$SINGULAR_LIB_3:$SINGULAR_LIB_4:$SINGULAR_LIB_5:$SINGULARPATH:$SINGULAR_PROCS_DIR


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

It is currently Fri May 13, 2022 11:01 am
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group