pankaj kushwaha
pankaj kushwaha

Reputation: 379

ld: fatal: library -lm: not found in solaris 10

I am trying to compile a object file in SOLARIS 10 ,

g++ -g -fPIC -Wall -fno-builtin -fhuge-objects -Wl,-Bdynamic,-lposix4,-laio,-ldl,-lthread,-Bstatic filename.o -L. -L /directory1 -L /directory2 -ldirectory1 -ldirectory2 -o filename

it is giving following error:
ld: fatal: library -lm: not found
ld: fatal: library -lc: not found
ld: fatal: library -lc: not found

Now I am just surprised that I have not even included -lm and -lc in g++ command line compilation , then why it is reporting error like that and when I am giving same compilation in SOLARIS 8 , its working.Can anyone please clarify that why it is behaving like that?

I used following command to make filename.o:

g++ -I/direcroty_containing_header_file -c filename.cpp -o filename.o -g -fPIC -Wall -fno-builtin -fhuge-objects

Upvotes: 0

Views: 1593

Answers (2)

Andrew Henle
Andrew Henle

Reputation: 1

Solaris 10 does not have libc.a nor libm.a. Solaris 8 does.

You can not link to libc nor libm statically on Solaris 10.

Upvotes: 3

anonymous coward
anonymous coward

Reputation: 144

Libc and libm are standard C and math libraries, they are typically automatically linked to by g++ since they're so commonly used. Without knowing anything about your setup it's difficult to say why ld can't find them, likely the ones that exist are unused for some reason (different architecture, not in search path, etc).

Upvotes: -1

Related Questions