Skip to content
This repository has been archived by the owner on Apr 27, 2023. It is now read-only.

Problem during the make all step #12

Open
1nd0 opened this issue Oct 9, 2019 · 17 comments
Open

Problem during the make all step #12

1nd0 opened this issue Oct 9, 2019 · 17 comments

Comments

@1nd0
Copy link

1nd0 commented Oct 9, 2019

I am running into the following issue when doing the make process.

make[1]: Entering directory /home/vagrant/net-next' CALL scripts/checksyscalls.sh CALL scripts/atomic/check-atomics.sh DESCEND objtool make[5]: *** No rule to make target kernel/bpf/linux_hook.i'. Stop.
make[4]: *** [__build] Error 2
make[3]: *** [kernel/bpf] Error 2
make[2]: *** [kernel] Error 2
make[1]: *** [sub-make] Error 2
make[1]: Leaving directory `/home/vagrant/net-next'
make: *** [test_hook] Error 2

@yonghong-song
Copy link
Collaborator

@1nd0 could you help debug this a little bit further?

@1nd0
Copy link
Author

1nd0 commented Oct 10, 2019

@yonghong-song I sure can what information would you like me to provide.

@yonghong-song
Copy link
Collaborator

I did not look at the issue yet. Just to find how to fix the issue you have.

@1nd0
Copy link
Author

1nd0 commented Oct 10, 2019

Ill dig into net-next to see if that is where the issue is. I am guessing things have changed a bit.

@1nd0
Copy link
Author

1nd0 commented Oct 10, 2019

It looks like in your make file you are doing

cd $(KERNEL_TREE_ROOT); make HOSTCC=clang CC=clang kernel/bpf/verifier.i kernel/bpf/linux_hook.i

This is causing make to use the make file in the net-next dir try to build the linux hook but it doesnt have any instructions on how to build it.

@1nd0
Copy link
Author

1nd0 commented Oct 11, 2019

@yonghong-song Do you know what version of the kernel you where using the tool on ?

@yonghong-song
Copy link
Collaborator

I have tried very early version around 4.6, I think. But I think it does not make sense to go back at this stage. If you are interested, feel free to look at the new kernel versions. It is possible that some new hooks need to be added.

@1nd0
Copy link
Author

1nd0 commented Oct 14, 2019

@yonghong-song So we fixed the initial issue by hard copying the linux_hook.c file into the net_next/kernel/bpf/ folder now we are running into issues building the test_verifier. looks like during the make is trying to call ARG_PTR_TO_STACK that was renamed quite awhile ago.

@yonghong-song
Copy link
Collaborator

Thanks for improving this. I indeed have not worked on this for quite a while.

@AzadaShams
Copy link

AzadaShams commented Feb 21, 2020

I am also getting a similar error running the Makefile through "make all " command.

cd /home/azada/net-next2/net-next; make HOSTCC=clang CC=clang kernel/bpf/verifier.i kernel/bpf/linux_hook.i
make[1]: Entering directory '/home/azada/net-next2/net-next'
Compiler lacks asm-goto support.
arch/x86/Makefile:302: recipe for target 'checkbin' failed
make[1]: *** [checkbin] Error 1
make[1]: Leaving directory '/home/azada/net-next2/net-next'
Makefile:37: recipe for target 'test_hook' failed
make: *** [test_hook] Error 2
I am using Kernel version 4.15.
What is the solution? could someone please reply it as soon as possible!

@yonghong-song
Copy link
Collaborator

For

 Compiler lacks asm-goto support.

error message, could you try clang9 which has asm goto support?

@PavithraKrishnaA
Copy link

@yonghong-song : Thanks , yes upgrading to clang 9 had solved our issue of asm goto .
Now we are stuck with the same error mentioned at the beginning of this issue . And even hardcopying (which i believe is creating a hard link) does not solve the issue .
Could you please help with what can be done

@yonghong-song
Copy link
Collaborator

The error mostly due to kernel code change. So some hook change might be needed for your 4.15 kernel as kernel verifier change heavily affects this.

@PavithraKrishnaA
Copy link

Thanks I am looking into it now ,
@1nd0 : Could you please tell which kernel version you used and does hard copying mean making a copy of the file linux hook .c into the mentioned path ? And does it mean I have to skip certain lines in existing Makefile? Could you please elaborate ?

@PavithraKrishnaA
Copy link

@yonghong-song : Now i believe that i fixed the changes needed in test verifier . And it compiles.But i am getting undefined references during linking for the ones in verifier.c .Could you please point out if i have to add the definitions in linux hook .c (or) am i doing something wrong with the previous steps

@yonghong-song
Copy link
Collaborator

I guess, you will have to add some missing hooks. Some newer kernels will have additional hooks which need to be implemented.

@sanjit-bhat
Copy link

sanjit-bhat commented Jan 12, 2021

Re: the original question, the Linux developers changed the kernel build system for single target builds. With their change, things like make kernel/bpf/verifier.i won't work by default. See this discussion on the kernel mailing list for more details.

As a workaround, you have to add single target builds to the obj-y or obj-m variables in the Makefiles. After that, the above make command should work after re-generating the config files. Here's my diff:

--- a/kernel/bpf/Makefile
+++ b/kernel/bpf/Makefile
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
-obj-y := core.o
+obj-y := core.o verifier.o linux_hook.o
 CFLAGS_core.o += $(call cc-disable-warning, override-init)

 obj-$(CONFIG_BPF_SYSCALL) += syscall.o verifier.o inode.o helpers.o tnum.o```

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

5 participants