Closed NobinPegasus closed 2 months ago
@Officeyutong This is getting built error freely on my local ubuntu 23.10. Not sure why it's throwing error on Checks.
The tests are using LLVM 15 if I'm not wrong. So why are they executing the if block, while in my local machine it's working as expected?
@NobinPegasus what are the options you are passing to build it locally?
@NobinPegasus what are the options you are passing to build it locally?
@hp77-creator I've tried
make build-llvm -j
I've also tried
make release JOBS=$(nproc) # Build and install the runtime
export PATH=$PATH:~/.bpftime
or
cmake -Bbuild -DCMAKE_BUILD_TYPE:STRING=Release \
-DSPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_INFO
cmake --build build --config Release --target install
export PATH=$PATH:~/.bpftime
All works fine
I tried with the same command that you mentioned, I am getting errors.
@Officeyutong This is getting built error freely on my local ubuntu 23.10. Not sure why it's throwing error on Checks.
The tests are using LLVM 15 if I'm not wrong. So why are they executing the if block, while in my local machine it's working as expected?
I'm also confused. But if you have more time, you may use https://github.com/marketplace/actions/debugging-with-ssh to debug github workflows online
I figured out the issue, seems at some place, you are using simple if where we should use #if
directives, there are couple of other places where you have used #if LLVM_MAJOR_VERSION
but haven't covered the cases where version is less than 17, you can make those changes and it will work fine then. I will see if I can commit here, else you can do it at your end @NobinPegasus
0001-preprocessor-directive-fix.patch
you can see this @NobinPegasus , apply this patch and add it to your PR. should work. I have also removed <llvm/Support/TargetRegistry>
my system was unable to find it and it was not processing correctly. you can see if its required or not and accordingly add or remove it.
you can download the patch and
do git apply 0001-preprocessor-directive-fix.patch
in your repo. test it on your system and let us know
@hp77-creator @Officeyutong What can be the probable cause?
[build-and-test (fedora-39, fedora, true, libbpf-tools/opensnoop, ./opensnoop, ./victim, true, ...] It now builds properly. But shows error on TestCLI
AGENT: JIT session error: Symbols not found: [ __lddw_helper_map_by_fd, __lddw_helper_map_val ]
AGENT: [2024-04-11 11:37:16][critical][1325] Unable to find symbol `bpf_main`: Failed to materialize symbols: { (main, { bpf_main }) }
AGENT: terminate called after throwing an instance of 'std::runtime_error'
AGENT: what(): Unable to link symbol `bpf_main`
AGENT:
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/__w/bpftime/bpftime/.github/script/run_example.py", line 112, in <module>
asyncio.get_event_loop().run_until_complete(main())
File "/usr/lib64/python3.12/asyncio/base_events.py", line 664, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/__w/bpftime/bpftime/.github/script/run_example.py", line 96, in main
await asyncio.wait_for(expected_str_signal.wait(), AGENT_TIMEOUT)
File "/usr/lib64/python3.12/asyncio/tasks.py", line [50](https://github.com/eunomia-bpf/bpftime/actions/runs/8645910782/job/23704474603?pr=276#step:10:51)9, in wait_for
async with timeouts.timeout(timeout):
File "/usr/lib64/python3.12/asyncio/timeouts.py", line 111, in __aexit__
raise TimeoutError from exc_val
TimeoutError
Error: Process completed with exit code 1.
Can u try running example programs on ur system after building it? Are you getting above errors on your system or did you observe that in the CI?
Can u try running example programs on ur system after building it? Are you getting above errors on your system or did you observe that in the CI?
pegasus@pegasus:~/Documents/bpftime/example/libbpf-tools/opensnoop$ python3 $ROOT/.github/script/run_example.py "./opensnoop" "./victim" " 0 test.txt" "/github/home/.bpftime/bpftime -i /github/home/.bpftime" 1
/home/pegasus/Documents/bpftime/.github/script/run_example.py:112: DeprecationWarning: There is no current event loop
asyncio.get_event_loop().run_until_complete(main())
cannot access local variable 'server' where it is not associated with a value
Traceback (most recent call last):
File "/home/pegasus/Documents/bpftime/.github/script/run_example.py", line 112, in <module>
asyncio.get_event_loop().run_until_complete(main())
File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.2_1/lib/python3.12/asyncio/base_events.py", line 685, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/pegasus/Documents/bpftime/.github/script/run_example.py", line 55, in main
server = await asyncio.subprocess.create_subprocess_exec(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.2_1/lib/python3.12/asyncio/subprocess.py", line 224, in create_subprocess_exec
transport, protocol = await loop.subprocess_exec(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.2_1/lib/python3.12/asyncio/base_events.py", line 1742, in subprocess_exec
transport = await self._make_subprocess_transport(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.2_1/lib/python3.12/asyncio/unix_events.py", line 211, in _make_subprocess_transport
transp = _UnixSubprocessTransport(self, protocol, args, shell,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.2_1/lib/python3.12/asyncio/base_subprocess.py", line 36, in __init__
self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,
File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.2_1/lib/python3.12/asyncio/unix_events.py", line 820, in _start
self._proc = subprocess.Popen(
^^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.2_1/lib/python3.12/subprocess.py", line 1026, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.2_1/lib/python3.12/subprocess.py", line 1953, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/github/home/.bpftime/bpftime'
@NobinPegasus
It looks like you are running the command for docker where the install is made inside /github
The default install of bpftime is made in ~/.bpftime/
You can try this instead
python3 $ROOT/.github/script/run_example.py "./opensnoop" "./victim" " 0 test.txt" "~/.bpftime/bpftime -i ~/.bpftime" 1
@hp77-creator @Officeyutong This is the error I'm facing
pegasus@pegasus:~/Documents/bpftime/example/libbpf-tools/opensnoop$ python3 $ROOT/.github/script/run_example.py "./opensnoop" "./victim" " 0 test.txt" "/home/pegasus/.bpftime/bpftime -i /home/pegasus/.bpftime" 1
/home/pegasus/Documents/bpftime/.github/script/run_example.py:112: DeprecationWarning: There is no current event loop
asyncio.get_event_loop().run_until_complete(main())
SERVER: [2024-04-12 16:24:32.503] [error] Program exited abnormally: 1
Traceback (most recent call last):
File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.2_1/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
return await fut
^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.2_1/lib/python3.12/asyncio/locks.py", line 212, in wait
await fut
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/pegasus/Documents/bpftime/.github/script/run_example.py", line 112, in <module>
asyncio.get_event_loop().run_until_complete(main())
File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.2_1/lib/python3.12/asyncio/base_events.py", line 685, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/pegasus/Documents/bpftime/.github/script/run_example.py", line 75, in main
await asyncio.wait_for(server_started_signal.wait(), SERVER_TIMEOUT)
File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.2_1/lib/python3.12/asyncio/tasks.py", line 519, in wait_for
async with timeouts.timeout(timeout):
File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.2_1/lib/python3.12/asyncio/timeouts.py", line 115, in __aexit__
raise TimeoutError from exc_val
TimeoutError
SERVER: [2024-04-12 16:24:32.503] [error] Program exited abnormally: 1
Your process injected with bpftime-server directly exited
SERVER: [2024-04-12 16:24:32.503] [error] Program exited abnormally: 1
SERVER: [2024-04-12 16:24:32.503] [error] Program exited abnormally: 1
Your process injected with bpftime-server directly exited
SERVER: [2024-04-12 16:24:32.503] [error] Program exited abnormally: 1
@Officeyutong I've seen the errors. But what might be the probable reason of this? Why is it happening?
SERVER: [2024-04-12 16:24:32.503] [error] Program exited abnormally: 1
Your process injected with bpftime-server directly exited
SERVER: [2024-04-12 16:24:32.503] [error] Program exited abnormally: 1
@Officeyutong I've seen the errors. But what might be the probable reason of this? Why is it happening?
It just indicates that your process injected with syscall-server exited abnormally. You may manually run that process with LD_PRELOAD=./build/runtime/syscall-server/libbpftime-syscall-server.so
, and execute the corresponding victim process as the example CI does, and check what happened
@Officeyutong no improvement happened.
pegasus@pegasus:~/Documents/bpftime/example/libbpf-tools/statsnoop$ python3 $ROOT/.github/script/run_example.py "./opensnoop" "./victim" " 0 test.txt" "/home/pegasus/.bpftime/bpftime -i /home/pegasus/.bpftime" 1
/home/pegasus/Documents/bpftime/.github/script/run_example.py:112: DeprecationWarning: There is no current event loop
asyncio.get_event_loop().run_until_complete(main())
SERVER: [2024-04-13 21:27:05.820] [error] Program exited abnormally: 1
SERVER:
Traceback (most recent call last):
File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.2_1/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
return await fut
^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.2_1/lib/python3.12/asyncio/locks.py", line 212, in wait
await fut
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/pegasus/Documents/bpftime/.github/script/run_example.py", line 112, in <module>
asyncio.get_event_loop().run_until_complete(main())
File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.2_1/lib/python3.12/asyncio/base_events.py", line 685, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/pegasus/Documents/bpftime/.github/script/run_example.py", line 75, in main
await asyncio.wait_for(server_started_signal.wait(), SERVER_TIMEOUT)
File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.2_1/lib/python3.12/asyncio/tasks.py", line 519, in wait_for
async with timeouts.timeout(timeout):
File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.2_1/lib/python3.12/asyncio/timeouts.py", line 115, in __aexit__
raise TimeoutError from exc_val
TimeoutError
@Officeyutong no improvement happened.
pegasus@pegasus:~/Documents/bpftime/example/libbpf-tools/statsnoop$ python3 $ROOT/.github/script/run_example.py "./opensnoop" "./victim" " 0 test.txt" "/home/pegasus/.bpftime/bpftime -i /home/pegasus/.bpftime" 1 /home/pegasus/Documents/bpftime/.github/script/run_example.py:112: DeprecationWarning: There is no current event loop asyncio.get_event_loop().run_until_complete(main()) SERVER: [2024-04-13 21:27:05.820] [error] Program exited abnormally: 1 SERVER: Traceback (most recent call last): File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.2_1/lib/python3.12/asyncio/tasks.py", line 520, in wait_for return await fut ^^^^^^^^^ File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.2_1/lib/python3.12/asyncio/locks.py", line 212, in wait await fut asyncio.exceptions.CancelledError The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/pegasus/Documents/bpftime/.github/script/run_example.py", line 112, in <module> asyncio.get_event_loop().run_until_complete(main()) File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.2_1/lib/python3.12/asyncio/base_events.py", line 685, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "/home/pegasus/Documents/bpftime/.github/script/run_example.py", line 75, in main await asyncio.wait_for(server_started_signal.wait(), SERVER_TIMEOUT) File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.2_1/lib/python3.12/asyncio/tasks.py", line 519, in wait_for async with timeouts.timeout(timeout): File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.2_1/lib/python3.12/asyncio/timeouts.py", line 115, in __aexit__ raise TimeoutError from exc_val TimeoutError
I think the callback trace gives better overview.
SERVER: [2024-04-12 21:13:27][info][1323] Global shm constructed. shm_open_type 0 for bpftime_maps_shm
SERVER: [2024-04-12 21:13:27][info][1323] Global shm initialized
SERVER: [2024-04-12 21:13:27][info][1323] Enabling helper groups ufunc, kernel, shm_map by default
SERVER: [2024-04-12 21:13:27][info][1323] bpftime-syscall-server started
Callback triggered
Server started!
Warning: 024-04-12 21:13:37.[36](https://github.com/eunomia-bpf/bpftime/actions/runs/8667912296/job/23772274502#step:10:37)7] [warning] Unable to determine home directory. You must specify --install-location
AGENT: [2024-04-12 21:13:[37](https://github.com/eunomia-bpf/bpftime/actions/runs/8667912296/job/23772274502#step:10:38).370] [info] [agent-transformer.cpp:37] Entering bpftime syscal transformer agent
AGENT: [2024-04-12 21:13:37.370] [info] [agent-transformer.cpp:68] Using agent /github/home/.bpftime/libbpftime-agent.so
AGENT: [2024-04-12 21:13:37.370] [info] [text_segment_transformer.cpp:246] Page zero setted up..
AGENT: [2024-04-12 21:13:37.370] [info] [text_segment_transformer.cpp:274] Rewriting executable segments..
AGENT: [2024-04-12 21:13:37.801] [info] [bpftime_shm_internal.cpp:658] Global shm constructed. shm_open_type 1 for bpftime_maps_shm
AGENT: [2024-04-12 21:13:37.801] [info] [bpftime_shm_internal.cpp:29] Global shm initialized
AGENT: [2024-04-12 21:13:37.801] [info] [bpf_attach_ctx.cpp:170] Register attach-impl defined helper bpf_get_func_arg, index 183
AGENT: [2024-04-12 21:13:37.801] [info] [bpf_attach_ctx.cpp:170] Register attach-impl defined helper bpf_get_func_ret_id, index 184
AGENT: [2024-04-12 21:13:37.801] [info] [bpf_attach_ctx.cpp:170] Register attach-impl defined helper bpf_get_retval, index 186
AGENT: [2024-04-12 21:13:37.801] [info] [agent.cpp:1[48](https://github.com/eunomia-bpf/bpftime/actions/runs/8667912296/job/23772274502#step:10:49)] Initializing agent..
AGENT: [2024-04-12 21:13:37][info][1325] Initializing llvm
AGENT: [2024-04-12 21:13:37][info][1325] Attach successfully
AGENT: [2024-04-12 21:13:37][info][1325] Agent syscall trace setup exiting..
AGENT: [2024-04-12 21:13:37.808] [info] [agent-transformer.cpp:98] Transformer exiting, trace will be usable now
AGENT: JIT session error: Symbols not found: [ __lddw_helper_map_by_fd, __lddw_helper_map_val ]
AGENT: [2024-04-12 21:13:37][critical][1325] Unable to find symbol `bpf_main`: Failed to materialize symbols: { (main, { bpf_main }) }
AGENT: terminate called after throwing an instance of 'std::runtime_error'
AGENT: what(): Unable to link symbol `bpf_main`
AGENT:
Error: Process completed with exit code 1.
But I'm not sure why it's unable to link symbol
@Officeyutong no improvement happened.
pegasus@pegasus:~/Documents/bpftime/example/libbpf-tools/statsnoop$ python3 $ROOT/.github/script/run_example.py "./opensnoop" "./victim" " 0 test.txt" "/home/pegasus/.bpftime/bpftime -i /home/pegasus/.bpftime" 1 /home/pegasus/Documents/bpftime/.github/script/run_example.py:112: DeprecationWarning: There is no current event loop asyncio.get_event_loop().run_until_complete(main()) SERVER: [2024-04-13 21:27:05.820] [error] Program exited abnormally: 1 SERVER: Traceback (most recent call last): File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.2_1/lib/python3.12/asyncio/tasks.py", line 520, in wait_for return await fut ^^^^^^^^^ File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.2_1/lib/python3.12/asyncio/locks.py", line 212, in wait await fut asyncio.exceptions.CancelledError The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/pegasus/Documents/bpftime/.github/script/run_example.py", line 112, in <module> asyncio.get_event_loop().run_until_complete(main()) File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.2_1/lib/python3.12/asyncio/base_events.py", line 685, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "/home/pegasus/Documents/bpftime/.github/script/run_example.py", line 75, in main await asyncio.wait_for(server_started_signal.wait(), SERVER_TIMEOUT) File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.2_1/lib/python3.12/asyncio/tasks.py", line 519, in wait_for async with timeouts.timeout(timeout): File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.2_1/lib/python3.12/asyncio/timeouts.py", line 115, in __aexit__ raise TimeoutError from exc_val TimeoutError
I think the callback trace gives better overview.
SERVER: [2024-04-12 21:13:27][info][1323] Global shm constructed. shm_open_type 0 for bpftime_maps_shm SERVER: [2024-04-12 21:13:27][info][1323] Global shm initialized SERVER: [2024-04-12 21:13:27][info][1323] Enabling helper groups ufunc, kernel, shm_map by default SERVER: [2024-04-12 21:13:27][info][1323] bpftime-syscall-server started Callback triggered Server started! Warning: 024-04-12 21:13:37.[36](https://github.com/eunomia-bpf/bpftime/actions/runs/8667912296/job/23772274502#step:10:37)7] [warning] Unable to determine home directory. You must specify --install-location AGENT: [2024-04-12 21:13:[37](https://github.com/eunomia-bpf/bpftime/actions/runs/8667912296/job/23772274502#step:10:38).370] [info] [agent-transformer.cpp:37] Entering bpftime syscal transformer agent AGENT: [2024-04-12 21:13:37.370] [info] [agent-transformer.cpp:68] Using agent /github/home/.bpftime/libbpftime-agent.so AGENT: [2024-04-12 21:13:37.370] [info] [text_segment_transformer.cpp:246] Page zero setted up.. AGENT: [2024-04-12 21:13:37.370] [info] [text_segment_transformer.cpp:274] Rewriting executable segments.. AGENT: [2024-04-12 21:13:37.801] [info] [bpftime_shm_internal.cpp:658] Global shm constructed. shm_open_type 1 for bpftime_maps_shm AGENT: [2024-04-12 21:13:37.801] [info] [bpftime_shm_internal.cpp:29] Global shm initialized AGENT: [2024-04-12 21:13:37.801] [info] [bpf_attach_ctx.cpp:170] Register attach-impl defined helper bpf_get_func_arg, index 183 AGENT: [2024-04-12 21:13:37.801] [info] [bpf_attach_ctx.cpp:170] Register attach-impl defined helper bpf_get_func_ret_id, index 184 AGENT: [2024-04-12 21:13:37.801] [info] [bpf_attach_ctx.cpp:170] Register attach-impl defined helper bpf_get_retval, index 186 AGENT: [2024-04-12 21:13:37.801] [info] [agent.cpp:1[48](https://github.com/eunomia-bpf/bpftime/actions/runs/8667912296/job/23772274502#step:10:49)] Initializing agent.. AGENT: [2024-04-12 21:13:37][info][1325] Initializing llvm AGENT: [2024-04-12 21:13:37][info][1325] Attach successfully AGENT: [2024-04-12 21:13:37][info][1325] Agent syscall trace setup exiting.. AGENT: [2024-04-12 21:13:37.808] [info] [agent-transformer.cpp:98] Transformer exiting, trace will be usable now AGENT: JIT session error: Symbols not found: [ __lddw_helper_map_by_fd, __lddw_helper_map_val ] AGENT: [2024-04-12 21:13:37][critical][1325] Unable to find symbol `bpf_main`: Failed to materialize symbols: { (main, { bpf_main }) } AGENT: terminate called after throwing an instance of 'std::runtime_error' AGENT: what(): Unable to link symbol `bpf_main` AGENT: Error: Process completed with exit code 1.
But I'm not sure why it's unable to link symbol
It says Symbols not found: [ __lddw_helper_map_by_fd, __lddw_helper_map_val ]
. These symbols are defined by calling hhttps://github.com/NobinPegasus/bpftime/blob/5e701ca5f30c34e38a7148f54f246f83bb4cf5d4/vm/llvm-jit/src/llvm/llvm_jit_context.cpp#L457
Seems you have modified this function and symbols of lddw helpers functions are added into extSymbols
, but another map named lddwSymbols
are used at https://github.com/NobinPegasus/bpftime/blob/5e701ca5f30c34e38a7148f54f246f83bb4cf5d4/vm/llvm-jit/src/llvm/llvm_jit_context.cpp#L485
@Officeyutong Thanks. How did I do this typo... It's solved now.
Thank you!
Description
This resolves the issue of build error of bpftime with LLVM VERSION > 16.
Fixes #268
Type of change
How Has This Been Tested?
I've built the tool locally after making the changes.
Test Configuration:
Checklist