Author Topic: ld.exe cannot find /usr/lib/libc.so.3.5  (Read 19729 times)

Offline eb

  • Multiple posting newcomer
  • *
  • Posts: 46
ld.exe cannot find /usr/lib/libc.so.3.5
« on: January 31, 2012, 03:24:36 am »
I've found somewhat similar versions of this question but none of the answers seem to quite fit.

Build messages gives me these errors:
  ld.exe||cannot find /usr/lib/libc.so.3.5|
  ld.exe||cannot find /usr/lib/libcompat30.a|

However:
  Both files are located in C:\SFU\usr\lib
  C:\SFU\usr\lib\libcompat30.a is in my Link libraries list under Linker settings
  C:\SFU is in my list of Search directories for my Linker and my Resource compiler

Build log:

g++.exe -LC:\SFU  -o bin\Release\Rap00Unix.exe obj\Release\main.o   -s  C:\SFU\usr\lib\libcompat30.a C:\SFU\usr\lib\libc.so
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/ld.exe: cannot find /usr/lib/libc.so.3.5
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/ld.exe: cannot find /usr/lib/libcompat30.a
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 1 seconds)
2 errors, 7 warnings

What is ld.exe?
Where is it looking for libc.so.3.5 and libcompat30.a?
How do I tell it where to look?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: ld.exe cannot find /usr/lib/libc.so.3.5
« Reply #1 on: January 31, 2012, 07:30:14 am »
What is ld.exe?
Where is it looking for libc.so.3.5 and libcompat30.a?
How do I tell it where to look?
That's the linker.
You need to add the libraries "libcompat30" and "libc" to the linker options. Then point to "C:\SFU\usr\lib\" for the linker include directories. However, I'm afraid it will not work, because the library "libc.so" looks pretty much like a Linux library to me which you can't use on Windows. So you'll need to re-compile your "SFU" (Whatever that is) for Windows. BTW: Usually you also don't need to link against libc.
Consult the C::B manual for the compiler/linker settings dialogs (see my signature).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline eb

  • Multiple posting newcomer
  • *
  • Posts: 46
Re: ld.exe cannot find /usr/lib/libc.so.3.5
« Reply #2 on: January 31, 2012, 07:25:28 pm »
ld.exe is the linker? Ok, but according to my Toolchain executables list g++ is the linker for my dynamic libs and ar.exe ...
Also (libc.so, libc.so.3.5 and libcompat30.a) come with Microsoft Services for Unix.

libc.so and libcompat30.c are already in my Link libraries list under Linker settings.

I added C:\SFU\usr\lib\ to my Linker Search directories (C:\SFU was already there).

I Rebuild workspace and I still get the same exact error in my Build log.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: ld.exe cannot find /usr/lib/libc.so.3.5
« Reply #3 on: January 31, 2012, 08:11:08 pm »
I will repeat myself, mixing libraries from different compilers does NOT work some of the time.
It can work if all the libraries involved are C libraries; but what you are doing is NOT a Code::Blocks related problem.
But, a programming problem that is more correct on a programming help site.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: ld.exe cannot find /usr/lib/libc.so.3.5
« Reply #4 on: January 31, 2012, 08:11:52 pm »
ld.exe is the linker?
Yes, it's invoked by the g++/gcc application you setup for the linker.

What makes you believe that "Microsoft Services for Unix" will work on Windows?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: ld.exe cannot find /usr/lib/libc.so.3.5
« Reply #5 on: January 31, 2012, 08:15:14 pm »
Ok... according to this:

https://en.wikipedia.org/wiki/Microsoft_Windows_Services_for_UNIX

These tools / SDK's ship with an own compiler you have to use. Don't use any other compiler than the one provided by Microsoft. If you do, it will fail. Period. Interesting to see that I figured that out with one Google search... isn't it? >:(
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline eb

  • Multiple posting newcomer
  • *
  • Posts: 46
Re: ld.exe cannot find /usr/lib/libc.so.3.5
« Reply #6 on: January 31, 2012, 10:18:38 pm »
This is what I get for doing 3 things at the same time...

1. I've already been through the Wikipedia entry which was why I loaded it to begin with.  But as far as I can tell there is no compiler that came with it.  Or at least there is no cl.exe, gcc.exe or g++.exe.  There is a GCC3.3 folder but there is nothing that Code Blocks seems to recognize as a compiler. 
So if this means I can not configure Code Blocks with the proper Tool chain files (compiler, linker, debugger...) then I'll try using the supplied Cshell/Korn shell (UGH!)

2. If the libs were incompatible I would have thought that Code Blocks would have given me an error telling me the libs were incompatible and not that it could not find the libs.

3. Tim I heard you the first time about not mixing libs.  I'm using just the svc4unix libs on a 32 bit computer.  I'm trying to build the same project with cygwin libs on a 64 bit computer.  ANd I am building another computer to run Umbuntu to try this in native linux even though the CAD system this has to ultimately run under only works under windows.

All I want to know is why Code Blocks (ld.exe) can not find libcompat30.a.  Is it because libcompat30.a is not compatible with ld.exe?

Sorry for being so dense.  Did I mention I'n new at this?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: ld.exe cannot find /usr/lib/libc.so.3.5
« Reply #7 on: January 31, 2012, 10:38:47 pm »
All I want to know is why Code Blocks (ld.exe) can not find libcompat30.a.  Is it because libcompat30.a is not compatible with ld.exe?

Code::Blocks is neither a Compiler nor a Linker (ld.exe); you need to ask this question on a programming support site!
The people on this site does NOT have the time or likely even the Knowledge to help you on the way to mix binary objects that are NOT supposed to be mixed.


I suggest locking this thread for NOT being a Code::Blocks appropriate topic.


Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline eb

  • Multiple posting newcomer
  • *
  • Posts: 46
Re: ld.exe cannot find /usr/lib/libc.so.3.5
« Reply #8 on: January 31, 2012, 11:13:25 pm »
How is this NOT a CodeBlocks question?
I'm asking why CodeBlocks can not see a library (*.a) file.
I'm asking which of my CodeBlocks settings is wrong when according to everything I've read so far they are correct.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: ld.exe cannot find /usr/lib/libc.so.3.5
« Reply #9 on: January 31, 2012, 11:22:31 pm »
g++.exe -LC:\SFU  -o bin\Release\Rap00Unix.exe obj\Release\main.o   -s  C:\SFU\usr\lib\libcompat30.a C:\SFU\usr\lib\libc.so
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/ld.exe: cannot find /usr/lib/libc.so.3.5
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/ld.exe: cannot find /usr/lib/libcompat30.a
This all makes no sense. Most likely you have screwed the tool chain path. Here, a non-MinGW g++ executable is mixed with MinGW executables. Otherwise you would not see "cannot find /usr/lib/libc.so.3.5". Also, you need to point the linker to the folder where the libraries are in and not the base of your compiler installation.

I suggest you check you PATH environment that you don't have another compiler in the PATH and additionally check your compiler setup that you pick the right executables of one compiler distribution (that's wrong: "C:\SFU").

I strongly suggest you first try at the command line, learn how compiler/linker work and then start using an IDE. Otherwise you'll never learn how to fix such yourself. That's all I can say... seriously.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline eb

  • Multiple posting newcomer
  • *
  • Posts: 46
Re: ld.exe cannot find /usr/lib/libc.so.3.5
« Reply #10 on: January 31, 2012, 11:49:57 pm »
Quote
I strongly suggest you first try at the command line, learn how compiler/linker work and then start using an IDE. Otherwise you'll never learn how to fix such yourself. That's all I can say... seriously.
I believe you've hit the nail on the head.

The Mingw compiler seemed to be the most likely candidate for use with CodeBlocks. WRONG!
All 3 libraries came with services for windows.  After our last exchange I took a harder look at what came with it.  I now realize it came with 'executables' that don't end with .exe, so I have to compile (and probably run it) in a shell.  

And since the error message "cannot find /usr/lib/libcompat30.a" is apparently generated by ld.exe and just 'relayed' via CodeBlocks then I guess you are right, this isn't a CodeBlocks question after all.



« Last Edit: January 31, 2012, 11:52:59 pm by eb »

Offline Radek

  • Multiple posting newcomer
  • *
  • Posts: 104
Re: ld.exe cannot find /usr/lib/libc.so.3.5
« Reply #11 on: February 01, 2012, 08:39:00 am »
eb, Morten isn't wrong. There are many people around which are able to run CodeBlocks and gcc (that means mingw) from windows but I've never heard that they would use some "Microsoft tools" for it. The common experience is that all such "tools" are trying to convince you that the only right decision is abandoning everything that does not originate in Redmont. Among others, the compiler in "SFU" is awfully outdated (the current version of GCC is 4.6), the libraries seems to be outdated as well.

IMO, you'd better delete the "SFU" (I have checked the link posted by Morten) from your disk and take a "standard way" of installing CodeBlocks on windows. Well, I do not have even a single byte of windows on my computer so that I cannot do recomendations, but other people should be able. Therefore, if there are windows users around, please post your experience.

(1) How to install a compiler.
(2) How to install CodeBlocks.
(3) How to make all this work.

If your primary goal is emulating Linux on windows then do not use "SFU" again. Install VirtualBox instead and install your favorite flavor or Linux in it. You will solve no problems most likely.

Offline eb

  • Multiple posting newcomer
  • *
  • Posts: 46
Re: ld.exe cannot find /usr/lib/libc.so.3.5
« Reply #12 on: February 01, 2012, 07:13:02 pm »
I know Morten is right.  And except for the occasional glitch I've been able to run CodeBlocks with gcc and g++ just fine.  But now I have a project that deals with Remote Procedure Calls in which involves the clnt_create function and the only two libraries that I can find that DEFINE the function are included in Cygwin and Microsoft Services for Unix.  So in the process of trying to Frankenstein this all together I hit an error that I mistook for a CodeBlocks error.
So now I'm having to apologize all over the place and resign myself to C shell hell.

btw - thanks for the tip re: VirtualBox!

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: ld.exe cannot find /usr/lib/libc.so.3.5
« Reply #13 on: February 01, 2012, 08:05:53 pm »
involves the clnt_create function and the only two libraries that I can find that DEFINE the function are included in Cygwin and Microsoft Services for Unix.
...maybe this helps:
http://docs.oracle.com/cd/E19683-01/816-1435/advrpcpt-29368/index.html
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ