[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-gsl] GSL problem
From: |
William Oquendo |
Subject: |
Re: [Help-gsl] GSL problem |
Date: |
Wed, 3 Jan 2018 00:08:23 -0500 |
Hi, let's keep the thread inside the mailing list.
Where did you install the library? it seems that it is not on the standard
path. Did you pass any flags to the configure command? In any case you can
solve this problem (a loader problem) in several ways:
1) Specifying the path where the loader can find the libgsl file by setting
up the variable LD_LIBRARY_PATH=/path/to/the/dir . Setting this variable
permanently like this is not advisable because it can mess qith other
commands.
2) Setting the non-standard lib directory of installation on the file
/etc/ld.so.conf.d/ or equivalent in your distro and then updating the
loader (ld.so. something)
3) By recompiling and adding the flag
-Wl,-rpath=/path/to/the/dir/containingthelib
I recommend option 3) Check the syntax, I am not completely sure.
Hope this helps.
On Mon, Jan 1, 2018 at 12:06 PM, amin izadi <address@hidden> wrote:
> thank you for your patience and replying me.
> 1- I changed the int main(void) to int main()
> 2 I compiled the code with "g++ bessel_func.cpp -o bessel_func -lgsl
> -lgslcblas"
> the code (bessel_func.cpp) was compiled truly.
> but when I run it by "./bessel_func"
> this error appears
> ./bessel_func: error while loading shared libraries: libgsl.so.23: cannot
> open shared object file: No such file or directory
> wha is wrong and how can I fix it?
> thanks in advance
> Bests
>
>
>
>
> On Mon, Jan 1, 2018 at 7:56 PM, William Oquendo <address@hidden>
> wrote:
>
>> Maybe try adding -lfttw
>> The readme files usually contain instructions regarding complain, and or
>> the tutorial.
>> I think you are confusing header files with the actual library files. The
>> headers, f files ended in .h, contain the declarations. The libraries, what
>> you link with -l, have the implementations.
>>
>> On Jan 1, 2018 10:51, "amin izadi" <address@hidden> wrote:
>>
>>> Hi.
>>> in fact, I have a little knowledge on C++ and linux.
>>> I did every thing to install the GSL.
>>> why do I have this problem?
>>> Is there any why to suppress these errors?
>>> I have another problems with FFTW
>>> I hope you can help me
>>> the procedure to install FFTW is the same with GSL
>>> but
>>> when I compile the cpp code related to FFT transform, none of the
>>> functions of the FFTW do not work, but the compiler knows the FFTW3.h
>>> these errors appear when I comple the FFTW_code.cpp which is my code
>>>
>>> g++ FFTW_code.cpp -o FFTW_code
>>> /tmp/cc5LJUln.o: In function `main':
>>> FFTW_code.cpp:(.text+0xbd): undefined reference to `fftw_plan_dft_1d'
>>> FFTW_code.cpp:(.text+0xd3): undefined reference to `fftw_execute'
>>> FFTW_code.cpp:(.text+0x159): undefined reference to `fftw_destroy_plan'
>>> FFTW_code.cpp:(.text+0x189): undefined reference to `fftw_plan_dft_1d'
>>> FFTW_code.cpp:(.text+0x19f): undefined reference to `fftw_execute'
>>> FFTW_code.cpp:(.text+0x305): undefined reference to `fftw_destroy_plan'
>>> FFTW_code.cpp:(.text+0x30a): undefined reference to `fftw_cleanup'
>>> collect2: error: ld returned 1 exit status
>>> <builtin>: recipe for target 'FFTW_code' failed
>>> make: *** [FFTW_code] Error 1
>>> -----------------------------------------------------
>>>
>>> fftw3.f, fftw3.f03,fftw3.h,fftw3l.f03,fftw3q.f03 exist in /usr/local/include
>>>
>>> do you know how can I fix my errors?
>>>
>>> thank you
>>>
>>>
>>>
>>> On Mon, Jan 1, 2018 at 7:03 PM, amin izadi <address@hidden> wrote:
>>>
>>>> Hi, thank you for your prompt answer
>>>> For example , should I use this command, if my c++ code has a1.cpp name?
>>>> g++ a1.cpp -lgsl
>>>> or something else?
>>>> thank you
>>>>
>>>> On 1 Jan 2018 18:56, "William Oquendo" <address@hidden> wrote:
>>>>
>>>>> Hi, that is a linker problem. You need to link with the gsl library.
>>>>> Add the following flag to your compilation command
>>>>> -lgsl
>>>>> sometimes I also need to add
>>>>> -lgslcblas
>>>>>
>>>>> On Mon, Jan 1, 2018 at 10:06 AM, amin izadi <address@hidden>
>>>>> wrote:
>>>>>
>>>>>> Hello
>>>>>> I want to use GSL for my project.
>>>>>> I downloaded the version 2.4 from your site and use these commands
>>>>>> according to install file
>>>>>> sudo su
>>>>>> ./configure
>>>>>> make
>>>>>> make check
>>>>>> make install
>>>>>> ----------------------------------------------------------
>>>>>> the file gsl exists in "/usr/local/include" .
>>>>>> ----------------------------------------------------------
>>>>>> but when I want to compile this code by "make":
>>>>>> #include <stdio.h>
>>>>>> #include <gsl/gsl_sf_bessel.h>
>>>>>> int
>>>>>> main (void)
>>>>>> {
>>>>>> double x = 5.0;
>>>>>> double y = gsl_sf_bessel_J0 (x);
>>>>>> printf ("J0(%g) = %.18e\n", x, y);
>>>>>> return 0;
>>>>>> }
>>>>>> this message appears :
>>>>>> g++ bessel_func.cpp -o bessel_func
>>>>>> /tmp/ccZymBuK.o: In function `main':
>>>>>> bessel_func.cpp:(.text+0x23): undefined reference to
>>>>>> `gsl_sf_bessel_J0'
>>>>>> collect2: error: ld returned 1 exit status
>>>>>> <builtin>: recipe for target 'bessel_func' failed
>>>>>> make: *** [bessel_func] Error 1
>>>>>>
>>>>>> ------------------------------------------------------------
>>>>>> ----------------------
>>>>>> I use ubuntu 16.0.4 64 bit and g++
>>>>>>
>>>>>> I hope you have enough time to answer me.
>>>>>> Thanks in advance.
>>>>>> Best regards.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>> Best regards / Cordialmente,
>>>>>
>>>>> William-Fernando Oquendo
>>>>> --------------------------
>>>>> Este correo puede carecer de tildes o eñes debido al teclado.
>>>>>
>>>>>
>>>
>
--
Best regards / Cordialmente,
William-Fernando Oquendo
--------------------------
Este correo puede carecer de tildes o eñes debido al teclado.