unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* cmake build system 'ld: cannot find -lpthreads' (OpenClonk)
@ 2018-11-17 15:23 Tonton
  2018-11-17 15:43 ` Tonton
  0 siblings, 1 reply; 2+ messages in thread
From: Tonton @ 2018-11-17 15:23 UTC (permalink / raw)
  To: guix-devel@gnu.org

I've been trying to define and build openclonk, but I keep getting build
failures because pthreads are missing.

tl;dr: how to make pthreads work with cmake-build-system for linking...

I have grepped the guix sources for pthreads but I can't seem to find it
explicitly declared used. And AFAIK pthreads is part of gcc, stdc or glib or
something; I seem to remember only needing to tack on the -lpthreads flag on
the compiler when I was playing with it, no extra packages.

So I'm a bit at a loss. Maybe this is a quirk with cmake or how openclonk
uses cmake; though it seems they are doing the necessary steps in their
cmakelists.txt

The definition I'm working on can be found at the following link. I apologize
in advance for the cluttered file - it's basically my playroom (I have some
work in front of me to declutter and send patches with the definitions that
work from here - in the future).

https://notabug.org/thomassgn/guixsd-configuration/src/master/modules/ton-tull.scm#L571

The relevant errors I get here are:
/tmp/guix-build-openclonk-8.1.drv-0/build/CMakeFiles/CMakeError.log:

Linking C executable cmTC_e2823
/gnu/store/g85ikfjxs2d7aydvg5w06jn2h9xrjmpc-cmake-3.11.0/bin/cmake -E
	cmake_link_script CMakeFiles/cmTC_e2823.dir/link.txt --verbose=1 
/gnu/store/zrhwhlqqk51qslbddk4cip2z2p3fpvxd-gcc-5.5.0/bin/gcc
	-DCHECK_FUNCTION_EXISTS=pthread_create    -rdynamic
	CMakeFiles/cmTC_e2823.dir/CheckFunctionExists.c.o  -o cmTC_e2823
	-lpthreads
ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status

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

* Re: cmake build system 'ld: cannot find -lpthreads' (OpenClonk)
  2018-11-17 15:23 cmake build system 'ld: cannot find -lpthreads' (OpenClonk) Tonton
@ 2018-11-17 15:43 ` Tonton
  0 siblings, 0 replies; 2+ messages in thread
From: Tonton @ 2018-11-17 15:43 UTC (permalink / raw)
  To: guix-devel

On Sat, 17 Nov 2018 16:23:47 +0100
Tonton <tonton@riseup.net> wrote:

> The relevant errors I get here are:
> /tmp/guix-build-openclonk-8.1.drv-0/build/CMakeFiles/CMakeError.log:
> 
> Linking C executable cmTC_e2823
> /gnu/store/g85ikfjxs2d7aydvg5w06jn2h9xrjmpc-cmake-3.11.0/bin/cmake -E
> 	cmake_link_script CMakeFiles/cmTC_e2823.dir/link.txt --verbose=1 
> /gnu/store/zrhwhlqqk51qslbddk4cip2z2p3fpvxd-gcc-5.5.0/bin/gcc
> 	-DCHECK_FUNCTION_EXISTS=pthread_create    -rdynamic
> 	CMakeFiles/cmTC_e2823.dir/CheckFunctionExists.c.o  -o cmTC_e2823
> 	-lpthreads
> ld: cannot find -lpthreads
> collect2: error: ld returned 1 exit status
> 


I should add that cmake's configure and the compilation phase seems to find
pthreads. I looked through the log and found the following though:
/tmp/guix-build-openclonk-8.1.drv-0/build/CMakeFiles/CMakeOutput.log:

Determining if the function pthread_create exists in the pthread passed with
the following output:
Change Dir: /tmp/guix-build-openclonk-8.1.drv-0/build/CMakeFiles/CMakeTmp

Run Build
Command:"/gnu/store/nx21fqlb8jixwhbs83xlfp9a3h5p3g9a-make-4.2.1/bin/make"
	"cmTC_56777/fast"
/gnu/store/nx21fqlb8jixwhbs83xlfp9a3h5p3g9a-make-4.2.1/bin/make
	-f CMakeFiles/cmTC_56777.dir/build.make
	CMakeFiles/cmTC_56777.dir/build
make[1]: Entering directory
	'/tmp/guix-build-openclonk-8.1.drv-0/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_56777.dir/CheckFunctionExists.c.o
/gnu/store/zrhwhlqqk51qslbddk4cip2z2p3fpvxd-gcc-5.5.0/bin/gcc
	-DCHECK_FUNCTION_EXISTS=pthread_create   -o
	CMakeFiles/cmTC_56777.dir/CheckFunctionExists.c.o
	-c /gnu/store/g85ikfjxs2d7aydvg5w06jn2h9xrjmpc-cmake-3.11.0/share/cmake-3.11/Modules/CheckFunctionExists.c
Linking C executable cmTC_56777
/gnu/store/g85ikfjxs2d7aydvg5w06jn2h9xrjmpc-cmake-3.11.0/bin/cmake
	-E cmake_link_script CMakeFiles/cmTC_56777.dir/link.txt
	--verbose=1
/gnu/store/zrhwhlqqk51qslbddk4cip2z2p3fpvxd-gcc-5.5.0/bin/gcc
	-DCHECK_FUNCTION_EXISTS=pthread_create    -rdynamic
	CMakeFiles/cmTC_56777.dir/CheckFunctionExists.c.o  -o cmTC_56777
	-lpthread
make[1]: Leaving directory
	'/tmp/guix-build-openclonk-8.1.drv-0/build/CMakeFiles/CMakeTmp'

-----------------------------------------------------------------------------------------------------------

Does 'make[1]: ....' mean return status 1 - e.g. failed? I guess. If so why
does it succed compiling...

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

end of thread, other threads:[~2018-11-17 15:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-17 15:23 cmake build system 'ld: cannot find -lpthreads' (OpenClonk) Tonton
2018-11-17 15:43 ` Tonton

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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