Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 774105

Summary: app-shells/fish-3.2.0: configure fails with Could NOT find Threads (missing: Threads_FOUND)
Product: Gentoo Linux Reporter: Azat Bahawi <azahi>
Component: Current packagesAssignee: Georgy Yakovlev <gyakovlev>
Severity: normal CC: azahi, polynomial-c, sam
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Package list:
Runtime testing required: ---
Attachments: app-shells/fish-3.2.0 build log
emerge --info
ls -la {,/usr}/lib64/libpthread*
qlist glibc | grep pthread

Description Azat Bahawi 2021-03-03 20:37:49 UTC
Configure phase for app-shells/fish-3.2.0 fails with:

CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:218 (message):
  Could NOT find Threads (missing: Threads_FOUND)
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:582 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake/Modules/FindThreads.cmake:234 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  cmake/ConfigureChecks.cmake:63 (find_package)
  CMakeLists.txt:133 (include)

This also happens for the live ebuild as well.

Reproducible: Always

Steps to Reproduce:
1. `emerge \=app-shells/fish-3.2.0`
Actual Results:  
Emerge failed with a CMake error.

Expected Results:  
Emerge succeeded.
Comment 1 Azat Bahawi 2021-03-03 20:39:59 UTC
Created attachment 689241 [details]
app-shells/fish-3.2.0 build log
Comment 2 Azat Bahawi 2021-03-03 20:40:41 UTC
Created attachment 689244 [details]
emerge --info
Comment 3 Georgy Yakovlev gentoo-dev 2021-03-05 20:38:51 UTC
very standard cmake test fails, it's not some 3-rd party module.

> find_package(Threads REQUIRED)

can't reproduce, pthread.h is part of glibc and very unlikely it's missing, a lot more stuff will break if it does.

I have same cmake version and glibc version.

please attach output of

ls -la {,/usr}/lib64/libpthread*

as well as

qlist glibc | grep pthread

also please attach both:

Comment 4 Azat Bahawi 2021-03-06 08:29:39 UTC
(In reply to Georgy Yakovlev from comment #3)
> can't reproduce, pthread.h is part of glibc and very unlikely it's missing,
> a lot more stuff will break if it does.

I agree. For some reason, though, I can build this outside of portage if I just clone the repo and run `cmake` there manually.
Here's the relevant output if I do that:
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE

The error keep persisting only if I try to emerge this package.

Also, I forgot to mention that I can successfully merge app-shells/fish-3.1.2. Pthread check passes there.
Comment 5 Azat Bahawi 2021-03-06 08:30:47 UTC
Created attachment 689592 [details]
ls -la {,/usr}/lib64/libpthread*
Comment 6 Azat Bahawi 2021-03-06 08:31:05 UTC
Created attachment 689595 [details]
qlist glibc | grep pthread
Comment 7 Azat Bahawi 2021-03-06 08:32:07 UTC
Created attachment 689598 [details]
Comment 8 Azat Bahawi 2021-03-06 08:32:27 UTC
Created attachment 689601 [details]
Comment 9 Sam James archtester gentoo-dev Security 2021-03-06 09:30:50 UTC
Determining if the include file pthread.h exists failed with the following output:
Change Dir: /tmp/portage/app-shells/fish-3.2.0/work/fish-3.2.0_build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/ninja cmTC_2cfa8 && [1/2] Building C object CMakeFiles/cmTC_2cfa8.dir/CheckIncludeFile.c.o
[2/2] Linking C executable cmTC_2cfa8
FAILED: cmTC_2cfa8 
: && /usr/bin/x86_64-pc-linux-gnu-gcc -march=native -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=auto -fuse-linker-plugin -falign-functions=32 -pipe -Wl,-O1 -Wl,--as-needed -fdiagnostics-color=always -Wl,-O1 -Wl,--as-needed -march=native -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=auto -fuse-linker-plugin -falign-functions=32 -pipe -fuse-ld=lld   -rdynamic CMakeFiles/cmTC_2cfa8.dir/CheckIncludeFile.c.o -o cmTC_2cfa8   && :
ld.lld: error: undefined symbol: main
>>> referenced by /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib64/Scrt1.o:(_start)
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

Please try with a minimal set of *FLAGS and then bisect the issue. I suspect it’s LTO released but we will see. Your gcc may be broken too?

(Also, does FEATURES=fakeroot actually work?)
Comment 10 Fabio Coatti 2021-03-06 16:07:18 UTC
I have the same issue. Removing LTO from compilation flags fixes the issue, other "aggressive" flags like O3 and graphite causes no harm.
Comment 11 Georgy Yakovlev gentoo-dev 2021-03-07 06:45:17 UTC
ok, changing resolution.
thanks for testing.