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

Fix compilation on kernels >= 5.1 #19

Merged
merged 6 commits into from Jul 13, 2019
Merged

Fix compilation on kernels >= 5.1 #19

merged 6 commits into from Jul 13, 2019

Conversation

ghost
Copy link

@ghost ghost commented May 12, 2019

Based on torvalds/linux@e19f70a. Fixes #17.

@EHfive
Copy link

EHfive commented May 17, 2019

@morphis Could you please give a review

@SoulInfernoDE
Copy link

DKMS make.log for anbox-binder-1 for kernel 5.1.4-050104-generic (x86_64)
Do 23. Mai 19:52:55 CEST 2019
make -C /lib/modules/5.1.4-050104-generic/build V=0 M=$PWD
make[1]: Verzeichnis „/usr/src/linux-headers-5.1.4-050104-generic“ wird betreten
  CC [M]  /var/lib/dkms/anbox-binder/1/build/deps.o
  CC [M]  /var/lib/dkms/anbox-binder/1/build/binder.o
/var/lib/dkms/anbox-binder/1/build/binder.c:3406:11: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
  .fault = binder_vm_fault,
           ^~~~~~~~~~~~~~~
/var/lib/dkms/anbox-binder/1/build/binder.c:3406:11: note: (near initialization for ‘binder_vm_ops.fault’)
cc1: some warnings being treated as errors
scripts/Makefile.build:275: recipe for target '/var/lib/dkms/anbox-binder/1/build/binder.o' failed
make[2]: *** [/var/lib/dkms/anbox-binder/1/build/binder.o] Error 1
Makefile:1571: recipe for target '_module_/var/lib/dkms/anbox-binder/1/build' failed
make[1]: *** [_module_/var/lib/dkms/anbox-binder/1/build] Error 2
make[1]: Verzeichnis „/usr/src/linux-headers-5.1.4-050104-generic“ wird verlassen
Makefile:8: recipe for target 'all' failed
make: *** [all] Error 2

@ghost
Copy link
Author

ghost commented May 24, 2019

@SoulInfernoDE
Please check if you have patched the source code before compilation. I have no issues compiling the modules on 5.1.4 after the patch.

@GrigorijST
Copy link

@SoulInfernoDE
Please check if you have patched the source code before compilation. I have no issues compiling the modules on 5.1.4 after the patch.

I can confirm it. Everything is good on 5.1.4 after the patch...

MarvelousBlack referenced this pull request in archlinuxcn/repo May 24, 2019
@SoulInfernoDE
Copy link

SoulInfernoDE commented May 25, 2019

yes with the patch it works - is this patch beeing merged somehow somewhere or do we always need to apply this everytime on kernel 5.x ?

@WhyNotHugo
Copy link

@SoulInfernoDE Once this PR is merged, you won't have to apply the patch manually any more.

@dreamcat4
Copy link

@anbox please take the patch

binder/binder.c Show resolved Hide resolved
@ghost
Copy link
Author

ghost commented Jun 4, 2019

@morphis
It looks like a retpoline compiler is needed - should we use GCC 8 for Travis?

@Traneptora
Copy link

Traneptora commented Jun 5, 2019

Apparently I did a bunch of work on this, only to discover my work is a duplicate of this PR... although I did discover that apparently, the header change should start at kernel 4.17, which is when the typedef for vm_fault_t was added to the kernel headers.

@Mhowser
Copy link

Mhowser commented Jun 9, 2019

Any progress on getting this merged?

@SoulInfernoDE
Copy link

SoulInfernoDE commented Jun 16, 2019

if you need to apply patch you can look at:
https://github.com/archlinuxcn/repo/blob/b668ee4ea9749c77c55212032c5f064d6fb11107/archlinuxcn/anbox-git/fix_linux_5.1.x.patch

This was referenced here also. On debian/linux mint you need to sudo apt install patch. Then download the source code that needs to be patched. Put the patchfile in the root of the source code folder and use terminal/shell to apply the patch:
patch -p1 < fix_linux_5.1.x.patch
Then build the module again from the patched source.

@Lumumba
Copy link

Lumumba commented Jun 16, 2019 via email

@morphis
Copy link
Member

morphis commented Jun 19, 2019

@86423355844265459587182778 if we can use gcc8 on travis just for the relevant kernels that would be the way to go.

@Technically-Alexander
Copy link

Thanks @86423355844265459587182778, this tweak worked for me to install the binder on Fedora 30 running 5.1.15-300 kernel.

Hopefully the team implements it soon, and doesn't break anything. Good work. Appreciate it.

@ghost
Copy link
Author

ghost commented Jun 30, 2019

@Technically-Alexander
You are welcome. I do not know how to update the Travis build configuration to make Travis use GCC 8 just for kernels >= 5.0, so any help would be greatly appreciated.

@Hattshire
Copy link

@Technically-Alexander
You are welcome. I do not know how to update the Travis build configuration to make Travis use GCC 8 just for kernels >= 5.0, so any help would be greatly appreciated.

Here are some details about it:
https://docs.travis-ci.com/user/languages/cpp/#c11c11-and-beyond-and-toolchain-versioning

Copy link

@Hattshire Hattshire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add to apt:

apt:
  sources:
    - ubuntu-toolchain-r-test
  packages:
    - g++-8

At:

apt:
packages:
- bison
- flex
- libelf-dev
- dpkg-dev
- debhelper

Change KVER=5.1 and KVER=5.0

To:

- KVER=5.0 && CC=gcc-8 && CXX=g++-8
- KVER=5.1 && CC=gcc-8 && CXX=g++-8

At:

- KVER=4.17
- KVER=5.0
- KVER=5.1
- KVER=master

@Hattshire
Copy link

This problem with the travis build rises from the mitigation of SPECTREv2, released on KVER=4.20, backported to 4.19.2, so builds to kernel versions equal or greater also will fail with an outdated compiler.

However, travis is not testing against them, sooo whatever, I guess


https://stackoverflow.com/questions/48089426/what-is-a-retpoline-and-how-does-it-work
https://lkml.org/lkml/2018/10/23/469

@Hattshire
Copy link

Just checked kernel's makefile:
https://github.com/torvalds/linux/blob/550d1f5bda33fa3b203d8cf8df1396825dbfd213/Makefile#L410
I wonder if it's taking CC as that 🤔

@ghost
Copy link
Author

ghost commented Jul 4, 2019

I managed to make Travis use GCC 8 just for kernels >= 5.0. Thanks @Hattshire!

Copy link
Member

@morphis morphis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@morphis morphis merged commit 816dd4d into anbox:master Jul 13, 2019
@TheOneWithTheBraid
Copy link

@morphis When will you update the Packages in your PPA at https://launchpad.net/~morphis/+archive/ubuntu/anbox-support/+packages ?

@hosford42
Copy link

I'm still getting this error.

/var/lib/dkms/anbox/1/build/binder/binder.c:3382:11: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
  .fault = binder_vm_fault,
           ^~~~~~~~~~~~~~~
/var/lib/dkms/anbox/1/build/binder/binder.c:3382:11: note: (near initialization for ‘binder_vm_ops.fault’)
cc1: some warnings being treated as errors
scripts/Makefile.build:288: recipe for target '/var/lib/dkms/anbox/1/build/binder/binder.o' failed
make[2]: *** [/var/lib/dkms/anbox/1/build/binder/binder.o] Error 1
Makefile:1655: recipe for target '_module_/var/lib/dkms/anbox/1/build/binder' failed

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.4 LTS
Release:	18.04
Codename:	bionic
$ uname -r
5.3.0-46-generic
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.5.0-3ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04) 

Please let me know if there's other information I can provide to help.

@TheOneWithTheBraid
Copy link

@hosford42 I guess you have installed linux-headers and are building from latest upstream?

@TheOneWithTheBraid
Copy link

@hosford42 Oh, sorry, maybe #36 might fix this?

@hosford42
Copy link

That does look like it will address my error. I was attempting to follow the instructions in https://github.com/anbox/anbox/blob/master/docs/install.md, which indicate that anbox-modules should be installed from ppa:morphis/anbox-support.

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.

binder: Fail to compile against Linux 5.1.0