gcc - toquelib behaves different with static and dynamic linking -


this puzzling me... have code looks this:

#include <stdio.h> #include <pbs_ifl.h>  int dosomestuff() {     char *server_name;     int c;      server_name = pbs_default();      c = pbs_connect(server_name);     printf("pbs_errno %d\n",pbs_errno);      // stuff      pbs_disconnect(c); } 

when compile with:

gcc -static -o executablename sourcefile.c -ltorque 

it works allright, compiling '-static'. pbs_errno 0 , can stuff.

but if remove '-static' flag starts giving me message when run it:

munge: error: unable access "/var/run/munge/munge.socket.2": no such file or directory 

so... start munge service (munged) , stops complaining it, instead pbs_errno=15033 , can't cluster (do stuff).

any ideas?

i don't know if delete de question or answer it, seems solved... i'm posting solution here.

i had 2 versions of lib installed, 1 via yum other via source. since compiled code had static libs, when linking -static gcc linking compiled code , when linking dynamic linking yum version.

i had enforce linking right libs adding following flag when liking:

-wl,-rpath=/usr/local/lib 

Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -