[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] Re: shared library error

From: sergiu netotea
Subject: Re: [igraph] Re: shared library error
Date: Thu, 27 Jan 2011 10:07:00 +0100

Hi, I already solved the problem. It wasn't igraph related anymore so
Tamas took it off from the mailing list. The problem was that Cygwin
is still case insensitive, and I had a file variable initialized with
"Pop_edl.txt", when the actual
filename was "pop_edl.txt". For some silly reason I did not caught the
file not found error, although I usually do that.
The bit of code i posted was extracted in a haste, what really caused
the error is this:

#include <igraph.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define F1 "Pop_edl.txt"
#define NG1 13633

int main()
    long int ng1 = NG1;
    igraph_bool_t dir = IGRAPH_DIRECTED; //graph is directed
    igraph_t g1;
    FILE *ifile;
    ifile=fopen(F1, "r");
    printf("Done reading files!\n");
        return 0;

Perhaps igraph should have a way of telling if the file was not opened
correctly although igraph cannot replace a programmer's bad practice.


On Wed, Jan 26, 2011 at 5:26 PM, Gábor Csárdi <address@hidden> wrote:
> Hi,
> On Wed, Jan 26, 2011 at 12:20 PM, sergiu netotea
> <address@hidden> wrote:
>> The program crashes in the first few lines:
>> #include <igraph.h>
>> #include <stdio.h>
>> #include <string.h>
>> #include <stdlib.h>
>> int main()
>> {
>>    long int ng1 = NG1, ng2 = NG2;
>>    unsigned char *seq;
>>        //typedef unsigned char byte;
>>        printf("%d",sizeof(unsigned char));
>> }
> This program does not even compile, since NG1 and NG2 are not defined.
>> It never reaches that printf output
>> the debug message is:
>> (gdb) run
>> Starting program: /home/netotea/calgn/grna
>> warning: no loadable sections found in added symbol-file
>> system-supplied DSO at 0x2aaaaaaab000
>> Program received signal SIGSEGV, Segmentation fault.
>> 0x00000039a2468f31 in getc () from /lib64/libc.so.6
>> I repeat, on cygwin it all runs fine. I reckon it has to do with the
>> unsigned char, since it dumps at getc().
> I don't see any getc() in your program.
>> In my program I have a huge
>> table of zeros and ones, NG1xNG2 = 13000x22000, which I store as
>> unsigned chars to occupy less space.
> Don't allocate large objects on the stack, allocate them in the heap,
> with malloc/calloc.
> Btw. sizeof() does not return int, so the %d format specification is wrong.
> Gabor
>> Any ideas? Of course, this is not igraph related anymore..
>> S.
>> On Wed, Jan 26, 2011 at 11:50 AM, Tamas Nepusz <address@hidden> wrote:
>>> Dear Sergiu,
>>> LD_LIBRARY_PATH is definitely a good step towards the solution; it seems
>>> like your system does not look for shared libraries in /usr/local/lib by
>>> default, and that's where you put the igraph libs. You can force your
>>> system to look for libs there either by setting LD_LIBRARY_PATH (I'd do
>>> it in the shell profile if I were you so that it is enforced every time
>>> you log in), or by adding /usr/local/lib to /etc/ld.so.conf.
>>> As for the segmentation fault, we need more information to sort that
>>> out; at least we have to know which function the program crashes in.
>>> First, try to compile your program using the -g switch to add the debug
>>> symbols to the executable, then run it under gdb (the GNU debugger) and
>>> list the backtrace (using the "bt" command) when it crashes. The
>>> backtrace is invaluable to determine whether the crash happens somewhere
>>> in igraph or not. (And if it does, we would also need the source code of
>>> your program, or even better, a self-contained example that reproduces
>>> the crash).
>>> --
>>> Tamas
>>>> Some further news,
>>>> I checked the content of $LD_LIBRARY_PATH and it was empty, so I added my 
>>>> path:
>>>> export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
>>>> Now my program ran but with a segmentation fault. However I got no seg
>>>> faults on cygwin :((
>>>> Not sure that I solved the shared library problem though, make it
>>>> chooses the wrong file, I saw three:
>>>> libigraph.so libigraph.so.0  libigraph.so.0.0.0
>>>> On Wed, Jan 26, 2011 at 11:03 AM, sergiu netotea
>>>> <address@hidden> wrote:
>>>>> Hi,
>>>>> I have a server running Red Hat Enterprize edition, I installed the
>>>>> igraph library from source code following the normal ./configure,
>>>>> make, make install steps. I have a program that runs well on my local
>>>>> cygwin, compiled with:
>>>>> gcc grn.c -Wall -I/usr/local/include/igraph -L/usr/local/lib -ligraph -o 
>>>>> grna
>>>>> It does compile on the server without any message but when I run it, it 
>>>>> gives:
>>>>> ./grna: error while loading shared libraries: libigraph.so.0: cannot
>>>>> open shared object file: No such file or directory
>>>>> However the libs are there, beside the fact that in the compilation
>>>>> step it managed to find them:
>>>>> ls /usr/local/lib
>>>>> libgsl.a  libgslcblas.a  libgslcblas.la  libgslcblas.so
>>>>> libgslcblas.so.0  libgslcblas.so.0.0.0  libgsl.la  libgsl.so
>>>>> libgsl.so.0  libgsl.so.0.15.0  libigraph.a  libigraph.la  libigraph.so
>>>>>  libigraph.so.0  libigraph.so.0.0.0  pkgconfig
>>>>> The include files are also in their place. I suspect it has to do with
>>>>> bad registration of the shared library. But why didn't I get any
>>>>> message at installation, or when I compiled my program?
>>>>> I wanted to check the cache of ldconfig but strangely enough the
>>>>> command is not available.
>>>>> Looking at this it all seems like a big hurdle and I don't have much
>>>>> time right now:
>>>>> http://www.faqs.org/docs/Linux-HOWTO/Program-Library-HOWTO.html#AEN115
>>>>> I am not very good at libtools, perhaps you can give me some help
>>>>> running my program? JJ
>>>>> Thanks!
>>>> _______________________________________________
>>>> igraph-help mailing list
>>>> address@hidden
>>>> http://lists.nongnu.org/mailman/listinfo/igraph-help
>>> _______________________________________________
>>> igraph-help mailing list
>>> address@hidden
>>> http://lists.nongnu.org/mailman/listinfo/igraph-help
>> _______________________________________________
>> igraph-help mailing list
>> address@hidden
>> http://lists.nongnu.org/mailman/listinfo/igraph-help
> --
> Gabor Csardi <address@hidden>     UNIL DGM
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help

reply via email to

[Prev in Thread] Current Thread [Next in Thread]