Permission error on mkdir /usr/src/gmock and gcc's ld cannot find -lpthreads - app-emulation/anbox
Ebuild Error
category/package
Error logs
/var/tmp/portage/app-emulation/anbox-0_pre20201129/work/anbox-0_pre20201129_build/CMakeFiles/CMakeError.log
* cmake failed
*
* Call stack:
* ebuild.sh, line 125: Called src_configure
* environment, line 2683: Called cmake_src_configure
* environment, line 1110: Called die
* The specific snippet of code:
* "${CMAKE_BINARY}" "${cmakeargs[@]}" "${CMAKE_USE_DIR}" || die "cmake failed";
*
* If you need support, post the output of `emerge --info '=app-emulation/anbox-0_pre20201129::src_prepare-overlay'`,
* the complete build log and the output of `emerge -pqv '=app-emulation/anbox-0_pre20201129::src_prepare-overlay'`.
* The complete build log is located at '/var/tmp/portage/app-emulation/anbox-0_pre20201129/temp/build.log'.
* The ebuild environment file is located at '/var/tmp/portage/app-emulation/anbox-0_pre20201129/temp/environment'.
* Working directory: '/var/tmp/portage/app-emulation/anbox-0_pre20201129/work/anbox-0_pre20201129_build'
* S: '/var/tmp/portage/app-emulation/anbox-0_pre20201129/work/anbox-6c10125a7f13908d2cbe56d2d9ab09872755f265'
>>> Failed to emerge app-emulation/anbox-0_pre20201129, Log file:
>>> '/var/tmp/portage/app-emulation/anbox-0_pre20201129/temp/build.log'
* Messages for package app-emulation/anbox-0_pre20201129:
* ERROR: app-emulation/anbox-0_pre20201129::src_prepare-overlay failed (configure phase):
* cmake failed
void* test_func(void* data)
{
return data;
}
int main(void)
{
pthread_t thread;
pthread_create(&thread, NULL, test_func, NULL);
pthread_detach(thread);
pthread_cancel(thread);
pthread_join(thread, NULL);
pthread_atfork(NULL, NULL, NULL);
pthread_exit(NULL);
return 0;
}
Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /var/tmp/portage/app-emulation/anbox-0_pre20201129/work/anbox-0_pre20201129_build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/ninja cmTC_c74ff && [1/2] Building C object CMakeFiles/cmTC_c74ff.dir/CheckFunctionExists.c.o
[2/2] Linking C executable cmTC_c74ff
FAILED: cmTC_c74ff
: && /usr/bin/x86_64-pc-linux-gnu-gcc -march=sandybridge -O2 -pipe -Wall -pedantic -Wno-error=pedantic -Wno-variadic-macros -Wextra -fPIC -pedantic -Wno-error=pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wformat -Wredundant-decls -Wswitch-default -DCHECK_FUNCTION_EXISTS=pthread_create -Wl,-O1 -Wl,--as-needed -rdynamic CMakeFiles/cmTC_c74ff.dir/CheckFunctionExists.c.o -o cmTC_c74ff -lpthreads && :
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
While compiling anbox (both the 9999 version and the 20201129 version), using both =sys-devel/gcc-10.2.0-r5::gentoo
and =sys-devel/gcc-9.3.0-r2::gentoo
, I received at first a permission error about the creation of the directory /usr/src/gmock
, after manually creating said directory, that error has gone away, only to be replaced by the one above. Googling the error was no help, but after looking at the build log, I noticed it trying to look for gtest, gtest_main, gmock and gmock_main, and after looking it up, all of them seem to be provided by =dev-cpp/gtest-1.10.0_p20200702::gentoo
, as after emerging that, anbox built successfully. This leads me to believe that dev-cpp/gtest
is a build dependency (unsure about runtime) so it should be added to the EBUILD.