Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

WIP: Compile on non-ubuntu #29

Closed
wants to merge 11 commits into from
Closed

Conversation

oleid
Copy link

@oleid oleid commented Apr 12, 2017

Note: This branch is not to be merged at the moment. I merely want to share my progress of experimentation on a place others can find it easily.

This is what I need to be able to compile anbox on ArchLinux.

dbus-cpp and friends are not available there, hence I prepared dbus-cpp and properties-cpp as submodules (branches submodule) and added them to the project. Also, a few changes to -Werror and friends are included to actually build the submodules.

Since sailfish-os doesn't provide dbus-cpp and friends, too - AFAIK - it's probably of use there, too.

EDIT:
Google-test is now included as submodule; building is for me on archlinux nothing more than:

git clone git@github.com:oleid/anbox.git
git checkout compile-on-non-ubuntu

git submodule update --init --recursive
mkdir build  && cd build && cmake ..

@Pival81
Copy link

Pival81 commented Apr 12, 2017

Hi, I've tried to install your version of anbox on archlinux too, and I've come across this error:

-- The C compiler identification is GNU 6.3.1
-- The CXX compiler identification is GNU 6.3.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
-- No build type selected, default to release
-- 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.63.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 "0.29.1") 
-- Found EGL: /usr/lib64/libEGL.so  
-- Found GLESv2: /usr/lib64/libGLESv2.so  
-- Found Protobuf: /usr/lib64/libprotobuf.so;-lpthread (found version "3.2.0") 
-- Checking for module 'sdl2'
--   Found sdl2, version 2.0.5
-- Checking for module 'dbus-cpp'
--   No package 'dbus-cpp' found
CMake Error at /usr/share/cmake-3.7/Modules/FindPkgConfig.cmake:415 (message):
  A required package was not found
Call Stack (most recent call first):
  /usr/share/cmake-3.7/Modules/FindPkgConfig.cmake:588 (_pkg_check_modules_internal)
  CMakeLists.txt:67 (pkg_check_modules)


-- Configuring incomplete, errors occurred!
See also "/home/pival81/anbox/anbox/build/CMakeFiles/CMakeOutput.log".
See also "/home/pival81/anbox/anbox/build/CMakeFiles/CMakeError.log".

But then i adjusted this by editing the dbus-cpp line in CMakeList to dbus-c++-1, but it blocked at this:

-- No build type selected, default to release
-- Treat warnings as errors
-- Boost version: 1.63.0
-- Found the following Boost libraries:
--   filesystem
--   log
--   serialization
--   system
--   thread
--   program_options
--   date_time
--   log_setup
--   regex
--   chrono
--   atomic
-- Checking for module 'dbus-c++-1'
--   Found dbus-c++-1, version 0.9.0
-- Checking for module 'dbus-1'
--   Found dbus-1, version 1.10.16
-- Checking for module 'lxc'
--   Found lxc, version 2.0.7
-- Checking for module 'mirclient'
--   No package 'mirclient' found
CMake Error at CMakeLists.txt:95 (add_subdirectory):
  The source directory

    /usr/src/gmock

  does not contain a CMakeLists.txt file.


-- Boost version: 1.63.0
-- Found the following Boost libraries:
--   iostreams
--   system
--   regex
-- Boost version: 1.63.0
-- Found the following Boost libraries:
--   filesystem
--   system
--   unit_test_framework
-- Configuring incomplete, errors occurred!
See also "/home/pival81/anbox/anbox/build/CMakeFiles/CMakeOutput.log".
See also "/home/pival81/anbox/anbox/build/CMakeFiles/CMakeError.log".

I have installed gmock, and at /usr/src/gmock there is indeed no CMakeLists.txt file, but this error didn't come up with the normal version of anbox.

@oleid
Copy link
Author

oleid commented Apr 12, 2017

That's strage - commit 1b6982e should make sure you don't need a globally installed dbus-cpp.

You still need to checkout the source code of googletest and point the GMOCK_SOURCE_DIR variable to the correct path. One could include that as submodule, too, though.

@oleid
Copy link
Author

oleid commented Apr 12, 2017

Google-test is now included as submodule; building is for me on archlinux nothing more than:
Also, I accidentally tracked the wrong branches of dbus-cpp and friends.

git clone $URL
git checkout compile-on-non-ubuntu

git submodule update --init --recursive
mkdir build  && cd build && cmake ..

@kageurufu
Copy link

After installing lxc, boost, doxygen, and lcov, I'm now getting

CMake Error at external/dbus-cpp/CMakeLists.txt:37 (if):
  if given arguments:

    "STREQUAL" "vivid"

  Unknown arguments specified

@oleid
Copy link
Author

oleid commented Apr 12, 2017

You need the package lsb-release.

@kageurufu
Copy link

That worked, but now a new issue

What filesystem are you using? I'm getting an error under btrfs when creating external/properties-cpp/doc/man/man3/VeryLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooogName.3, which is 262B. Every FS I know has 255B filename limits

@oleid
Copy link
Author

oleid commented Apr 12, 2017

Uh, quite strange - also btrfs.

Note to myself due the failed check: It seems as if the gmock&gtest libs are not linked.

@kruug
Copy link

kruug commented Apr 12, 2017

Debian Stretch x64.

CMake Error at /usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:138 (message):
Could NOT find LibXml2 (missing: LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR)
Call Stack (most recent call first):
/usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.7/Modules/FindLibXml2.cmake:58 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
external/dbus-cpp/CMakeLists.txt:51 (find_package)

And I do have libxml2 installed via apt-get.

@vamur
Copy link

vamur commented Apr 12, 2017

On Archlinux, I can compile by disabling tests and installing dbus-cpp from AUR. After that if I run /usr/local/bin/anbox container-manager --data-path=/var/lib/anbox/ --android-image=android.img.path as root

and in another terminal
/usr/local/bin/anbox session-manager

Getting
[client.cpp:49@start] Failed to start container: Failed to start container: Failed to start container
[session_manager.cpp:140@operator()] Lost connection to container manager, terminating.
[daemon.cpp:58@Run] Container is not running
Segmentation fault (core dumped)

Also running scripts/start-container.sh

lxc-start: log.c: log_open: 300 failed to open log file "/var/lib/anbox/containers/default/default.log" : Permission denied
lxc-start: log.c: build_dir: 279 Permission denied - failed to create directory '/var/log/lxc'.
lxc-start: log.c: __lxc_log_set_file: 409 failed to create dir for log file "/var/log/lxc/default.log" : Permission denied
lxc-start: tools/lxc_start.c: main: 317 Executing '/sbin/init' with no configuration file may crash the host

@shellkr
Copy link

shellkr commented Apr 13, 2017

I did as pival81 and then this..

# Build with system gmock and embedded gtest
set (GMOCK_INCLUDE_DIR "/usr/include/gmock/" CACHE PATH "gmock source include directory")
set (GMOCK_SOURCE_DIR "/usr/src/gtest" CACHE PATH "gmock source directory")
set (GTEST_INCLUDE_DIR "/usr/include/gtest" CACHE PATH "gtest source include directory")

And it was able to build. I don't know but I noticed a CMakeList.txt in the /usr/src/gtest dir and thought it was worth a try. It did then build.

Make gave me this however..

Scanning dependencies of target gtest
[  0%] Building CXX object gmock/CMakeFiles/gtest.dir/src/gtest-all.cc.o
In file included from /usr/src/gtest/src/gtest-all.cc:42:0:
/usr/src/gtest/src/gtest.cc: In member function ‘void testing::internal::edit_distance::{anonymous}::Hunk::PushLine(char, const char*)’:
/usr/src/gtest/src/gtest.cc:1136:12: error: switch missing default case [-Werror=switch-default]
     switch (edit) {
            ^
cc1plus: all warnings being treated as errors
make[2]: *** [gmock/CMakeFiles/gtest.dir/build.make:63: gmock/CMakeFiles/gtest.dir/src/gtest-all.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:984: gmock/CMakeFiles/gtest.dir/all] Error 2
make: *** [Makefile:139: all] Error 2

@shellkr
Copy link

shellkr commented Apr 13, 2017

I was able to build and install 'anbox-git' (from AUR) if I changed the CMakeList.txt as I did above. I had to do it on 'process-cpp' (from AUR) too.

@oleid
Copy link
Author

oleid commented Apr 13, 2017

@kruug: Isnt there a corresponding devel package?

@shellkr: The package from AUR disables tests; your errors suggest, that you don't build from my branch.

@ghost
Copy link

ghost commented Apr 13, 2017

so, installing from anbox-git aur package, do i have to download the android image too? if so, from where? I did get it installed but i'm not sure how to get it working due to the kernel modules being missing. How do i get that to work?
Thanks for all this. 😄

@oleid
Copy link
Author

oleid commented Apr 13, 2017

@Mufeed20:
sorry, no idea. this is about compiling only, I havent tried running it, yet, since I lack the modules, too.

@subjectdenied
Copy link

to fetch android-image:
wget http://build.anbox.io/android-images/2017/04/12/android_1_amd64.img

@kruug
Copy link

kruug commented Apr 13, 2017

Installing libxml2-dev allowed me to fully CMake. make and make install ran without issue, but as soon as I called anbox, I received:

anbox: error while loading shared libraries: libdbus-cpp.so.5: cannot open shared object file: No such file or directory

Is there a way to get anbox to check for libdbus-cpp OR libdbus-c++ and link itself to the one it finds instead of trying to tack on submodules?

@Tekercs
Copy link

Tekercs commented Apr 13, 2017

Can I ask your help guys?
I successfully build the stuff and could run the container-manager without problem but when is tried to run the session-manager i got an error message:

[EE 2017-04-13 16:41:24] [session_manager.cpp:119@operator()] Failed to start as either binder or ashmem kernel drivers are not loaded

Does anybody else got the same problem ?

@subjectdenied
Copy link

@Tekercs : https://aur.archlinux.org/packages/anbox-git/?comments=all

@abluelark
Copy link

abluelark commented Apr 13, 2017

Enable Installation on more Distributions #3
I've got it working on arch here.

@xeon-zolt
Copy link

@Tekercs dkms status (do you see the drivers)
yes
-->then sudo dkms autoinstall
no
-->then yaourt -S anbox-modules-dkms-git

@morphis
Copy link
Member

morphis commented Apr 14, 2017

@oleid Thanks for these changes!

I don't really like the use of submodules as they are nasty and hard to work with. If this is just to make packaging easier you can fetch dbus-cpp within you PKGBUILD instead. Mid term we may move away from dbus-cpp to use something which more widely available on other distributions. For google-test we could add an option first which disables building tests for you. I wonder why google-test isn't available on Arch. If it is not then someone should really package it as its a common thing widely used in many other software projects.

A lot of these changes were also already merged with #44

Can you merge with master or rebase?

Also the CI fails on this PR.

@morphis morphis closed this Apr 14, 2017
@morphis morphis reopened this Apr 14, 2017
@shellkr
Copy link

shellkr commented Apr 14, 2017

@morphis google-test is available in Arch in AUR under the name 'gtest'..

@Tekercs
Copy link

Tekercs commented Apr 16, 2017

Thanks guys! I managed to run everything is "fine" except the session manager keeps spaming the stdout with the following message:
libEGL warning: FIXME: egl/x11 doesn't support front buffer rendering.

A but laggy but works, sometimes kills the KDE desktop.
Does any of you met with the same problem ?

@kruug
Copy link

kruug commented Apr 19, 2017

On Debian Stretch 64-bit, had to run:

sudo ln -s /usr/lib/x86_64-linux-gnu/libdbus-c++-1.so.0 /usr/lib/x86_64-linux-gnu/libdbus-cpp.so.5

before anbox would run.

@oleid
Copy link
Author

oleid commented Apr 20, 2017

FYI: I just realized, that binder and anshmem are in upstream kernel sources, however not enabled by default. I just build linux-git with:

  cat << EOF >> .config
CONFIG_ANDROID=y
CONFIG_ANDROID_LOW_MEMORY_KILLER=n
CONFIG_ANDROID_BINDER_IPC=y
CONFIG_ANDROID_BINDER_DEVICES="binder"
CONFIG_ASHMEM=y
CONFIG_ION=n
EOF

and it's running just fine :)

@morphis
Copy link
Member

morphis commented Apr 26, 2017

@oleid What is the status of this? There are a few useful things in here which we want to integrate. However the submodules are not. Can you clean this PR so we can do a proper PR and get the other bits merged?

@morphis
Copy link
Member

morphis commented May 26, 2017

Any news here? Otherwise I would like to close this PR.

@charlag
Copy link

charlag commented Aug 29, 2017

So pity there's no one to work on this, being Ubuntu-only is... weird.

@morphis
Copy link
Member

morphis commented Aug 30, 2017

So pity there's no one to work on this, being Ubuntu-only is... weird.

As we're delivering a snap, Anbox can run theoretically run everyhwere. So this isn't a big problem. Anyone who wants to improve the build situation on other distributions is welcome to contribute.

@charlag
Copy link

charlag commented Aug 30, 2017

@morphis of course, it's not a complain towards mainainters in any way, I believe this will get momentum and we'll see flatpak/e.t.c. from volunteers.

@kruug
Copy link

kruug commented Aug 30, 2017

Anbox cannot run everywhere. You are relying on kernel modules that are currently only installed by default on Ubuntu. If you wanted to run everywhere, you'd find a way to either install them during the snap deploy, or you'd use a non-Ubuntu base for development.

@morphis
Copy link
Member

morphis commented Aug 30, 2017

Anbox cannot run everywhere. You are relying on kernel modules that are currently only installed by default on Ubuntu. If you wanted to run everywhere, you'd find a way to either install them during the snap deploy, or you'd use a non-Ubuntu base for development.

Interested in contributing packaging bits for other distributions? Snaps are running fine on Fedora, openSUSE, Debian etc. these days and so does Anbox when the kernel modules are loaded. The only last bit which is missing to have the snap working well on these distributions is a official DKMS package we can ship through obs/copr/... As soon as somebody contributes a RPM spec file for this we can setup an official Anbox repository for this and use it inside the anbox-installer. If you're interested, please help to get this solved.

I as a maintainer don't have the time to care about more than a single distribution. The free time I have for this doesn't permit much more.

@TriMoon
Copy link

TriMoon commented Sep 13, 2017

@morphis
Snaps are running fine on Fedora, openSUSE, Debian etc. these days and so does Anbox when the kernel modules are loaded.

Not true, see #461

@morphis
Copy link
Member

morphis commented Sep 24, 2017

I'm sorry, but I disagree with you. Many of us don't want Canonical/Ubuntu technology and prefer the native package managers of OUR Linux distributions.

As I said, I am fine with Anbox being packaged in any other packaging format. However I personally will only focus on snaps. If you don't want to use snaps (and snaps are a cross-platform effort and not specific to Ubuntu, see https://snapcraft.io/), you're fine to use whatever you want. Changes to compile outside of Ubuntu are welcome but I don't have the time to test anything else at the moment. Changes to improve the CI to test PRs against other distributions and compile elsewhere are very welcome.

@kruug
Copy link

kruug commented Sep 24, 2017

and snaps are a cross-platform effort

That's great...but your code isn't.

@morphis
Copy link
Member

morphis commented Sep 24, 2017

That's great...but your code isn't.

It's all open source so you're more than welcome to improve support for any other distribution which isn't well supported yet.

@ihusky02
Copy link

@morphis Good Morning, I see that you work on anbox for SailfishOS port, if you want want I can help in test.

write to me if you want to share you currently work.

@Luri64 Luri64 mentioned this pull request Jan 16, 2018
@ehegnes
Copy link

ehegnes commented Mar 15, 2018

I'm in the midst of packaging this for Gentoo systems without the dreaded systemd init system and have questions that don't quite merit their own issue.

Can somebody with better knowledge of this project (perhaps @morphis) explain the dbus-cpp and other *-cpp requirements? Is this a convenience for the developers? Is dbus-cpp just a wrapper or something more that would suffer from lack of maintenance?

Finally, some people in this thread have suggested using the more widely available dbus-c++ which may not be suitable since the project has been dead for years.

@oleid
Copy link
Author

oleid commented Mar 26, 2018

Reading the source of dbus-cpp, it seems as it has no dependency on any C implementation of dbus. It's stand-alone, as you might say. But what does this have to do with the dreaded systemd init system, as you call it?

@morphis morphis closed this May 16, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet