Hi people!

I´m working in a code with a friend! Both employ Linux Platforms, but he works in Suse, and I´m working in Kubuntu.

Both distributions suppose to work with the GNU/Linux libraries.

We work the code on his machine with Suse. And runs perfectly well!

But in my Kubuntu´s machine doesn´t run well. At the beggining there was a lot of missing files, but we copy all from the include, lib, sys of his laptop, and then the compiler founds all the files. Create the executable both still can´t work. This is the problem. Then we try to configure in the machine the GSL, but doesn´t work neither. Here I put both problems!


Thanx for your help

agbrose@eidosX:~/Paul$ gcc ssp-N.c -o ssp-N -lm -lgsl -lgslcblas
/usr/bin/ld: cannot find -lm
collect2: ld returned 1 exit status
agbrose@eidosX:~/Paul$ ls
gsl gsl-1.9 HHS_es2_Windows_y_Linux.pdf Linux.pdf ssp-N.c ssp-N.c~
agbrose@eidosX:~/Paul$ cd gsl-1.9/
agbrose@eidosX:~/Paul/gsl-1.9$ ls
acconfig.h cdf configure.ac fft gsl_nan.h histo
aclocal.m4 ChangeLog const fit gsl.pc.in ieee-
AUTHORS cheb COPYING gsl gsl_pow_int.h INSTA
autogen.sh combination deriv gsl-config.in gsl_precision.h insta
blas complex dht gsl-histogram.c gsl-randist.c integ
block config.guess diff gsl.m4 gsl.spec.in inter
bspline config.h.in doc gsl_machine.h gsl_types.h linal
BUGS config.sub eigen gsl_math.h gsl_version.h ltmai
cblas configure err gsl_mode.h gsl_version.h.in Makef
agbrose@eidosX:~/Paul/gsl-1.9$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether make sets $(MAKE)... (cached) yes
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for gcc... gcc
checking for C compiler default output file name... configure: error: C compiler
See `config.log' for more details.

Have you done an 'apt-get install build-essential' on your Kubuntu machine?

commented: Great help +1

Sorry I´m sort of newbie in Linux!! Can you explain more that 'apt-get install build-essential'

Thanx

Basically I'm asking if you have installed all the needed libraries.

The easiest way to do this (for me) is to open up a konsole session, and just type sudo apt-get install build-essential . This installs all the critical libraries.

You can always just use 'Adept' or 'Add/Remove programs' from the K Menu,

If you have a look at the first line in the compiler output it says that it can't find 'lm'. This means it can't find a library needed to finish linking your code. This specific one is the (m)ath library.

Ok!!

I made this installation of the needed libraries! Now it looks it can understand the gsl references. Yesterday I already had this problem previous to the -lm problem! I copy the gsl files on the folder include. And that problem dissapear. Now it´s back! Could you explain a little in detail what the different lines in the quote means, so, I can understand better next time!

Thanx

/tmp/cc6OypKB.o: In function `main':
ssp-N.c:(.text+0x20): undefined reference to `gsl_rng_env_setup'
ssp-N.c:(.text+0x25): undefined reference to `gsl_rng_default'
ssp-N.c:(.text+0x2e): undefined reference to `gsl_rng_default_seed'
ssp-N.c:(.text+0x3d): undefined reference to `gsl_rng_alloc'
ssp-N.c:(.text+0xbd): undefined reference to `gsl_rng_free'
/tmp/cc6OypKB.o: In function `web_calc':
ssp-N.c:(.text+0x131): undefined reference to `gsl_matrix_calloc'
ssp-N.c:(.text+0x1d9): undefined reference to `gsl_matrix_set'
./tmp/cc6OypKB.o: ssp-N.c:(.text+0x1022): more undefined references to `gsl_vector_get' follow
/tmp/cc6OypKB.o: In function `dynamics':
ssp-N.c:(.text+0x1079): undefined reference to `gsl_vector_set'
ssp-N.c:(.text+0x109a): undefined reference to `gsl_vector_get'
ssp-N.c:(.text+0x1119): undefined reference to `gsl_matrix_get'
ssp-N.c:(.text+0x11d1): undefined reference to `gsl_matrix_free'
ssp-N.c: (.text+0x11fd): undefined reference to `gsl_vector_free'
collect2: ld returned 1 exit status

.
.
/tmp/cc6OypKB.o:ssp-N.c:(.text+0x1022): more undefined references to `gsl_vector_get' follow
/tmp/cc6OypKB.o: In function `dynamics':
ssp-N.c:(.text+0x1079): undefined reference to `gsl_vector_set'
ssp-N.c:(.text+0x1194): undefined reference to `gsl_vector_get' '
ssp-N.c:(.text+0x11dc): undefined reference to `gsl_matrix_free
ssp-N.c:(.text+0x11fd): undefined reference to `gsl_vector_free'
collect2: ld returned 1 exit status

Sorry for the :( this forum do that automatically and I don´t know how to prevent it

I'm assuming you are compiling a static binary. Did you use the -lgsl -lgslcblas -lm compiler arguments?

To prevent the smileys from taking over, try the - where syntax should be 'C'.

Where are your libraries? What commands did you use to compile/link the code?[code=syntax] - where syntax should be 'C'.

Where are your libraries? What commands did you use to compile/link the code?

I don´t know what means "a static binary"

I employing this command

gcc ssp-N.c -o ssp-N -lm -lgsl -lgslcblas

The libraries are located in /usr/lib

and the gsl libraries in /usr/include/gsl

The errors you have shown essentially means that in your code you are using keywords (functions/variables/etc) that have not been defined. These are clearly definitions from the GSL library (They all start with a nice 'gsl_' :) ), so you can see from this that the files that do contain the definitions/declarations are not read by the linker.

You need to find out why they are not getting linked/compiled.

Did you include the correct header files? Is the paths to your SGL library included in your paths? To make dead sure you can use the '-I' argument to pass the paths to the GSL libraries. If you haven't looked at it yet you really should have a look at the GSL manual.

To simplify, a static binary is a file that gets compiled with all the libraries included in the output file. This means that the resulting binary file (the excutable file) does not need additional libraries. In Linux this is usually done with a '-static' argument to gcc.

Thanx you!!

I solved the problem just installing Linux Suse instead of the Linux Kubuntu!!

How I close the post???

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.