Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failed to compile using falco-builder container + eBPF #931

Closed
2rigor opened this issue Nov 21, 2019 · 14 comments
Closed

failed to compile using falco-builder container + eBPF #931

2rigor opened this issue Nov 21, 2019 · 14 comments
Labels
needs-kind triage/duplicate Indicates an issue is a duplicate of other open issue.

Comments

@2rigor
Copy link

2rigor commented Nov 21, 2019

Hello.
I was trying to build using using falco-builder container

  1. clone falco and sysdig to /home/user/src/
  2. Added -e BUILD_BPF=ON to compilation command and mapped /lib/modules/uname -r/build
    cmake:

docker run --user $(id -u):$(id -g) -v /etc/passwd:/etc/passwd:ro -e MAKE_JOBS=4 -e BUILD_BPF=ON -it -v /home/user/src:/source -v /home/user/build/falco:/build -v /lib/modules/uname -r/build:/lib/modules/uname -r/build falcosecurity/falco-builder cmake

  1. Added -e BUILD_BPF=ON to compilation command and mapped /lib/modules/uname -r/build and ran
    docker run --user $(id -u):$(id -g) -v /etc/passwd:/etc/passwd:ro -e MAKE_JOBS=4 -e BUILD_BPF=ON -it -v /home/user/src:/source -v /home/user/build/falco:/build -v /lib/modules/uname -r/build:/lib/modules/uname -r/build falcosecurity/falco-builder package

It fails to build ebpf module:

Scanning dependencies of target bpf
[ 55%] Built target docker-local-rule-list_sub_front.yaml
make[3]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
[ 56%] Built target docker-local-rule-invalid_missing_macro_name.yaml
make[4]: *** /lib/modules/5.0.0-36-generic/build: No such file or directory.  Stop.
make[3]: *** [Makefile:18: all] Error 2
make[2]: *** [driver/bpf/CMakeFiles/bpf.dir/build.make:57: driver/bpf/CMakeFiles/bpf] Error 2
make[1]: *** [CMakeFiles/Makefile2:7203: driver/bpf/CMakeFiles/bpf.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 58%] Built target catch2
[ 62%] Built target scap
[ 64%] Built target fakeit-external
make: *** [Makefile:150: all] Error 2

Any ideas?
Thanks in advance.
P.S. If instead of opening an issue I should have done anything different - please tell me

@poiana
Copy link
Contributor

poiana commented Nov 21, 2019

@2rigor: There is not a label identifying the kind of this issue.
Please specify it either using /kind <group> or manually from the side menu.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@leodido
Copy link
Member

leodido commented Nov 21, 2019

/triage support

@2rigor
Copy link
Author

2rigor commented Nov 21, 2019

Hello.
I was trying to build using using falco-builder container

  1. clone falco and sysdig to /home/user/src/
  2. Added -e BUILD_BPF=ON to compilation command and mapped /lib/modules/uname -r/build
    cmake:

docker run --user $(id -u):$(id -g) -v /etc/passwd:/etc/passwd:ro -e MAKE_JOBS=4 -e BUILD_BPF=ON -it -v /home/user/src:/source -v /home/user/build/falco:/build -v /lib/modules/uname -r/build:/lib/modules/uname -r/build falcosecurity/falco-builder cmake

  1. Added -e BUILD_BPF=ON to compilation command and mapped /lib/modules/uname -r/build and ran
    docker run --user $(id -u):$(id -g) -v /etc/passwd:/etc/passwd:ro -e MAKE_JOBS=4 -e BUILD_BPF=ON -it -v /home/user/src:/source -v /home/user/build/falco:/build -v /lib/modules/uname -r/build:/lib/modules/uname -r/build falcosecurity/falco-builder package

It fails to build ebpf module:

Scanning dependencies of target bpf
[ 55%] Built target docker-local-rule-list_sub_front.yaml
make[3]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
[ 56%] Built target docker-local-rule-invalid_missing_macro_name.yaml
make[4]: *** /lib/modules/5.0.0-36-generic/build: No such file or directory.  Stop.
make[3]: *** [Makefile:18: all] Error 2
make[2]: *** [driver/bpf/CMakeFiles/bpf.dir/build.make:57: driver/bpf/CMakeFiles/bpf] Error 2
make[1]: *** [CMakeFiles/Makefile2:7203: driver/bpf/CMakeFiles/bpf.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 58%] Built target catch2
[ 62%] Built target scap
[ 64%] Built target fakeit-external
make: *** [Makefile:150: all] Error 2

Any ideas?
Thanks in advance.
P.S. If instead of opening an issue I should have done anything different - please tell me

Not sure if relevant, but:

root@ubuntu107:/home/aa/falco# cat /etc/os-release 
NAME="Ubuntu"
VERSION="18.04.2 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.2 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

root@ubuntu:/home/aa/falco# uname -a
Linux ubuntu107 5.0.0-36-generic #39~18.04.1-Ubuntu SMP Tue Nov 12 11:09:50 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

@2rigor 2rigor closed this as completed Nov 21, 2019
@2rigor 2rigor reopened this Nov 21, 2019
@2rigor
Copy link
Author

2rigor commented Nov 21, 2019

Apologize for the mess..

@2rigor
Copy link
Author

2rigor commented Nov 25, 2019

/kind ebpf_compilation

@fntlnz
Copy link
Contributor

fntlnz commented Nov 25, 2019

Thanks for opening 2rigor ! Even if you are in a container, compiling the BPF probe is very tied to the actual host machine kernel ABI and hence it’s headers. From what I can see it looks like you are missing the kernel headers on your host machine.

If your host machine is an Ubuntu (I’m inferring this from what you posted) you can achieve that by installing them and then retry the build :

sudo apt install linux-headers-$(uname -r)

@2rigor
Copy link
Author

2rigor commented Nov 26, 2019

@fntlnz thanks a lot!
I was already compiling ebfp on this machine.
In any case I've run

sudo apt install linux-headers-$(uname -r)
as well as
sudo apt-get install build-essential llvm clang

BTW, I also found I need to map /lib/modules (not not just /lib/modules/uname -r/build) for the container. The command I run now is:
docker run --user $(id -u):$(id -g) -v /etc/passwd:/etc/passwd:ro -e BUILD_BPF=ON -it -v /home/user/src:/source -v /home/user/build/falco:/build -v /lib/modules:/lib/modules -v /usr/src:/usr/src falcosecurity/falco-builder package

It fails (the above command didn't help) at not finding clang.

@fntlnz
Copy link
Contributor

fntlnz commented Nov 27, 2019

@2rigor i didn’t understand, did it work for you or not ? If it didn’t can you please post the logs ?

@fntlnz
Copy link
Contributor

fntlnz commented Nov 29, 2019

@2rigor - Good news! So the only missing problem you have is that you can't find clang right? Should we add it to the falco builder? It makes sense to me.

@2rigor
Copy link
Author

2rigor commented Nov 29, 2019

After adding (mapping) clang, i had some libraries missing. After mapping them, the version of some libraries was too old, so I started to change LD_LIBRARY_PATH, but didn't succeed.
I feel I'm doing smth. wrong.. Any ideas?

Do you need logs? I will be able to post them on Sunday

@fntlnz thanks a lot in advance!

@fntlnz
Copy link
Contributor

fntlnz commented Nov 29, 2019

Yes those would speed up things @2rigor - maybe it’s something we already know!

The builder container is very “complicated” and needs some love to update the tool chains, if we can’t sort this out we could also have one specific for the eBPF probe.

@2rigor
Copy link
Author

2rigor commented Dec 5, 2019

I wanted to repeat all the steps I did from the very beginning, so I've installed Ubuntu from scratch.
Also due to errors I get I add mapping for /lib/modules/ and for /usr/src/ (the latter since /lib/modules/5.3.0-23-generic/build -> /usr/src/linux-headers-5.3.0-23-generic)

This time I installed 19.10 (previously it was 18.04).
I executed:
sudo apt install build-essential cmake autoconf wget automake patch elfutils libelf-dev pkg-config libtool linux-headers-$(uname -r) llvm clang > cmake_bpf.txt

Then, after cloning falco and sysdig sources to /home/aa/src, I ran:
docker run --user $(id -u):$(id -g) -v /etc/passwd:/etc/passwd:ro -it -v /home/aa/src:/source -v /home/aa/build_ebpf/falco:/build -e BUILD_BPF=ON -e HTTP_PROXY=http://194.29.36.43:8080 -e HTTPS_PROXY=http://194.29.36.43:8080 -v /lib/modules/:/lib/modules/ -v /usr/src/:/usr/src falcosecurity/falco-builder package > package_bpf.txt

Attached /etc/os-release content, cmake_bpf.txt and package_bpf.txt.
os-release.txt
cmake_bpf.txt
package_bpf.txt

Here the problem was missing clang. Then I tried to map directories relevant for clang playing with PATH and LD_LIBRARY_PATH - but it did not work..

How can I install clang and then start "package"?

@fntlnz
Copy link
Contributor

fntlnz commented Dec 5, 2019

I know that @jalseth is working on this on his issue #900 - I've been able to install clang on the bpf builder using the llvm-toolset-7 package but let's wait for @jalseth to submit a PR.

In the meanwhile, since this issue is newer and duplicated let's keep the conversation on #900 and close this.

Thanks @2rigor for all the details, feel free to continue the conversation on #900 - we will certainly need your feedback again once the docker image is updated.

/triage duplicate
/close

@poiana
Copy link
Contributor

poiana commented Dec 5, 2019

@fntlnz: Closing this issue.

In response to this:

I know that @jalseth is working on this on his issue #900 - I've been able to install clang on the bpf builder using the llvm-toolset-7 package but let's wait for @jalseth to submit a PR.

In the meanwhile, since this issue is newer and duplicated let's keep the conversation on #900 and close this.

Thanks @2rigor for all the details, feel free to continue the conversation on #900 - we will certainly need your feedback again once the docker image is updated.

/triage duplicate
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@poiana poiana added the triage/duplicate Indicates an issue is a duplicate of other open issue. label Dec 5, 2019
@poiana poiana closed this as completed Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-kind triage/duplicate Indicates an issue is a duplicate of other open issue.
Projects
None yet
Development

No branches or pull requests

4 participants