Anbox-git compiling "ERROR: A failure occurred in build()"

Hello everyone,

I am trying to install Anbox following the instructions here:

https://forum.manjaro.org/t/running-android-applications-on-arch-using-anbox/53332

But I’m getting this error:

==> ERROR: A failure occurred in build().
    Aborting...

I’m using Manjaro XFCE. And this is the full output below :

==> Making package: anbox-git 1:r2.13adae6-1 (Mon 18 Mar 2019 03:21:13 PM CET)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Updating anbox git repo...
Fetching origin
  -> Updating anbox-modules git repo...
Fetching origin
  -> Found anbox-container-manager.service
  -> Found anbox-session-manager.service
  -> Found 99-anbox.rules
  -> Found anbox.conf
  -> Found anbox.desktop
  -> Found anbox-bridge.network
  -> Found anbox-bridge.netdev
==> Validating source files with sha256sums...
    anbox ... Skipped
    anbox-modules ... Skipped
    anbox-container-manager.service ... Passed
    anbox-session-manager.service ... Passed
    99-anbox.rules ... Passed
    anbox.conf ... Passed
    anbox.desktop ... Passed
    anbox-bridge.network ... Passed
    anbox-bridge.netdev ... Passed
==> Extracting sources...
  -> Creating working copy of anbox git repo...
Reset branch 'makepkg'
  -> Creating working copy of anbox-modules git repo...
Reset branch 'makepkg'
==> Starting prepare()...
==> Starting pkgver()...
==> Removing existing $pkgdir/ directory...
==> Starting build()...
-- The C compiler identification is GNU 8.2.1
-- The CXX compiler identification is GNU 8.2.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Treat warnings as errors
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Boost version: 1.69.0
-- Found the following Boost libraries:
--   filesystem
--   log
--   serialization
--   system
--   thread
--   program_options
--   date_time
--   log_setup
--   regex
--   chrono
--   atomic
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.6.0") 
-- Found EGL: /usr/lib/libEGL.so  
-- Found GLESv2: /usr/lib/libGLESv2.so  
-- Found Protobuf: /usr/lib/libprotobuf.so;-lpthread (found version "3.6.1") 
-- Checking for module 'sdl2'
--   Found sdl2, version 2.0.9
-- Checking for module 'SDL2_image'
--   Found SDL2_image, version 2.0.4
-- Checking for module 'dbus-1'
--   Found dbus-1, version 1.12.12
-- Checking for module 'lxc'
--   Found lxc, version 3.1.0
-- Checking for module 'properties-cpp'
--   Found properties-cpp, version 0.0.1
-- Checking for module 'libsystemd'
--   Found libsystemd, version 241
-- LXC version: 3.1.0
CMake Error: File /tmp/anbox-git/src/anbox/src/anbox/build/config.h.in does not exist.
CMake Error at CMakeLists.txt:127 (configure_file):
  configure_file Problem configuring file


-- Boost version: 1.69.0
-- Found the following Boost libraries:
--   iostreams
--   system
--   regex
-- Boost version: 1.69.0
-- Found the following Boost libraries:
--   filesystem
--   system
--   unit_test_framework
-- Found libdw: /usr/lib/libdw.so  
-- Found libbfd: /usr/lib/libbfd.so  
-- Found libdwarf: /usr/lib/libdwarf.so  
-- Found Backward: /tmp/anbox-git/src/anbox/external/backward-cpp  
-- Configuring incomplete, errors occurred!
See also "/tmp/anbox-git/src/anbox/build/CMakeFiles/CMakeOutput.log".
See also "/tmp/anbox-git/src/anbox/build/CMakeFiles/CMakeError.log".
==> ERROR: A failure occurred in build().
    Aborting...

And this is the CMakeError.log error log:

Determining if the pthread_create exist failed with the following output:
Change Dir: /tmp/anbox-git/src/anbox/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_2b87c/fast"
/usr/bin/make -f CMakeFiles/cmTC_2b87c.dir/build.make CMakeFiles/cmTC_2b87c.dir/build
make[1]: Entering directory '/tmp/anbox-git/src/anbox/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_2b87c.dir/CheckSymbolExists.c.o
/usr/bin/cc   -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -Wall -pedantic -Wno-variadic-macros -Wextra -fPIC -pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wformat -Wredundant-decls -Wswitch-default -Werror -Wno-error=deprecated-declarations    -o CMakeFiles/cmTC_2b87c.dir/CheckSymbolExists.c.o   -c /tmp/anbox-git/src/anbox/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
/tmp/anbox-git/src/anbox/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c: In function ‘main’:
/tmp/anbox-git/src/anbox/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8:11: error: ISO C forbids conversion of function pointer to object pointer type [-Werror=pedantic]
   return ((int*)(&pthread_create))[argc];
           ^
cc1: all warnings being treated as errors
make[1]: *** [CMakeFiles/cmTC_2b87c.dir/build.make:66: CMakeFiles/cmTC_2b87c.dir/CheckSymbolExists.c.o] Error 1
make[1]: Leaving directory '/tmp/anbox-git/src/anbox/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_2b87c/fast] Error 2

File /tmp/anbox-git/src/anbox/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <pthread.h>

int main(int argc, char** argv)
{
  (void)argv;
#ifndef pthread_create
  return ((int*)(&pthread_create))[argc];
#else
  (void)argc;
  return 0;
#endif
}

Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /tmp/anbox-git/src/anbox/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_01898/fast"
/usr/bin/make -f CMakeFiles/cmTC_01898.dir/build.make CMakeFiles/cmTC_01898.dir/build
make[1]: Entering directory '/tmp/anbox-git/src/anbox/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_01898.dir/CheckFunctionExists.c.o
/usr/bin/cc   -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -Wall -pedantic -Wno-variadic-macros -Wextra -fPIC -pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wformat -Wredundant-decls -Wswitch-default -Werror -Wno-error=deprecated-declarations -DCHECK_FUNCTION_EXISTS=pthread_create   -o CMakeFiles/cmTC_01898.dir/CheckFunctionExists.c.o   -c /usr/share/cmake-3.13/Modules/CheckFunctionExists.c
Linking C executable cmTC_01898
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_01898.dir/link.txt --verbose=1
/usr/bin/cc -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -Wall -pedantic -Wno-variadic-macros -Wextra -fPIC -pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wformat -Wredundant-decls -Wswitch-default -Werror -Wno-error=deprecated-declarations -DCHECK_FUNCTION_EXISTS=pthread_create  -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now  -rdynamic CMakeFiles/cmTC_01898.dir/CheckFunctionExists.c.o  -o cmTC_01898 -lpthreads 
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_01898.dir/build.make:87: cmTC_01898] Error 1
make[1]: Leaving directory '/tmp/anbox-git/src/anbox/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_01898/fast] Error 2

Thank you.

You are trying to build from the latest commit of the software. Try building from a tag or release.

3 Likes

I will try this.
Thank you for the help.

It works. Thank you.
I used this tag “69e75c9” it’s the one on the AUR. But it’s very old (Jun 12, 2018).
Is there a better way to update to a new one? or do I have to just keep testing it tag by tag ?

Pretty much.

You can try “bisecting” it (doing a binary search) instead of trying each one at a time in order.

Hi! I’ve updated anbox-git on March 1, 2019, version is 1:r1055.bb97f3a-1 and it was built without errors. So you can try that tag or later.
EDIT. Only two commits were added on March 7.

3 Likes

Thank you. It compiled. But didn’t get it to work.
I get this error:

[ 2019-03-18 18:35:40] [launch.cpp:210@operator()] Session manager failed to become ready

Did it work for you ?

Have you followed instructions on enabling services and so on?

EDIT. I need to rebuild anbox because of protobuf update. But it worked earlier.

EDIT2. It fails to build against testing branch where protobuf has updated, but the package that was built on March 1 works OK on stable branch.

1 Like

I’ve found another workaround that allows to build anbox-git from the latest commit. Before building the package you can edit its PKGBUILD and in build() function change cmake option from -DCMAKE_BUILD_TYPE=Release to -DCMAKE_BUILD_TYPE=Beta so that cmake will ignore some warnings.
Unfortunately, protobuf update from 3.6.1.3-1 to 3.7.0-1 gives errors and not just warnings and breaks the package building.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by Bytemark