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

bcc_elf: mkostemp() requires _GNU_SOURCE #1

Open
wants to merge 1 commit into
base: fix/speeed
Choose a base branch
from

Conversation

luisgerhorst
Copy link

As per mkostemps(3), mkostemp() (used in line 842) requires _GNU_SOURCE. Therefore define it before the includes if it not defined by the env/compiler. Otherwise I encounter the following error on my system:

...
-- Configuring done (0.3s)
-- Generating done (0.0s)
-- Build files have been written to: /.../pyroscope/third_party/bcc/src/build
make[3]: Entering directory `/.../pyroscope/third_party/bcc/src/build'
make[4]: Entering directory `/.../pyroscope/third_party/bcc/src/build'
make[5]: Entering directory `/.../pyroscope/third_party/bcc/src/build'
make[5]: Entering directory `/.../pyroscope/third_party/bcc/src/build'
make[5]: Leaving directory `/.../pyroscope/third_party/bcc/src/build'
make[5]: Leaving directory `/.../pyroscope/third_party/bcc/src/build'
make[5]: Entering directory `/.../pyroscope/third_party/bcc/src/build'
make[5]: Entering directory `/.../pyroscope/third_party/bcc/src/build'
[  8%] Building CXX object CMakeFiles/bcc-syms.dir/.../pyroscope/third_party/bcc/src/src/cc/bcc_syms.o
[ 16%] Building C object CMakeFiles/bcc-syms-static.dir/.../pyroscope/third_party/bcc/src/src/cc/bcc_elf.o
[ 25%] Building C object CMakeFiles/bcc-syms-static.dir/.../pyroscope/third_party/bcc/src/src/cc/bcc_perf_map.o
[ 33%] Building C object CMakeFiles/bcc-syms-static.dir/.../pyroscope/third_party/bcc/src/src/cc/bcc_proc.o
[ 41%] Building CXX object CMakeFiles/bcc-syms-static.dir/.../pyroscope/third_party/bcc/src/src/cc/bcc_syms.o
[ 50%] Building C object CMakeFiles/bcc-syms.dir/.../pyroscope/third_party/bcc/src/src/cc/bcc_elf.o
[ 58%] Building C object CMakeFiles/bcc-syms.dir/.../pyroscope/third_party/bcc/src/src/cc/bcc_perf_map.o
[ 66%] Building CXX object CMakeFiles/bcc-syms-static.dir/.../pyroscope/third_party/bcc/src/src/cc/common.o
[ 75%] Building C object CMakeFiles/bcc-syms.dir/.../pyroscope/third_party/bcc/src/src/cc/bcc_proc.o
[ 83%] Building CXX object CMakeFiles/bcc-syms.dir/.../pyroscope/third_party/bcc/src/src/cc/common.o
/.../pyroscope/third_party/bcc/src/src/cc/bcc_elf.c:839:8: error: call to undeclared function 'mkostemp'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  fd = mkostemp(tmpfile, O_CLOEXEC);
       ^
/.../pyroscope/third_party/bcc/src/src/cc/bcc_elf.c:839:8: note: did you mean 'mkstemp'?
/usr/include/stdlib.h:570:12: note: 'mkstemp' declared here
extern int mkstemp (char *__template) __nonnull ((1)) __wur;
           ^
/.../pyroscope/third_party/bcc/src/src/cc/bcc_elf.c:839:8: error: call to undeclared function 'mkostemp'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  fd = mkostemp(tmpfile, O_CLOEXEC);
       ^
/.../pyroscope/third_party/bcc/src/src/cc/bcc_elf.c:839:8: note: did you mean 'mkstemp'?
/usr/include/stdlib.h:570:12: note: 'mkstemp' declared here
extern int mkstemp (char *__template) __nonnull ((1)) __wur;
           ^
1 error generated.
make[5]: *** [CMakeFiles/bcc-syms-static.dir/.../pyroscope/third_party/bcc/src/src/cc/bcc_elf.o] Error 1
make[5]: *** Waiting for unfinished jobs....
1 error generated.
make[5]: *** [CMakeFiles/bcc-syms.dir/.../pyroscope/third_party/bcc/src/src/cc/bcc_elf.o] Error 1
make[5]: *** Waiting for unfinished jobs....
make[5]: Leaving directory `/.../pyroscope/third_party/bcc/src/build'
make[4]: *** [CMakeFiles/bcc-syms.dir/all] Error 2
make[4]: *** Waiting for unfinished jobs....
make[5]: Leaving directory `/.../pyroscope/third_party/bcc/src/build'
make[4]: *** [CMakeFiles/bcc-syms-static.dir/all] Error 2
make[4]: Leaving directory `/.../pyroscope/third_party/bcc/src/build'
make[3]: *** [all] Error 2
make[3]: Leaving directory `/.../pyroscope/third_party/bcc/src/build'
make[2]: *** [build-bcc] Error 2
make[2]: Leaving directory `/.../pyroscope/third_party/bcc'
make[1]: *** [build-bcc] Error 2

I noticed that this is still not fixed in upstream bcc v0.27. However, updating (and rebasing) the bcc version used by pyroscope caused a buch of other errors on my system. Should I instead upstream the fix and then create a pull request to update the bcc version used by pyroscope?

@luisgerhorst
Copy link
Author

On Slack, @korniltsev pointed out that this will be obsolete when grafana/agent#3953 is done (which does not use bcc). Still leaving this here for reference.

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

Successfully merging this pull request may close these issues.

1 participant