public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* RE: A simple problem regarding shared libs...
@ 2002-02-08 10:20 Venkatakrishnan, V
  0 siblings, 0 replies; 6+ messages in thread
From: Venkatakrishnan, V @ 2002-02-08 10:20 UTC (permalink / raw)
  To: 'John Love-Jensen', gcc-help

Hi Eljay,
	Hmmmm, I did echo $LD_LIBRARY_PATH and I didn't get anything (just
got my # prompt back) and then did set LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH,
did echo again and didn't get anything, could it mean that my variable is
not set?
	I tried gcc hello.o -L. -lshared -o Hello again after that but got
the same error message.

Regards,
Venky

-----Original Message-----
From: John Love-Jensen [mailto:eljay@adobe.com] 
Sent: Friday, February 08, 2002 12:49 PM
To: Venkatakrishnan, V; gcc-help@gcc.gnu.org
Subject: Re: A simple problem regarding shared libs...


Hi V,

Have you set your LD_LIBRARY_PATH?

LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH

Sincerely,
--Eljay



Hi,
	I've these two files.....

Hello.c
#include <stdio.h>
Extern const char* func();
Int main( void)
{
	printf("Hello World");
	func()
	return 1;
}

Shrobj.c
Const char* func(void)
{
	printf("Hello from shared lib");
}

	I do the following to create the obj files..
Gcc -c hello.c
Gcc -c shrobj.c
	and then to create the shared lib I do
Gcc shrobj.o -shared -o libshared.so
	this gives me the shared lib.

	Now I try to compile my program hello.o with this shared lib by
saying Gcc hello.o -L. -lshared -o Hello
	but this gives me an error saying.....
Ld: 0706-006 Cannot find or open library file: -l shared
	ld:open(): A file or directory in the path name does not exist.
Collect2: ld returned 255 exit status

	Why is this happening?  My shared lib. Is right there and I've also
given -L. to look for it in the current directory.
	Any help please.

Regards,

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: A simple problem regarding shared libs...
@ 2002-02-11  9:38 Venkatakrishnan, V
  0 siblings, 0 replies; 6+ messages in thread
From: Venkatakrishnan, V @ 2002-02-11  9:38 UTC (permalink / raw)
  To: 'Andrea 'Fyre Wyzard' Bocci', gcc-help

Hi Andrea,
	Thanks for the effort, but I still can't get it to work here.  It
seems that the linker goes looking only for .a files and doesn't even see
the .so in my directory.
I was Googling around regarding this and came across
http://oss.software.ibm.com/pipermail/icu/2001-November/004012.html, take a
look.
	I tried the -brtl switch but got a few more errors saying cannot
find libgcc.a.  I'm not too familiar with this switch or what it does, from
the way things are going it basically seems that my linker is only looking
for .a files and ignores .so (coz. I can get it to link using a static
library), is there a way I can tell it look for .so files as well??

Regards,
Venky

-----Original Message-----
From: Andrea 'Fyre Wyzard' Bocci [mailto:fwyzard@inwind.it] 
Sent: Friday, February 08, 2002 8:36 PM
To: Venkatakrishnan, V; gcc-help@gcc.gnu.org
Subject: Re: A simple problem regarding shared libs...


Hi

I've tried reproducing your problem, but on my machine everything went 
smoothly.
Also, I've not set LD_LIBRARY_PATH in any way. Just typed, and it worked !
(gcc 2.96 and gcc 3.0.2, binutils 2.11.90, linux 2.4.7, RedHat 7.2)

[fwyzard@stufis06 test]$ gcc sharobj.c -c -o sharobj.o [fwyzard@stufis06
test]$ gcc hello.c -c -o hello.o [fwyzard@stufis06 test]$ gcc sharobj.o
-shared -o libshared.so [fwyzard@stufis06 test]$ gcc hello.o -L. -lshared -o
hello [fwyzard@stufis06 test]$ ./hello Hello World Hello from shared lib

Here's the files I've used:
/* hello.c */
#include <stdio.h>

extern const char* func();
int main( void)
{
         printf("Hello World\n");
         func();
         return 1;
}
/* end of hello.c */

/* sharobj.c */
#include <stdio.h>

const char* func(void)
{
         printf("Hello from shared lib\n");
}
/* end of sharobj.c */

fwyzard

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: A simple problem regarding shared libs...
       [not found] <8229C4577A00D511ABC00090277A45A0ADBA0D@us0111-ch-ms1.chann els.mc.xerox.com>
@ 2002-02-08 18:49 ` Andrea 'Fyre Wyzard' Bocci
  0 siblings, 0 replies; 6+ messages in thread
From: Andrea 'Fyre Wyzard' Bocci @ 2002-02-08 18:49 UTC (permalink / raw)
  To: Venkatakrishnan, V, gcc-help

Hi

I've tried reproducing your problem, but on my machine everything went 
smoothly.
Also, I've not set LD_LIBRARY_PATH in any way. Just typed, and it worked !
(gcc 2.96 and gcc 3.0.2, binutils 2.11.90, linux 2.4.7, RedHat 7.2)

[fwyzard@stufis06 test]$ gcc sharobj.c -c -o sharobj.o
[fwyzard@stufis06 test]$ gcc hello.c -c -o hello.o
[fwyzard@stufis06 test]$ gcc sharobj.o -shared -o libshared.so
[fwyzard@stufis06 test]$ gcc hello.o -L. -lshared -o hello
[fwyzard@stufis06 test]$ ./hello
Hello World
Hello from shared lib

Here's the files I've used:
/* hello.c */
#include <stdio.h>

extern const char* func();
int main( void)
{
         printf("Hello World\n");
         func();
         return 1;
}
/* end of hello.c */

/* sharobj.c */
#include <stdio.h>

const char* func(void)
{
         printf("Hello from shared lib\n");
}
/* end of sharobj.c */

fwyzard

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: A simple problem regarding shared libs...
@ 2002-02-08 10:38 Venkatakrishnan, V
  0 siblings, 0 replies; 6+ messages in thread
From: Venkatakrishnan, V @ 2002-02-08 10:38 UTC (permalink / raw)
  To: 'John Love-Jensen', gcc-help

Hi,
	I created a static library file out of the same shrobj.o by saying
Ar rv libstatic.a shrobj.o
	and then linked that to my program saying
Gcc hello.o -L. -lstatic -o Hello
	and it worked.
	Looks like there's something fishy 'bout my LD_LIBRARY_PATH.  Any
idea anybody?

Regards,
Venky

-----Original Message-----
From: Venkatakrishnan, V [mailto:V.Venkatakrishnan@channels.usa.xerox.com] 
Sent: Friday, February 08, 2002 1:20 PM
To: 'John Love-Jensen'; gcc-help@gcc.gnu.org
Subject: RE: A simple problem regarding shared libs...


Hi Eljay,
	Hmmmm, I did echo $LD_LIBRARY_PATH and I didn't get anything (just
got my # prompt back) and then did set LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH,
did echo again and didn't get anything, could it mean that my variable is
not set?
	I tried gcc hello.o -L. -lshared -o Hello again after that but got
the same error message.

Regards,
Venky

-----Original Message-----
From: John Love-Jensen [mailto:eljay@adobe.com] 
Sent: Friday, February 08, 2002 12:49 PM
To: Venkatakrishnan, V; gcc-help@gcc.gnu.org
Subject: Re: A simple problem regarding shared libs...


Hi V,

Have you set your LD_LIBRARY_PATH?

LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH

Sincerely,
--Eljay



Hi,
	I've these two files.....

Hello.c
#include <stdio.h>
Extern const char* func();
Int main( void)
{
	printf("Hello World");
	func()
	return 1;
}

Shrobj.c
Const char* func(void)
{
	printf("Hello from shared lib");
}

	I do the following to create the obj files..
Gcc -c hello.c
Gcc -c shrobj.c
	and then to create the shared lib I do
Gcc shrobj.o -shared -o libshared.so
	this gives me the shared lib.

	Now I try to compile my program hello.o with this shared lib by
saying Gcc hello.o -L. -lshared -o Hello
	but this gives me an error saying.....
Ld: 0706-006 Cannot find or open library file: -l shared
	ld:open(): A file or directory in the path name does not exist.
Collect2: ld returned 255 exit status

	Why is this happening?  My shared lib. Is right there and I've also
given -L. to look for it in the current directory.
	Any help please.

Regards,

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: A simple problem regarding shared libs...
  2002-02-08  9:30 Venkatakrishnan, V
@ 2002-02-08  9:58 ` John Love-Jensen
  0 siblings, 0 replies; 6+ messages in thread
From: John Love-Jensen @ 2002-02-08  9:58 UTC (permalink / raw)
  To: Venkatakrishnan, V, gcc-help

Hi V,

Have you set your LD_LIBRARY_PATH?

LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH

Sincerely,
--Eljay


^ permalink raw reply	[flat|nested] 6+ messages in thread

* A simple problem regarding shared libs...
@ 2002-02-08  9:30 Venkatakrishnan, V
  2002-02-08  9:58 ` John Love-Jensen
  0 siblings, 1 reply; 6+ messages in thread
From: Venkatakrishnan, V @ 2002-02-08  9:30 UTC (permalink / raw)
  To: gcc-help

Hi,
	I've these two files.....

Hello.c
#include <stdio.h>
Extern const char* func();
Int main( void)
{
	printf("Hello World");
	func()
	return 1;
}

Shrobj.c
Const char* func(void)
{
	printf("Hello from shared lib");
}

	I do the following to create the obj files..
Gcc -c hello.c
Gcc -c shrobj.c
	and then to create the shared lib I do
Gcc shrobj.o -shared -o libshared.so
	this gives me the shared lib.

	Now I try to compile my program hello.o with this shared lib by
saying
Gcc hello.o -L. -lshared -o Hello
	but this gives me an error saying.....
Ld: 0706-006 Cannot find or open library file: -l shared
	ld:open(): A file or directory in the path name does not exist.
Collect2: ld returned 255 exit status

	Why is this happening?  My shared lib. Is right there and I've also
given -L. to look for it in the current directory.
	Any help please.

Regards,

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-02-11 17:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-08 10:20 A simple problem regarding shared libs Venkatakrishnan, V
  -- strict thread matches above, loose matches on Subject: below --
2002-02-11  9:38 Venkatakrishnan, V
     [not found] <8229C4577A00D511ABC00090277A45A0ADBA0D@us0111-ch-ms1.chann els.mc.xerox.com>
2002-02-08 18:49 ` Andrea 'Fyre Wyzard' Bocci
2002-02-08 10:38 Venkatakrishnan, V
2002-02-08  9:30 Venkatakrishnan, V
2002-02-08  9:58 ` John Love-Jensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).