Operating System - HP-UX
1753899 Members
7578 Online
108809 Solutions
New Discussion юеВ

Re: gcc Static Compilation ld: errors

 
SOLVED
Go to solution
Shamim1
Advisor

gcc Static Compilation ld: errors

I'm getting these errors

# make
No suffix list.
make all-recursive
No suffix list.
Making all in src
gcc -g -O2 -Wall -g -o syslog-ng main.o libsyslog-ng.a -static -lnsl -L/usr/local/lib -lglib-2.0 -lintl -liconv -L/usr/local/lib -levtlog
ld: Can't find library for -lglib-2.0
Fatal error.
collect2: ld returned 1 exit status
*** Error exit code 1

Stop.
*** Error exit code 1

Stop.
*** Error exit code 1

Stop.

Installed Software
----------------------------------
binutils 2.15a
bison 2.3 bison
byacc 20040328 byacc
bzip2 1.0.4 bzip2
flex 2.5.4a flex
gawk 3.1.5 gawk
gettext 0.16 gettext
glib 1.2.10 glib
glib2 2.12.9 glib2
libgcc 4.2.1 libgcc
libiconv 1.11 libiconv
libpcap 0.9.5 libpcap
libtool 1.5.22 libtool
pkgconfig 0.21 pkgconfig

gcc path is as below:
# whereis gcc
gcc: /usr/local/lib/gcc /opt/hp-gcc64-4.1.2/bin/gcc /opt/hp-gcc64/bin/gcc /opt/hp-gcc64-4.1.2/man/man1/gcc.1 /opt/hp-gcc64/man/man1/gcc.1
#


System infor is as
------------------------------------------

System Hardware

Model: 9000/785/B2000
Main Memory: 512 MB
Processors: 1
OS mode: 64 bit
LAN hardware ID: 0x001083CF287A
Software ID: 2010978044
Keyboard Language: USB_PS2_DIN_US_English

****************************************************



Please help me how to solve this problem
11 REPLIES 11
Steven Schweda
Honored Contributor

Re: gcc Static Compilation ld: errors

> I'm getting these errors

What were you doing when you got them?
(Hint: "make" is not a sufficiently detailed
description.)

> ld: Can't find library for -lglib-2.0

Where is your "libglib-2.0.*"? Is it in "/usr/local/lib"?
A. Clay Stephenson
Acclaimed Contributor

Re: gcc Static Compilation ld: errors

What is the output of "ls -l /usr/local/bin/libglib*" ?.

If it ain't broke, I can fix that.
Steven Schweda
Honored Contributor

Re: gcc Static Compilation ld: errors

> What is the output of "ls -l /usr/local/bin/libglib*" ?.

Or even "ls -l /usr/local/lib/libglib*"?
A. Clay Stephenson
Acclaimed Contributor

Re: gcc Static Compilation ld: errors

Ooops, I'm stupid. I meant "usr/local/lib/libglib*".

If it ain't broke, I can fix that.
Shamim1
Advisor

Re: gcc Static Compilation ld: errors

I'm trying to compile syslog_ng-2.0.2 with staic library linking.

the output of teh instructed command is as below:

# ls -la /usr/local/lib/libglib*
-rw-r--r-- 1 root sys 1044726 Feb 6 2007 /usr/local/lib/libglib-2.0.a
-rw-r--r-- 1 root sys 856 Feb 6 2007 /usr/local/lib/libglib-2.0.la
-r-xr-xr-x 1 root sys 1036288 Feb 6 2007 /usr/local/lib/libglib-2.0.sl
-rw-r--r-- 1 root sys 296556 Nov 27 2006 /usr/local/lib/libglib.a
-rw-r--r-- 1 root sys 666 Nov 27 2006 /usr/local/lib/libglib.la
-r-xr-xr-x 1 root sys 290816 Nov 27 2006 /usr/local/lib/libglib.sl
#
Regards
Shamim
Dennis Handly
Acclaimed Contributor

Re: gcc Static Compilation ld: errors

>I'm trying to compile syslog_ng-2.0.2 with static library linking.

Does it link if you remove -static?
I assume you aren't creating 64 bit executables?
(It seems you aren't using PA ld32.)

In fact, are you using a foreign devil linker? You must use HP's, which look like:
$ cc -Ae ~/hi.c -lxxxx
/usr/ccs/bin/ld: Can't find library: "xxxx"
$ cc -Ae ~/hi.c -lxxxx +DD64
ld: Can't find library or mismatched ABI for -lxxxx

What does file(1) show for:
$ file /usr/local/lib/libglib-2.0.a
$ file /usr/local/lib/libglib-2.0.sl

(These are the two files that ld(1) should find when using your -L and -lglib-2.0.)
Shamim1
Advisor

Re: gcc Static Compilation ld: errors

$ file /usr/local/lib/libglib-2.0.a
/usr/local/lib/libglib-2.0.a: archive file -PA-RISC2.0 relocatable library
$ file /usr/local/lib/libglib-2.0.sl
/usr/local/lib/libglib-2.0.sl: PA-RISC2.0 shared library -not stripped
$


I'm using gcc downloaded from HP-UX(DSPP) website
(http://h21007.www2.hp.com/portal/site/dspp/menuitem.863c3e4cbcdc3f3515b49c108973a801/?ciid=2a08725cc2f02110725cc2f02110275d6e10RCRD)

and it is available as

# whereis gcc
gcc: /usr/local/lib/gcc /opt/hp-gcc64-4.1.2/bin/gcc /opt/hp-gcc64/bin/gcc /opt/hp-gcc64-4.1.2/man/man1/gcc.1 /opt/hp-gcc64/man/man1/gcc.1
#

Dennis Handly
Acclaimed Contributor

Re: gcc Static Compilation ld: errors

>$ file /usr/local/lib/libglib-2.0.a
/usr/local/lib/libglib-2.0.a: archive file -PA-RISC2.0 relocatable library
$ file /usr/local/lib/libglib-2.0.sl
/usr/local/lib/libglib-2.0.sl: PA-RISC2.0 shared library -not stripped

These should work. But your gcc path has: hp-gcc64-4.1.2

This implies you are compiling for 64 bit and your libs aren't.
Do: file main.o
Shamim1
Advisor

Re: gcc Static Compilation ld: errors

Thanks for your patience
However

# file ./src/main.o
./src/main.o: ELF-64 relocatable object file - PA-RISC 2.0 (LP64)
#

I'm still unable to compile.

Regards
Shamim