public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Link error
@ 2002-10-17  8:11 HKOELMAN
  0 siblings, 0 replies; 22+ messages in thread
From: HKOELMAN @ 2002-10-17  8:11 UTC (permalink / raw)
  To: gcc-help

Hello,

I'm puzzled with the following link error.

I'm using gcc 3.0.1 on Solaris 8. The libcometpfas.so compiles with gcc
2.1.95 and refuses with gcc 3.0.1.

The message is :
----- start -----
bonobo> make -f test.mk
/usr/users/armili/testcomet/COMET_U_1002/S28T710/test/tst01
g++ -o /usr/users/armili/testcomet/COMET_U_1002/S28T710/test/tst01
/usr/users/armili/testcomet/COMET_U1002/S28T710/obj/tst01.
o -L/usr/users/armili/testcomet/COMET_U_1002/S28T710/lib -lcometpfas
-L/usr/users/armili/testcomet/COMET_U1002/CORATN/lib/S28T710 -lAtn
-L/u01/app/tuxedo/710/lib -ltux -lbuft  -lfml -lfml32
Undefined                       first referenced
 symbol                             in file
CCppsvcfrm::doSvcsCall(char*, context_t*, CParam_in&, CParam_out&,
ils_err_t*)/usr/users/armili/testcomet/COMET_U1002/S28T710/obj/tst01.o
ostream::operator<<(ostream &(*)(ostream
&))/usr/users/armili/testcomet/COMET_U_1002/S28T710/lib/libcometpfas.so
endl(ostream &)
/usr/users/armili/testcomet/COMET_U_1002/S28T710/lib/libcometpfas.so
CCppsvcfrm::CCppsvcfrm()
/usr/users/armili/testcomet/COMET_U_1002/S28T710/obj/tst01.o
cerr
/usr/users/armili/testcomet/COMET_U_1002/S28T710/lib/libcometpfas.so
CCppsvcfrm::~CCppsvcfrm()
/usr/users/armili/testcomet/COMET_U_1002/S28T710/obj/tst01.o
ostream::operator<<(char const *)
/usr/users/armili/testcomet/COMET_U_1002/S28T710/lib/libcometpfas.so
ld: fatal: Symbol referencing errors. No output written to
/usr/users/armili/testcomet/COMET_U_1002/S28T710/test/tst01
collect2: ld returned 1 exit status
*** Error code 1
make: Fatal error: Command failed for target
`/usr/users/armili/testcomet/COMET_U_1002/S28T710/test/tst01'
----- end -----

Any help is appreciated

Regards Herbert

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

* Re: Link error
       [not found] <AANLkTiniPnQ-ioijpQXhMC1ygSqNSZsEGW2O-OVS5Qa8@mail.gmail.com>
@ 2010-08-12 10:18 ` Andrew Haley
  0 siblings, 0 replies; 22+ messages in thread
From: Andrew Haley @ 2010-08-12 10:18 UTC (permalink / raw)
  To: gcc-help

On 08/09/2010 02:59 PM, Phung Nguyen wrote:
> Dear all,
> 
> I am trying to build cross compiler for xc16x. I built successfully
> binutils 2.18; gcc 4.0 and newlib 1.18. Everything is fine when
> compiling a simple C file without any library call. It is also fine
> when making a simple call to printf like printf("Hello world").
> However, i got error message from linker when call printf("i=%i",i);
> The error message is as follows
> 
> /home/guest/xc16x/lib/gcc/xc16x-elf/lib/xc16xl/libc.a(lib_a-sbrkr.o):
> In function _sbrk_r:
> /home/guest/newlib-1.18.0/newlib/libc/reent/sbrkr.c:60: undefined
> reference to __sbrk
> /home/guest/fromKpit/newlib-1.18.0/newlib/libc/reent/sbrkr.c:60:
> undefined reference to __sbrk
> ....
> 
> collect2: ld returned 1 exit status
> make: *** [bubble.out] Error 1
> 
> 
> Is there any idea how to solve the problem? I highly appreciate any help.

You have to provide sbrk.

See http://sca.uwaterloo.ca/coldfire/gcc-doc/docs/porting_3.html

Andrew.

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

* Re: link error
  2009-04-01 13:23 link error Duan Wang
@ 2009-04-01 13:42 ` Axel Freyn
  0 siblings, 0 replies; 22+ messages in thread
From: Axel Freyn @ 2009-04-01 13:42 UTC (permalink / raw)
  To: gcc-help

Hi Duan,

> Hi gcc experts,
Sorry, I'm not a gcc expert;-)
nevertheless:
>
> I try to compile a sample .c file that communicates with the GPIB  
> interface (see attached c file) by using
> GCC type of compilers, such as cygwin, Dev-Cpp, MinGW, and C-Free4. Then  
> I got the same sort
> of error messages - the low level drivers were not found, see the log below:
>
> gcc.exe "C:\Program Files\Agilent\IO Libraries  
> Suite\ProgrammingSamples\C\VISA\idn.c" -o "C:\Program Files\Agilent\IO  
> Libraries Suite\ProgrammingSamples\C\VISA\idn.exe"   -ansi   
> -I"C:\Program Files\VXIPNP\WINNT\include"   -L"C:\Program  
> Files\VXIPNP\WINNT\lib\msc"
> C:\DOCUME~1\duanwang\LOCALS~1\Temp/ccOycaaa.o(.text+0x59):idn.c:  
> undefined reference to `viOpenDefaultRM@4'
> C:\DOCUME~1\duanwang\LOCALS~1\Temp/ccOycaaa.o(.text+0x86):idn.c:  
> undefined reference to `viOpen@20'
> C:\DOCUME~1\duanwang\LOCALS~1\Temp/ccOycaaa.o(.text+0x9c):idn.c:  
> undefined reference to `viPrintf'
> C:\DOCUME~1\duanwang\LOCALS~1\Temp/ccOycaaa.o(.text+0xb9):idn.c:  
> undefined reference to `viScanf'
> C:\DOCUME~1\duanwang\LOCALS~1\Temp/ccOycaaa.o(.text+0xda):idn.c:  
> undefined reference to `viClose@4'
> C:\DOCUME~1\duanwang\LOCALS~1\Temp/ccOycaaa.o(.text+0xe8):idn.c:  
> undefined reference to `viClose@4'
> collect2: ld returned 1 exit status
The linker complains, that in the files you are linken, the functions
viPrintf,... are used but never defined. 
> The low level drivers, such as viPrintf and viScanf  are in the file of  
> visa32.lib that is seated in the directory of ...\lib\msc.
The Problem is: You have to tell the compiler to use the file
visa32.lib!
Try the additional parameter "-lvisa32" (telling gcc to link to a
library "visa32" - gcc will search in the Library-Directory which you
already specified). However, never having used gcc in Windows, I'm not
sure wheter gcc will recognize visa32.lib, when you link to visa32.

If not, try to give the complete Path to visa32.lib:
gcc.exe "C:\Program Files\Agilent\IO Libraries Suite\ProgrammingSamples\C\VISA\idn.c" -o "C:\Program Files\Agilent\IO Libraries Suite\ProgrammingSamples\C\VISA\idn.exe"   -ansi -I"C:\Program Files\VXIPNP\WINNT\include"   C:\Program Files\VXIPNP\WINNT\lib\msc\visa32.lib

Then, gcc will pass visa32.lib to the linker and your errors should
disappear


HTH,

Axel

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

* link error
@ 2009-04-01 13:23 Duan Wang
  2009-04-01 13:42 ` Axel Freyn
  0 siblings, 1 reply; 22+ messages in thread
From: Duan Wang @ 2009-04-01 13:23 UTC (permalink / raw)
  To: gcc-help; +Cc: Duan Wang

[-- Attachment #1: Type: text/plain, Size: 1731 bytes --]

Hi gcc experts,

I try to compile a sample .c file that communicates with the GPIB 
interface (see attached c file) by using
GCC type of compilers, such as cygwin, Dev-Cpp, MinGW, and C-Free4. Then 
I got the same sort
of error messages - the low level drivers were not found, see the log below:

gcc.exe "C:\Program Files\Agilent\IO Libraries 
Suite\ProgrammingSamples\C\VISA\idn.c" -o "C:\Program Files\Agilent\IO 
Libraries Suite\ProgrammingSamples\C\VISA\idn.exe"   -ansi  
-I"C:\Program Files\VXIPNP\WINNT\include"   -L"C:\Program 
Files\VXIPNP\WINNT\lib\msc"
C:\DOCUME~1\duanwang\LOCALS~1\Temp/ccOycaaa.o(.text+0x59):idn.c: 
undefined reference to `viOpenDefaultRM@4'
C:\DOCUME~1\duanwang\LOCALS~1\Temp/ccOycaaa.o(.text+0x86):idn.c: 
undefined reference to `viOpen@20'
C:\DOCUME~1\duanwang\LOCALS~1\Temp/ccOycaaa.o(.text+0x9c):idn.c: 
undefined reference to `viPrintf'
C:\DOCUME~1\duanwang\LOCALS~1\Temp/ccOycaaa.o(.text+0xb9):idn.c: 
undefined reference to `viScanf'
C:\DOCUME~1\duanwang\LOCALS~1\Temp/ccOycaaa.o(.text+0xda):idn.c: 
undefined reference to `viClose@4'
C:\DOCUME~1\duanwang\LOCALS~1\Temp/ccOycaaa.o(.text+0xe8):idn.c: 
undefined reference to `viClose@4'
collect2: ld returned 1 exit status

The low level drivers, such as viPrintf and viScanf  are in the file of 
visa32.lib that is seated in the directory of ...\lib\msc.
I mean the drivers are sit there but he compiler complains that the 
drivers were not found. And the same error happens
either in windows application or in DOS window. Is there something 
wrong? Please advise. What I expect is to produce
an .exe file that will talk to the instrument that is connected with the 
pc with a GPIB interface.

Thanks,

Duan Wang
Alcatel-Lucent
978-952-7057

[-- Attachment #2: idn.c --]
[-- Type: text/plain, Size: 731 bytes --]

/*idn.c
  This example program queries a GPIB device for an identification string 
  and prints the results. Note that you must change the address. */

#include <visa.h>
#include <stdio.h>

int main () {

  ViSession defaultRM, vi;
  char buf [256] = {0};
  

  /* Open session to GPIB device at address 3 */
  viOpenDefaultRM (&defaultRM);
  viOpen (defaultRM, "GPIB1::3::INSTR", VI_NULL,VI_NULL, &vi);

  /* Initialize device */
  /*viPrintf (vi, "*RST\n");*/

  /* Send an *IDN? string to the device */
  viPrintf (vi, "*IDN?\n");
  
  /* Read results */
  viScanf (vi, "%t", &buf);

  /* Print results */
  printf ("Instrument identification string: %s\n", buf);

  /* Close session */
  viClose (vi);
  viClose (defaultRM);
}

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

* Link error
@ 2008-08-15 20:39 Vardhan, Sundara (GE Infra, Energy)
  0 siblings, 0 replies; 22+ messages in thread
From: Vardhan, Sundara (GE Infra, Energy) @ 2008-08-15 20:39 UTC (permalink / raw)
  To: gcc-help

Hi All
 
I compiled successully gcc 4.2.3 version on AIX 5.3. Using g++ and AIX ld, I get the following error :
 
ld: 0711-562 SEVERE ERROR: Symbol table entry 734 in object sample.a
An auxiliary symbol table entry is required for a C_EXT or C_HIDEXT entry.

Any ideas what this is and how this can be fixed? I would very much appreciate your inputs and advice.
 
With Regards
 
Vardhan

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

* RE: Link error
  2008-07-29 11:49             ` Andrew Haley
@ 2008-07-29 13:43               ` Vardhan, Sundara (GE Infra, Energy)
  0 siblings, 0 replies; 22+ messages in thread
From: Vardhan, Sundara (GE Infra, Energy) @ 2008-07-29 13:43 UTC (permalink / raw)
  To: Andrew Haley, Ralf Wildenhues; +Cc: gcc-help

Hi All

Fixed the below when I used the AIX ld instead of the GNU ld. 

>>> /lib/libc.a(moveeq.o):moveeq.s:(.pr+0xc): undefined reference to
>>> `.___memmove'

With Regards

Vardhan

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

* Re: Link error
  2008-07-29  8:56           ` Ralf Wildenhues
@ 2008-07-29 11:49             ` Andrew Haley
  2008-07-29 13:43               ` Vardhan, Sundara (GE Infra, Energy)
  0 siblings, 1 reply; 22+ messages in thread
From: Andrew Haley @ 2008-07-29 11:49 UTC (permalink / raw)
  To: Ralf Wildenhues; +Cc: gcc-help

Ralf Wildenhues wrote:
> Andrew Haley <aph <at> redhat.com> writes:
>> Vardhan, Sundara (GE Infra, Energy) wrote:
>>> /lib/libc.a(moveeq.o):moveeq.s:(.pr+0xc): undefined reference to
>>> `.___memmove'
>> Ouch.  You're linking statically against libc.  I don't know what's
>> causing this, but I suspect it's a Bad Thing.
> 
> /lib/libc.a typically is/contains a shared object on AIX.
> Yes, AIX is confusing.

heh.  :-)

Andrew.

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

* Re: Link error
  2008-07-28 13:26         ` Andrew Haley
@ 2008-07-29  8:56           ` Ralf Wildenhues
  2008-07-29 11:49             ` Andrew Haley
  0 siblings, 1 reply; 22+ messages in thread
From: Ralf Wildenhues @ 2008-07-29  8:56 UTC (permalink / raw)
  To: gcc-help

Andrew Haley <aph <at> redhat.com> writes:
> Vardhan, Sundara (GE Infra, Energy) wrote:
> > /lib/libc.a(moveeq.o):moveeq.s:(.pr+0xc): undefined reference to
> > `.___memmove'
> 
> Ouch.  You're linking statically against libc.  I don't know what's
> causing this, but I suspect it's a Bad Thing.

/lib/libc.a typically is/contains a shared object on AIX.
Yes, AIX is confusing.

Cheers,
Ralf

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

* Re: Link error
  2008-07-28 12:14       ` Vardhan, Sundara (GE Infra, Energy)
@ 2008-07-28 13:26         ` Andrew Haley
  2008-07-29  8:56           ` Ralf Wildenhues
  0 siblings, 1 reply; 22+ messages in thread
From: Andrew Haley @ 2008-07-28 13:26 UTC (permalink / raw)
  To: Vardhan, Sundara (GE Infra, Energy); +Cc: Rob Sherry, gcc-help

Vardhan, Sundara (GE Infra, Energy) wrote:
> Hi Andrew

Hi.  Could I please ask you to stop stop-posting?  It's
getting very confusing.

> I checked libc.a using nm and .__memmove is defined. The following is the compile/load line where it fails
> 
> gcc -W1,-soname=x.so -o x.so .*I6.o -shared   -Wall -D__USE_GNU -D_GNU_SOURCE -DDEBUG -DLEAVE_OUT_REV_ID -O2 -D_ALL_SOURCE -Drs6000  -D__EXTENSIONS__ -I/usr/openwin/include -DAIX53 -U__MATH__ -DAIX  -DRS6000 -fPIC -L<libpath> -lsbI6 -L<libpath> -ldbI6
> /lib/libc.a(moveeq.o):moveeq.s:(.pr+0xc): undefined reference to `.___memmove'
>

Ouch.  You're linking statically against libc.  I don't know what's
causing this, but I suspect it's a Bad Thing.

Andrew.

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

* RE: Link error
  2008-07-28 11:41     ` Andrew Haley
@ 2008-07-28 12:14       ` Vardhan, Sundara (GE Infra, Energy)
  2008-07-28 13:26         ` Andrew Haley
  0 siblings, 1 reply; 22+ messages in thread
From: Vardhan, Sundara (GE Infra, Energy) @ 2008-07-28 12:14 UTC (permalink / raw)
  To: Andrew Haley; +Cc: Rob Sherry, gcc-help

Hi Andrew

I checked libc.a using nm and .__memmove is defined. The following is the compile/load line where it fails

gcc -W1,-soname=x.so -o x.so .*I6.o -shared   -Wall -D__USE_GNU -D_GNU_SOURCE -DDEBUG -DLEAVE_OUT_REV_ID -O2 -D_ALL_SOURCE -Drs6000  -D__EXTENSIONS__ -I/usr/openwin/include -DAIX53 -U__MATH__ -DAIX  -DRS6000 -fPIC -L<libpath> -lsbI6 -L<libpath> -ldbI6
/lib/libc.a(moveeq.o):moveeq.s:(.pr+0xc): undefined reference to `.___memmove'

I think as you have suggested, I may have compiled and installed gcc incorrectly.

Hope this helps. Thanks much for your help.

With Regards

Vardhan

-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org]On
Behalf Of Andrew Haley
Sent: Monday, July 28, 2008 4:41 AM
To: Vardhan, Sundara (GE Infra, Energy)
Cc: Rob Sherry; gcc-help@gcc.gnu.org
Subject: Re: Link error


Vardhan, Sundara (GE Infra, Energy) wrote:

> AIX is 5.3, gcc is 4.2.3 and ld is 2.18. Yes I downloaded the source and compiled it locally on AIX
> 
> We have a product running successfully on Solaris and AIX for many years and we have recently
> decided to port to Linux. This was done successfully. Since we used gcc on Linux, we decided
> to go with gcc on all the OS platforms we support. Towards this goal, I downloaded gcc 4.2.3
> on AIX and Solaris. Compiled on AIX and installed it successfully. When I tried to use this gcc to
> compile the product code, the below error occurs only in couple of places.
> 
> What does this error mean?

`.___memmove' is missing.

> 
> Do you want me to send the compile/load line?

Yes.

> Thanks for your help.

You've probably incorrectly installed gcc.

Andrew.

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

* Re: Link error
  2008-07-25 13:32   ` Vardhan, Sundara (GE Infra, Energy)
@ 2008-07-28 11:41     ` Andrew Haley
  2008-07-28 12:14       ` Vardhan, Sundara (GE Infra, Energy)
  0 siblings, 1 reply; 22+ messages in thread
From: Andrew Haley @ 2008-07-28 11:41 UTC (permalink / raw)
  To: Vardhan, Sundara (GE Infra, Energy); +Cc: Rob Sherry, gcc-help

Vardhan, Sundara (GE Infra, Energy) wrote:

> AIX is 5.3, gcc is 4.2.3 and ld is 2.18. Yes I downloaded the source and compiled it locally on AIX
> 
> We have a product running successfully on Solaris and AIX for many years and we have recently
> decided to port to Linux. This was done successfully. Since we used gcc on Linux, we decided
> to go with gcc on all the OS platforms we support. Towards this goal, I downloaded gcc 4.2.3
> on AIX and Solaris. Compiled on AIX and installed it successfully. When I tried to use this gcc to
> compile the product code, the below error occurs only in couple of places.
> 
> What does this error mean?

`.___memmove' is missing.

> 
> Do you want me to send the compile/load line?

Yes.

> Thanks for your help.

You've probably incorrectly installed gcc.

Andrew.

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

* RE: Link error
  2008-07-24 23:55 ` Rob Sherry
@ 2008-07-25 13:32   ` Vardhan, Sundara (GE Infra, Energy)
  2008-07-28 11:41     ` Andrew Haley
  0 siblings, 1 reply; 22+ messages in thread
From: Vardhan, Sundara (GE Infra, Energy) @ 2008-07-25 13:32 UTC (permalink / raw)
  To: Rob Sherry, gcc-help

Hi 

AIX is 5.3, gcc is 4.2.3 and ld is 2.18. Yes I downloaded the source and compiled it locally on AIX

We have a product running successfully on Solaris and AIX for many years and we have recently decided to port to Linux. This was done successfully. Since we used gcc on Linux, we decided to go with gcc on all the OS platforms we support. Towards this goal, I downloaded gcc 4.2.3 on AIX and Solaris. Compiled on AIX and installed it successfully. When I tried to use this gcc to compile the product code, the below error occurs only in couple of places.

What does this error mean?

Do you want me to send the compile/load line?

Thanks for your help.

With Regards

Vardhan

-----Original Message-----
From: Rob Sherry [mailto:rsherry@ahfc.state.ak.us]
Sent: Thursday, July 24, 2008 5:03 PM
To: Vardhan, Sundara (GE Infra, Energy); gcc-help@gcc.gnu.org
Subject: RE: Link error


> Vardhan, Sundara (GE Infra, Energy) wrote:
>
> When I try to link in AIX using gcc/ and gnu ld, I get the following
> error

What versions of AIX, gcc, and ld are you using? Are you using the
IBM-compiled gcc, or a local build? Is whatever version of AIX you
have current? You might try checking with IBM support to see if
they have any outstanding issues with the version mix you're using
at your site.

What are you trying to compile? You mention things working on Linux,
so is this a homebuilt program, or a package you're porting? If it's
a package, does whatever documentation that came with it have any
references for AIX builds?

> The same make file works fine in Linux. Please help.

I doubt it's the makefile that's the problem...

BTW, I have gcc 4.1.0 running on AIX 5.3 and 6.1, and gcc 4.2.3 on 
6.1 and all work just fine for 99% of the pre-packaged things I've
found, and all of my custom apps (except for my own errors, of
course...). 

We're going to need a bit more information here.

Rob

Rob Sherry
System Administrator
Alaska Housing Finance Corporation
Anchorage, AK

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

* RE: Link error
  2008-07-24 21:03 Vardhan, Sundara (GE Infra, Energy)
@ 2008-07-24 23:55 ` Rob Sherry
  2008-07-25 13:32   ` Vardhan, Sundara (GE Infra, Energy)
  0 siblings, 1 reply; 22+ messages in thread
From: Rob Sherry @ 2008-07-24 23:55 UTC (permalink / raw)
  To: Vardhan, Sundara (GE Infra, Energy), gcc-help

> Vardhan, Sundara (GE Infra, Energy) wrote:
>
> When I try to link in AIX using gcc/ and gnu ld, I get the following
> error

What versions of AIX, gcc, and ld are you using? Are you using the
IBM-compiled gcc, or a local build? Is whatever version of AIX you
have current? You might try checking with IBM support to see if
they have any outstanding issues with the version mix you're using
at your site.

What are you trying to compile? You mention things working on Linux,
so is this a homebuilt program, or a package you're porting? If it's
a package, does whatever documentation that came with it have any
references for AIX builds?

> The same make file works fine in Linux. Please help.

I doubt it's the makefile that's the problem...

BTW, I have gcc 4.1.0 running on AIX 5.3 and 6.1, and gcc 4.2.3 on 
6.1 and all work just fine for 99% of the pre-packaged things I've
found, and all of my custom apps (except for my own errors, of
course...). 

We're going to need a bit more information here.

Rob

Rob Sherry
System Administrator
Alaska Housing Finance Corporation
Anchorage, AK

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

* Link error
@ 2008-07-24 21:03 Vardhan, Sundara (GE Infra, Energy)
  2008-07-24 23:55 ` Rob Sherry
  0 siblings, 1 reply; 22+ messages in thread
From: Vardhan, Sundara (GE Infra, Energy) @ 2008-07-24 21:03 UTC (permalink / raw)
  To: gcc-help

Hi All

When I try to link in AIX using gcc/ and gnu ld, I get the following error

/lib/libc.a(moveeq.o):moveeq.s:(.pr+0xc): undefined reference to `.___memmove'

The same make file works fine in Linux. Please help.

With Regards

Vardhan

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

* Link error
@ 2008-07-24 10:04 Vardhan, Sundara (GE Infra, Energy)
  0 siblings, 0 replies; 22+ messages in thread
From: Vardhan, Sundara (GE Infra, Energy) @ 2008-07-24 10:04 UTC (permalink / raw)
  To: gcc-help

Hi All

I am using gcc 4.2.3 on an AIX node. I get the following error on link time 

/lib/libc.a(moveeq.o):moveeq.s:(.pr+0xc): undefined reference to `.___memmove'

Any ideas what this may mean. I would very much appreciate your help and input. I will definitely try your inputs and will reply back as to what the results were.

Thanks in advance

With Regards

Vardhan

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

* Re: link error
  2005-10-21 20:22 link error Moon Hwang
@ 2005-10-21 23:08 ` Brian Dessent
  0 siblings, 0 replies; 22+ messages in thread
From: Brian Dessent @ 2005-10-21 23:08 UTC (permalink / raw)
  To: gcc-help

Moon Hwang wrote:

> I make my own library using this makefile.

You might consider using automake and libtool, which takes care of all
this for you.

> SONAME := lib$(TARGET)$(MODI).so

.so is not the universal extension for shared libraries.  Under windows
(and Cygwin) it's .dll, under darwin it's .dylib, and so on.  You really
shouldn't hardcode this information and expect to have a portable
makefile.

Under Cygwin the normal convention is that for a library named "foo" the
shared library is cygfoo.dll and the import libray is libfoo.dll.a.  If
it is a versioned library then it is cygfoo-n.dll and libfoo-n.dll.a.

> g++ -I /usr/X11R6/include -I ../../../Include -I
> /usr/local/include/boost_1_32_0 -L /usr/X11R6/lib -L
> /home/MHHwang/lib/Release Bomb.cpp -o Bomb  -lxyDEVS -lpthread
> 
> /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld:
> cannot find -lxyDEVS
> collect2: ld returned 1 exit status

Under Cygwin, when you specify -lxyDEVS, the linker will search for the
following filenames (in this order):

libxyDEVS.dll.a
xyDEVS.dll.a
libxyDEVS.a
cygxyDEVS.dll
libxyDEVS.dll
xyDEVS.dll

(As documented at
<http://sourceware.org/binutils/docs-2.16/ld/WIN32.html#WIN32>.)

So of course it errors because .so is not tne correct extension under
Cygwin.  You can still link against a .so file but you will probably
have to specify its full filename like with other link objects, as
opposed to -lfoo.

Brian

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

* link error
@ 2005-10-21 20:22 Moon Hwang
  2005-10-21 23:08 ` Brian Dessent
  0 siblings, 1 reply; 22+ messages in thread
From: Moon Hwang @ 2005-10-21 20:22 UTC (permalink / raw)
  To: gcc-help

I make my own library using this makefile.
===================================================================
TARGET := xyDEVS
CC := g++
CFLAGS := -c -fpermissive

######################################
# use following way:
#> make "CONFIG = Debug"
#or
#> make "CONFIG = Release"
######################################
ifeq (,$(findstring Debug,$(CONFIG)))
    CFLAGS += -fPIC -O2 -DNDEBUG
    MODI =
    CONFIG = Release
else
    CFLAGS += -fPIC -g -D_DEBUG
    MODI := D
    CONFIG = Debug
endif

SRCDIR := ./
SRC := $(wildcard Dv*.cpp)
SRC := $(notdir $(SRC))

OBJDIR := ../../../Linux/Object/$(CONFIG)
OBJ := $(SRC:%.cpp=$(OBJDIR)/%.o)

LIBDIR := $(HOME)/lib/$(CONFIG)
#LIBDIR := $(HOME)/lib
SONAME := lib$(TARGET)$(MODI).so
LIB := $(LIBDIR)/$(SONAME).1.0.1
LIBSONAME := $(LIBDIR)/$(SONAME)

#INC := $(wildcard Dv*.h) $(wildcard Dv*.inl) $(wildcard Dv*.pkg)\
#       $(wildcard Dv*.mcr)
#INC := $(notdir $(INC))

BOOST = /usr/local/include/boost_1_32_0
INCDIR := ../../Include

SDKDEL := $(INC:%=$(INCDIR)/%)

$(TARGET) : $(OBJ)
	@mkdir -p $(INCDIR)
	@mkdir -p $(OBJDIR)
	@mkdir -p $(LIBDIR)
	$(CC) -shared -Wl,-soname,$(SONAME) -o $(LIB) $(OBJ) -lc
	@ln -s $(LIB) $(LIBSONAME)

clean :
	rm -f $(LIB)
	rm -f $(LIBSONAME)
	rm -f $(OBJ)
	rm -f $(SDKDEL)


$(OBJDIR)/%.o : %.cpp
	@mkdir -p $(OBJDIR)
	$(CC) -I$(INCDIR) -I$(BOOST) $(CFLAGS) $< -o $@

================================================= End of Makefile

So the library looks be created as follows
================================================================
total 900
drwxr-xr-x+ 2 MHHwang None      0 Oct 21 13:04 .
drwxr-xr-x+ 4 MHHwang None      0 Oct 21 13:08 ..
lrwxrwxrwx  1 MHHwang None     44 Oct 21 13:04 libxyDEVS.so ->
/home/MHHwang/lib/Release/libxyDEVS.so.1.0.1
-rwxr-xr-x  1 MHHwang None 867547 Oct 21 13:04 libxyDEVS.so.1.0.1
====================================================End of List
But I cannot use the library when I use this make file

 And I try make an application using xyDEVS library. I uses following makefile
============================================================
#####################################################################
# .bash_profile should contains
# LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/lib/Release:$HOME/lib/Debug
# export LD_LIBRARY_PATH
#####################################################################
# use following way:
#> make "CONFIG = Debug"
#or
#> make "CONFIG = Release"
#####################################################################

.SUFFIXES : .cpp .o

TARGET := Bomb
CC := g++

ifeq (,$(findstring Debug,$(CONFIG)))
    CFLAGS := -c -O2 -DNDEBUG
    MODI =
    CONFIG = Release
else
    CFLAGS := -c -g -D_DEBUG
    MODI = D
    CONFIG = Debug
endif


LIBDIR := -L /usr/X11R6/lib -L ${HOME}/lib/$(CONFIG)
INCDIR := -I /usr/X11R6/include -I ../../../Include -I
/usr/local/include/boost_1_32_0
LIBS := -lxyDEVS$(MODI) -lpthread

$(TARGET) : $(OBJECTS)
	$(CC) $(INCDIR) $(LIBDIR) $(TARGET).cpp -o $(TARGET) $(OBJECTS) $(LIBS)

#.cpp.o:
#	$(CC) $(CFLAGS) $(INCDIR) $< -o $@
clean:
	rm -rf $(OBJECTS) $(TARGET) core
====================================================== End of makefile

But I just get this error message
======================================================
g++ -I /usr/X11R6/include -I ../../../Include -I
/usr/local/include/boost_1_32_0 -L /usr/X11R6/lib -L
/home/MHHwang/lib/Release Bomb.cpp -o Bomb  -lxyDEVS -lpthread

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld:
cannot find -lxyDEVS
collect2: ld returned 1 exit status
make: *** [Bomb] Error 1
============================================== End of Error message

Why I got the error message when using gcc 3.4.4 but not using gcc 2.96 ?

Anybody?

MoonHo

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

* RE: Link Error
  2002-08-13  7:30   ` Tom Browder
@ 2002-08-13  7:59     ` Ish Rattan
  0 siblings, 0 replies; 22+ messages in thread
From: Ish Rattan @ 2002-08-13  7:59 UTC (permalink / raw)
  To: Tom Browder; +Cc: gcc-help

On Tue, 13 Aug 2002, Tom Browder wrote:

> Very helpful! Any way to tell what shared libs and how to correct it?
Install exactly the same gcc/g++ environment on both machines.
OR
Try static linking.

-ishwar

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

* RE: Link Error
  2002-08-13  7:16 ` Ish Rattan
@ 2002-08-13  7:30   ` Tom Browder
  2002-08-13  7:59     ` Ish Rattan
  0 siblings, 1 reply; 22+ messages in thread
From: Tom Browder @ 2002-08-13  7:30 UTC (permalink / raw)
  To: gcc-help



Tom Browder
> What is happening, please?
Shared libs.

Very helpful! Any way to tell what shared libs and how to correct it?
And what does the message about needing a version mean?

Thanks.

Tom Browder




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

* Re: Link Error
  2002-08-13  6:54 Link Error Tom Browder
@ 2002-08-13  7:16 ` Ish Rattan
  2002-08-13  7:30   ` Tom Browder
  0 siblings, 1 reply; 22+ messages in thread
From: Ish Rattan @ 2002-08-13  7:16 UTC (permalink / raw)
  To: gcc-help

On Tue, 13 Aug 2002, Tom Browder wrote:

> What is happening, please?
Shared libs.

-ishwar

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

* Link Error
@ 2002-08-13  6:54 Tom Browder
  2002-08-13  7:16 ` Ish Rattan
  0 siblings, 1 reply; 22+ messages in thread
From: Tom Browder @ 2002-08-13  6:54 UTC (permalink / raw)
  To: gcc-help

I compile a program on host A (Linux, i386) with g++-3.1.1.  I copy it
to machine B and attempt to execute it and get the following message:

makebar: /usr/local/lib/libstdc++.so.4: no version information available
required by makebar)

I recompile the same program on host B (Linux, i386) with g++-3.1.1 and
it works fine.

What is happening, please?

Thanks.

Tom Browder



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

* link error
@ 2001-06-05 14:22 Alex Fridman
  0 siblings, 0 replies; 22+ messages in thread
From: Alex Fridman @ 2001-06-05 14:22 UTC (permalink / raw)
  To: gcc-help

Hi,

I tried to build the gcc-2.95.2 using the --with-newlib option, because I
got the __eprintf unresolved external on trying to link the library with CC
that I previously build with gcc.

I read that if I rebuild my gcc with --with-newlib option that would
illuminate  __eprintf problem.

That's exactly what I did except I got the same unresolved external trying
to build gcc

Here is the error

../stage1/xgcc -B../stage1/ -B/usr/local/sparc-sun-solaris2.7/bin/ -DIN_GCC
-DHAIFA  -DSVR4  -O2 -g  -DHAVE_CONFIG_H  -o fini fini.o proj-h.o
Undefined                       first referenced
 symbol                             in file
__eprintf                           fini.o
ld: fatal: Symbol referencing errors. No output written to fini
collect2: ld returned 1 exit status
make[3]: *** [fini] Error 1
make[3]: Leaving directory
`/export/home/alex/download/gcc-2.95.2/objdir/gcc/f'
make[2]: *** [f771] Error 2
make[2]: Leaving directory
`/export/home/alex/download/gcc-2.95.2/objdir/gcc'
make[1]: *** [bootstrap] Error 2
make[1]: Leaving directory
`/export/home/alex/download/gcc-2.95.2/objdir/gcc'
make: *** [bootstrap] Error 2

Any suggestions? 


Thanks,
Alex Fridman
Automated Financial Systems
(212)771-1923 

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

end of thread, other threads:[~2010-08-12 10:18 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-17  8:11 Link error HKOELMAN
     [not found] <AANLkTiniPnQ-ioijpQXhMC1ygSqNSZsEGW2O-OVS5Qa8@mail.gmail.com>
2010-08-12 10:18 ` Andrew Haley
  -- strict thread matches above, loose matches on Subject: below --
2009-04-01 13:23 link error Duan Wang
2009-04-01 13:42 ` Axel Freyn
2008-08-15 20:39 Link error Vardhan, Sundara (GE Infra, Energy)
2008-07-24 21:03 Vardhan, Sundara (GE Infra, Energy)
2008-07-24 23:55 ` Rob Sherry
2008-07-25 13:32   ` Vardhan, Sundara (GE Infra, Energy)
2008-07-28 11:41     ` Andrew Haley
2008-07-28 12:14       ` Vardhan, Sundara (GE Infra, Energy)
2008-07-28 13:26         ` Andrew Haley
2008-07-29  8:56           ` Ralf Wildenhues
2008-07-29 11:49             ` Andrew Haley
2008-07-29 13:43               ` Vardhan, Sundara (GE Infra, Energy)
2008-07-24 10:04 Vardhan, Sundara (GE Infra, Energy)
2005-10-21 20:22 link error Moon Hwang
2005-10-21 23:08 ` Brian Dessent
2002-08-13  6:54 Link Error Tom Browder
2002-08-13  7:16 ` Ish Rattan
2002-08-13  7:30   ` Tom Browder
2002-08-13  7:59     ` Ish Rattan
2001-06-05 14:22 link error Alex Fridman

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).