0

I am building a program and am trying to build cmake files. I am using a conda environment where i have installed a new gcc and cmake since the system doesn't have it, but i get this error.

 /usr/bin/ld: skipping incompatible /lib/libpthread.so.0 when searching for /lib/libpthread.so.0 
 /usr/bin/ld: cannot find /lib/libpthread.so.0
 /usr/bin/ld: skipping incompatible /usr/lib/libpthread_nonshared.a when searching for/usr/lib/libpthread_nonshared.a
 /usr/bin/ld: cannot find /usr/lib/libpthread_nonshared.a 
 collect2: error: ld returned 1 exit status
sebis
  • 1
  • 1
  • 5
  • Can you tell about the target architecture? What is the output of command `file /lib/libpthread.so.0`? – u_Ltd. Dec 14 '20 at 17:37
  • it is x86_64 and the command says /lib/libpthread.so.0: symbolic link to `libpthread-2.17.so' – sebis Dec 14 '20 at 17:42
  • Then `file /lib/libpthread-2.17.so` ? – u_Ltd. Dec 14 '20 at 17:50
  • /lib/libpthread-2.17.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), BuildID[sha1]=bc21c03f20b151a923a3689400386ba342322857, for GNU/Linux 2.6.32, not stripped – sebis Dec 14 '20 at 17:54
  • FYI the version of the library seems to be old, I've got libpthread-2.29. This is no problem. You can get lots of things working on old systems, but you are a bit on your own. Hopefully it will not be too frustrating. – u_Ltd. Dec 14 '20 at 18:29

1 Answers1

0

As found in comment-communication, the architecture of the compile target and the local libraries doesn't match.

Either

  • Install 64bit version (= architecture amd64 or x86_64) of libpthread

or

  • If it is installed (does /lib64/libpthread.so.0 exist?), then cmake does find the wrong library. There must be some setting somewhere for this

or

  • Set the cmake compile target to 32 bit (i368 / i586 / i686 EDIT: in gcc this goes with -m32) The program you produce will run on all x86 systems, so 32 bit and 64 bit ones [EDIT: if all libraries are present]! But you have a memory limit < 4GB.
u_Ltd.
  • 544
  • 1
  • 4
  • 9
  • yes /lib64/libpthread.so.0 does exist under /usr/local/lib64. Would export LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH help with that? I already tried but it didn't work. Do you know what changes could be done? – sebis Dec 14 '20 at 19:45
  • LD_LIBRARY_PATH is for runtime. You want to link it, so it must be found at link-time. cmake invokes gcc. If you are interested: [See how gcc is controlled](https://stackoverflow.com/questions/65141336/cross-compiling-c-application-library-referring-other-libraries-symbolically-lin/65281328#65281328). But it seems to me as if your cmake had the wrong path. I'm not an cmake expert, but I know there are useful tools, even GUI tools. Sometimes it helps to start with clean code, and `export LDFLAGS=-L/usr/local/lib64`, and then build, e. g. `automake`, `autoconf`, `./configure`, `make` or `cmake`. – u_Ltd. Dec 14 '20 at 23:15