Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

/usr/bin/ld: cannot find -lm

1,745 views
Skip to first unread message

3pi

unread,
Jun 29, 2005, 7:46:21 AM6/29/05
to
Hello,

Can anyone give some advice for the compiling (or is linking?) error
reported below?

---------------------------------------------------------------------------
gcc -g -o primer3_core primer3_main.o primer3.o oligotm.o dpal_primer.o
format_output.o boulder_input.o '-static' -lm

/usr/bin/ld: cannot find -lm
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
collect2: ld returned 1 exit status
make: *** [primer3_core] Error 1
---------------------------------------------------------------------------

I'm trying to compile primer3 on a mdk10 distro, with:

#gcc --ver
Reading specs from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.1/specs
Configured with: ../configure --prefix=/usr --libdir=/usr/lib
--with-slibdir=/lib --mandir=/usr/share/man --infodir=/usr/share/info
--enable-shared --enable-threads=posix --disable-checking
--enable-long-long --enable-__cxa_atexit --enable-clocale=gnu
--disable-libunwind-exceptions
--enable-languages=c,c++,ada,f77,objc,java
--host=i586-mandrake-linux-gnu --with-system-zlib
Thread model: posix
gcc version 3.4.1 (Mandrakelinux (Alpha 3.4.1-3mdk)

#ld -v
GNU ld version 2.15.90.0.3 20040415

(dont know if I'd have reported some other infos..)


and the Makefile is:

[..]
LDLIBS = -lm
^^^^^^^^^^^^
CC = gcc
O_OPTS = -O2
WHITEHEAD_SPECIFIC_HACK = -include /usr/include/sys/types.h
CC_OPTS = -g -Wall -D__USE_FIXED_PROTOTYPES__
$(WHITEHEAD_SPECIFIC_HACK)
P_DEFINES = -DDPAL_MAX_ALIGN=$(MAX_PRIMER_LENGTH)
-DMAX_PRIMER_LENGTH=$(MAX_PRIMER_LENGTH)

CFLAGS = $(CC_OPTS) $(O_OPTS)
LDFLAGS = -g
LIBOPTS ='-static'
PRIMER_EXE = primer3_core

PRIMER_OBJECTS=primer3_main.o\
primer3.o\
oligotm.o\
dpal_primer.o\
format_output.o\
boulder_input.o

EXES=$(PRIMER_EXE) ntdpal oligotm long_seq_tm_test

all: $(PRIMER_EXE)

clean:
-rm *.o $(EXES) *~

$(PRIMER_EXE): $(PRIMER_OBJECTS)
$(CC) $(LDFLAGS) -o $@ $(PRIMER_OBJECTS) $(LIBOPTS) $(LDLIBS)
^^^^^^^^^^
[..]

I checked the man pages for gcc and info pages for ld but I couldn't
find
any hint about that '-lm' that (I guess) is rising the error...

any help will be welcome!
Thanks in advance and sorry if the question should be stupid.

Patrick.

Rolf Magnus

unread,
Jun 29, 2005, 8:12:36 AM6/29/05
to
3pi wrote:

> Hello,
>
> Can anyone give some advice for the compiling (or is linking?) error
> reported below?
>
>
---------------------------------------------------------------------------
> gcc -g -o primer3_core primer3_main.o primer3.o oligotm.o dpal_primer.o
> format_output.o boulder_input.o '-static' -lm
>
> /usr/bin/ld: cannot find -lm
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> collect2: ld returned 1 exit status
> make: *** [primer3_core] Error 1

Maybe you don't have the static version of libm installed?

Message has been deleted

Patrick

unread,
Jun 29, 2005, 8:42:10 AM6/29/05
to
Checking in /lib I found libm-2.3.3.so and libm.so.6
that i guess are the dynamic version of libm...
So the point now is to find and install the static one (now
googleing...) libm.a.

Well, this is a big step forward! thanks alot,
patrick

Paul Pluzhnikov

unread,
Jun 29, 2005, 10:23:29 AM6/29/05
to
"Patrick" <patrick...@gmail.com> writes:

> So the point is to install the static one (now googleing...) libm.a !


>
> Well, this is a big step forward! thanks alot,
> patrick

Actually, it's a step backward. Static linking on Linux is extremely
bad idea(TM). Just search groups.google.com for "static linking
problem linux"

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.

Patrick

unread,
Jun 30, 2005, 5:06:55 AM6/30/05
to
:-) thanks for the advice
It was just a 'step forward' for my little knowledge of the subject.
Btw, at the end I couldn't manage to install libm.a .. (?!)
so I tried to change in the Makefile the LIBOPTS= '-static-' into
'-dynamic' and then
the compilation has completed without any other problems.
Thanks everybody.
Ciao,
Patrick.

0 new messages