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

/bpftrace/include/clang_workarounds.h:14:10: fatal error: 'linux/types.h' file not found #182

Open
stevenlee87 opened this issue Jan 20, 2022 · 5 comments

Comments

@stevenlee87
Copy link

cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)

Kubernetes version v1.16.15

When I type the following command:
kubectl-trace run node/node1 -f tcpconnect.bt (https://github.com/iovisor/bpftrace/blob/master/tools/tcpconnect.bt)
trace e7bf7257-8d7f-4003-b035-fb47b553b978 created

kubectl-trace logs e7bf7257-8d7f-4003-b035-fb47b553b978
if your program has maps to print, send a SIGINT using Ctrl-C, if you want to interrupt the execution send SIGINT two times
/bpftrace/include/clang_workarounds.h:14:10: fatal error: 'linux/types.h' file not found
exit status 1

@startstorm
Copy link

I met the same thing.

my OS is centos7.9 , I use the docker image of bpftace.
image name " quay.io/iovisor/bpftrace:latest".

run this docker images with command
docker run -ti -v /usr/src:/usr/src:ro \ -v /lib/modules/:/lib/modules:ro \ -v /sys/kernel/debug/:/sys/kernel/debug:rw \ --net=host --pid=host --privileged \ quay.io/iovisor/bpftrace:latest

and insert bpftrace command in docker console
bpftrace -e 'BEGIN {printf("hello world!\n");}'

the console show /bpftrace/include/clang_workarounds.h:14:10; fatal error: 'linux/types.h' file not found

but But the docker image works normally on another centos7.9 machine .
It's amazing

@foobaar
Copy link

foobaar commented Jun 23, 2023

I had to do ln -sf /usr-host/include /usr/include for trace to work for me. I did not use --fetch-headers

@yahetw
Copy link

yahetw commented May 24, 2024

CentOS7 try install i686 components of GCC.
yum install libgcc.i686 glibc-devel.i686

It works for me.

@punmin
Copy link

punmin commented Jul 24, 2024

cat > patch.json << EOF
[
{
"op": "add",
"path": "/spec/template/spec/volumes/-",
"value": {
"name": "include-host",
"hostPath": {
"type": "",
"path": "/usr/include"
}
}
},
{
"op": "add",
"path": "/spec/template/spec/containers/0/volumeMounts/-",
"value": {
"name": "include-host",
"mountPath": "/usr/include",
"readOnly": true
}
}
]
EOF
kubectl trace run node/<node_name> -e "tracepoint:syscalls:sys_enter_open { @[probe] = count(); }" --patch patch.json --patch-type json

kernel version: 5.10.218-208.862.amzn2.x86_64

It works for me.

@anshulahuja98
Copy link

anshulahuja98 commented Sep 10, 2024

hitting the same issue in AKS running AzureLinux
The above suggested patch not working

Update - works for Ubuntu with patch

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

No branches or pull requests

6 participants