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

binder modules fails to build #21

Closed
tyedco opened this issue May 22, 2019 · 10 comments
Closed

binder modules fails to build #21

tyedco opened this issue May 22, 2019 · 10 comments

Comments

@tyedco
Copy link

tyedco commented May 22, 2019

It fails with the following error:

DKMS make.log for anbox-modules-binder-r1096.ea2b7a3 for kernel 5.1.3-arch1-1-ARCH (x86_64)
Wed May 22 11:53:23 NZST 2019
make -C /lib/modules/5.1.3-arch1-1-ARCH/build V=0 M=$PWD
make[1]: Entering directory '/usr/lib/modules/5.1.3-arch1-1-ARCH/build'
CC [M] /var/lib/dkms/anbox-modules-binder/r1096.ea2b7a3/build/deps.o
CC [M] /var/lib/dkms/anbox-modules-binder/r1096.ea2b7a3/build/binder.o
/var/lib/dkms/anbox-modules-binder/r1096.ea2b7a3/build/binder.c:3406:11: error: initialization of ‘vm_fault_t (*)(struct vm_fault )’ {aka ‘unsigned int ()(struct vm_fault )’} from incompatible pointer type ‘int ()(struct vm_fault *)’ [-Werror=incompatible-pointer-types]
.fault = binder_vm_fault,
^~~~~~~~~~~~~~~
/var/lib/dkms/anbox-modules-binder/r1096.ea2b7a3/build/binder.c:3406:11: note: (near initialization for ‘binder_vm_ops.fault’)
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:275: /var/lib/dkms/anbox-modules-binder/r1096.ea2b7a3/build/binder.o] Error 1
make[1]: *** [Makefile:1571: module/var/lib/dkms/anbox-modules-binder/r1096.ea2b7a3/build] Error 2
make[1]: Leaving directory '/usr/lib/modules/5.1.3-arch1-1-ARCH/build'
make: *** [Makefile:8: all] Error 2

@Ryhon0
Copy link

Ryhon0 commented May 23, 2019

Same thing occurs on Manjaro with 5.2rc0 kernel
dkms install output:

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area...
make -j4 KERNELRELEASE=5.2.0-1-MANJARO all KERNEL_SRC=/lib/modules/5.2.0-1-MANJARO/build...(bad exit status: 2)
Error! Bad return status for module build on kernel: 5.2.0-1-MANJARO (x86_64)
Consult /var/lib/dkms/anbox-binder/1/build/make.log for more information.

make.log:

DKMS make.log for anbox-binder-1 for kernel 5.2.0-1-MANJARO (x86_64)
Thu 23 May 2019 03:18:16 PM CEST
make -C /lib/modules/5.2.0-1-MANJARO/build V=0 M=$PWD
make[1]: Entering directory '/usr/lib/modules/5.2.0-1-MANJARO/build'
  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 of ‘vm_fault_t (*)(struct vm_fault *)’ {aka ‘unsigned int (*)(struct vm_fault *)’} from incompatible pointer type ‘int (*)(struct vm_fault *)’ [-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
make[2]: *** [scripts/Makefile.build:278: /var/lib/dkms/anbox-binder/1/build/binder.o] Error 1
make[1]: *** [Makefile:1597: _module_/var/lib/dkms/anbox-binder/1/build] Error 2
make[1]: Leaving directory '/usr/lib/modules/5.2.0-1-MANJARO/build'
make: *** [Makefile:8: all] Error 2

@Davetheraveuk
Copy link

Same.
make.log output:

DKMS make.log for anbox-binder-1 for kernel 5.1.4-arch1-1-ARCH (x86_64)
Sat 25 May 13:26:02 BST 2019
make -C /lib/modules/5.1.4-arch1-1-ARCH/build V=0 M=$PWD
make[1]: Entering directory '/usr/lib/modules/5.1.4-arch1-1-ARCH/build'
  CC [M]  /var/lib/dkms/anbox-binder/1/build/binder.o
  CC [M]  /var/lib/dkms/anbox-binder/1/build/deps.o
/var/lib/dkms/anbox-binder/1/build/binder.c:3406:11: error: initialization of ‘vm_fault_t (*)(struct vm_fault *)’ {aka ‘unsigned int (*)(struct vm_fault *)’} from incompatible pointer type ‘int (*)(struct vm_fault *)’ [-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
make[2]: *** [scripts/Makefile.build:275: /var/lib/dkms/anbox-binder/1/build/binder.o] Error 1
make[1]: *** [Makefile:1571: _module_/var/lib/dkms/anbox-binder/1/build] Error 2
make[1]: Leaving directory '/usr/lib/modules/5.1.4-arch1-1-ARCH/build'
make: *** [Makefile:8: all] Error 2

Let me know if more information is required.
Dave.

@tyedco
Copy link
Author

tyedco commented May 25, 2019

I didn't find the original source anymore and don't know how to properly build a patch file, but here is what I did:

I replaced the lines in the file binder.c starting on line 3394:
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
static int binder_vm_fault(struct vm_fault *vmf)
#else
static int binder_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
#endif

with the following lines:
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)
static vm_fault_t binder_vm_fault(struct vm_fault *vmf)
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
static int binder_vm_fault(struct vm_fault *vmf)
#else
static int binder_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
#endif

then run 'make' again. (The 'ashmem' module needs to be built separately, but no errors there). The modules should be built then. Insert them with 'modprobe'.

@tyedco tyedco closed this as completed May 25, 2019
@Davetheraveuk
Copy link

Tried the ^^above^^ code change. Receiving the following error:

[dave@antergos anbox-modules]$ sudo dkms install anbox-binder/1
[sudo] password for dave: 

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area...
make -j8 KERNELRELEASE=5.1.4-arch1-1-ARCH all KERNEL_SRC=/lib/modules/5.1.4-arch1-1-ARCH/build.....(bad exit status: 2)
Error! Bad return status for module build on kernel: 5.1.4-arch1-1-ARCH (x86_64)
Consult /var/lib/dkms/anbox-binder/1/build/make.log for more information.
[dave@antergos anbox-modules]$ 

And this is from make.log:

DKMS make.log for anbox-binder-1 for kernel 5.1.4-arch1-1-ARCH (x86_64)
Sun 26 May 14:14:42 BST 2019
make -C /lib/modules/5.1.4-arch1-1-ARCH/build V=0 M=$PWD
make[1]: Entering directory '/usr/lib/modules/5.1.4-arch1-1-ARCH/build'
  CC [M]  /var/lib/dkms/anbox-binder/1/build/binder.o
  CC [M]  /var/lib/dkms/anbox-binder/1/build/deps.o
/var/lib/dkms/anbox-binder/1/build/binder.c:3406:11: error: initialization of ‘vm_fault_t (*)(struct vm_fault *)’ {aka ‘unsigned int (*)(struct vm_fault *)’} from incompatible pointer type ‘int (*)(struct vm_fault *)’ [-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
make[2]: *** [scripts/Makefile.build:275: /var/lib/dkms/anbox-binder/1/build/binder.o] Error 1
make[1]: *** [Makefile:1571: _module_/var/lib/dkms/anbox-binder/1/build] Error 2
make[1]: Leaving directory '/usr/lib/modules/5.1.4-arch1-1-ARCH/build'
make: *** [Makefile:8: all] Error 2

To anyone reading this, let me know if you require any more information.
Thanks, Dave.

@Ryhon0
Copy link

Ryhon0 commented May 26, 2019

This fork works for me on 5.1 and 5.2

@SoulInfernoDE
Copy link

SoulInfernoDE commented Jul 4, 2019

seems to be a similiar or the same issue as:

#19 (comment)

Temporary fix until merged

@totedati
Copy link

totedati commented Sep 8, 2019

@tyedco solution is working for me too.
My system is Ubuntu 18.04 with nonstandard kernel instaled with Ukuu - Mainline kernel installer for Ubuntu-based distributions

hostnamectl status
   Static hostname: berbecel
         Icon name: computer-desktop
           Chassis: desktop
        Machine ID: you dont need this info
           Boot ID: you dont need this info
  Operating System: Ubuntu 18.04.3 LTS
            Kernel: Linux 5.2.8-050208-generic
      Architecture: x86-64

I see the fix is uploaded already at anbox/anbox-modules
Fix compilation on kernels >= 5.1
but is not on ppa. This means that users still need to manual modify binder.c file but don't do it on working set, aka /var/lib/dkms/anbox/1/build/binder/binder.c because that file will be regenerated every time you try the dkms machinery. Instead make the manual modification on primary installed ppa source files at /var/lib/dkms/anbox/1/source/binder/binder.c then do a proper
dkms autoinstall
command so all dkms Rube Goldberg machinery hocus-pocus make its things then you should check make.log again. If we see this:

cat /var/lib/dkms/anbox/kernel-5.2.8-050208-generic-x86_64/log/make.log 
DKMS make.log for anbox-1 for kernel 5.2.8-050208-generic (x86_64)
sâmbătă 7 septembrie 2019, 18:37:32 +0300
make: Entering directory '/var/lib/dkms/anbox/1/build/ashmem'
make -C /lib/modules/5.2.8-050208-generic/build V=0 M=$PWD
make[1]: Entering directory '/usr/src/linux-headers-5.2.8-050208-generic'
  CC [M]  /var/lib/dkms/anbox/1/build/ashmem/deps.o
  CC [M]  /var/lib/dkms/anbox/1/build/ashmem/ashmem.o
  LD [M]  /var/lib/dkms/anbox/1/build/ashmem/ashmem_linux.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /var/lib/dkms/anbox/1/build/ashmem/ashmem_linux.mod.o
  LD [M]  /var/lib/dkms/anbox/1/build/ashmem/ashmem_linux.ko
make[1]: Leaving directory '/usr/src/linux-headers-5.2.8-050208-generic'
make: Leaving directory '/var/lib/dkms/anbox/1/build/ashmem'
make: Entering directory '/var/lib/dkms/anbox/1/build/binder'
make -C /lib/modules/5.2.8-050208-generic/build V=0 M=$PWD
make[1]: Entering directory '/usr/src/linux-headers-5.2.8-050208-generic'
  CC [M]  /var/lib/dkms/anbox/1/build/binder/deps.o
  CC [M]  /var/lib/dkms/anbox/1/build/binder/binder.o
  LD [M]  /var/lib/dkms/anbox/1/build/binder/binder_linux.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /var/lib/dkms/anbox/1/build/binder/binder_linux.mod.o
  LD [M]  /var/lib/dkms/anbox/1/build/binder/binder_linux.ko
make[1]: Leaving directory '/usr/src/linux-headers-5.2.8-050208-generic'
make: Leaving directory '/var/lib/dkms/anbox/1/build/binder'

then all is good now so we can do next steps:

modinfo ashmem_linux
modinfo binder_linux

then

modprobe ashmem_linux
modprobe binder_linux

and

lsmod | grep binder
lsmod | grep ashmem

and all problems is solved. I dont want to be pendantic here but i put the commands only because copy & paste is the best speedy solution even for console commands. And Midnight Commander is THE console king ... and mcedit How to switch the editor in mc from nano to mcedit is more better, SHIFT + INSERT hint hint, that nano or vim for fresh penguins

@djStolen
Copy link

djStolen commented Apr 4, 2020

I didn't find the original source anymore and don't know how to properly build a patch file, but here is what I did:

I replaced the lines in the file binder.c starting on line 3394:
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
static int binder_vm_fault(struct vm_fault *vmf)
#else
static int binder_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
#endif

with the following lines:
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)
static vm_fault_t binder_vm_fault(struct vm_fault *vmf)
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
static int binder_vm_fault(struct vm_fault *vmf)
#else
static int binder_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
#endif

then run 'make' again. (The 'ashmem' module needs to be built separately, but no errors there). The modules should be built then. Insert them with 'modprobe'.

Hi, I am getting
ls: cannot access '/dev/binder': No such file or directory

eventhough make is through, I installed it with checkinstall on Ubuntu and modprobe no compaints

@yozachar
Copy link

yozachar commented Oct 10, 2020

I tried everything in #21 (comment) But I'm still getting ls: cannot access '/dev/binder': No such file or directory.

Logs:

joe733 in ~/Downloads at xpsl502x 
➜ code /var/lib/dkms/anbox/1/source/binder/binder.c

joe733 in ~/Downloads at xpsl502x took 3s 
➜ sudo dkms autoinstall

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area...
'make' -j4 -C ashmem KERNEL_SRC=/lib/modules/5.4.0-48-generic/build && make -j4 -C binder KERNEL_SRC=/lib/modules/5.4.0-48-generic/build.....
cleaning build area...

DKMS: build completed.

ashmem_linux.ko:
Running module version sanity check.
 - Original module
   - Found /lib/modules/5.4.0-48-generic/kernel/drivers/staging/android/ashmem_linux.ko
   - Storing in /var/lib/dkms/anbox/original_module/5.4.0-48-generic/x86_64/
   - Archiving for uninstallation purposes
 - Installation
   - Installing to /lib/modules/5.4.0-48-generic/extra/

binder_linux.ko:
Running module version sanity check.
 - Original module
   - Found /lib/modules/5.4.0-48-generic/kernel/drivers/android/binder_linux.ko
   - Storing in /var/lib/dkms/anbox/original_module/5.4.0-48-generic/x86_64/
   - Archiving for uninstallation purposes
 - Installation
   - Installing to /lib/modules/5.4.0-48-generic/extra/

depmod.......

DKMS: install completed.

joe733 in ~/Downloads at xpsl502x took 22s 
➜ modinfo ashmem_linux
filename:       /lib/modules/5.4.0-48-generic/extra/ashmem_linux.ko
license:        GPL
srcversion:     12E29970BD9D45CA6A1D6B8
depends:        
retpoline:      Y
name:           ashmem_linux
vermagic:       5.4.0-48-generic SMP mod_unload 

joe733 in ~/Downloads at xpsl502x 
➜ modinfo binder_linux
filename:       /lib/modules/5.4.0-48-generic/extra/binder_linux.ko
license:        GPL v2
srcversion:     0983825193E99D7FE5A0EC1
depends:        
retpoline:      Y
name:           binder_linux
vermagic:       5.4.0-48-generic SMP mod_unload 
parm:           debug_mask:uint
parm:           proc_no_lock:bool
parm:           num_devices:int

joe733 in ~/Downloads at xpsl502x 
➜ modprobe ashmem_linux

joe733 in ~/Downloads at xpsl502x 
➜ modprobe binder_linux

joe733 in ~/Downloads at xpsl502x 
➜ lsmod | grep binder
binder_linux          176128  0

joe733 in ~/Downloads at xpsl502x 
➜ lsmod | grep ashmem
ashmem_linux           20480  0

joe733 in ~/Downloads at xpsl502x 
➜ ls -1 /dev/{ashmem,binder}
ls: cannot access '/dev/binder': No such file or directory
/dev/ashmem

Edit:
After a quick reboot the error disappeared.

@AlgerP572
Copy link

For centos 8 I needed to use the following:
(Note this was added to work for this particular kernel. i don't know if it should always be unsiged int for all centos kernel versions or just:
4.18.0-240.15.1.el8_3.x86_64

#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)
static vm_fault_t binder_vm_fault(struct vm_fault *vmf)
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0)
static unsigned int binder_vm_fault(struct vm_fault *vmf)
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
static int binder_vm_fault(struct vm_fault *vmf)
#else
static int binder_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
#endif

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants