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

[logger] + add missing header fcntl.h #3958

Merged
merged 1 commit into from
Jul 14, 2023

Conversation

mister-good-deal
Copy link
Contributor

Trying to compile the project in a docker alpine environment using GCC 13.1.1 and got the following error:

× Building wheel for codechecker (pyproject.toml) did not run successfully.
11.35   │ exit code: 1
11.35   ╰─> [29 lines of output]
11.35       running bdist_wheel
11.35       running build
11.35       running build_ext
11.35       building 'codechecker_analyzer.ld_logger.lib.ldlogger' extension
11.35       creating build
11.35       creating build/temp.linux-x86_64-cpython-311
11.35       creating build/temp.linux-x86_64-cpython-311/analyzer
11.35       creating build/temp.linux-x86_64-cpython-311/analyzer/tools
11.35       creating build/temp.linux-x86_64-cpython-311/analyzer/tools/build-logger
11.35       creating build/temp.linux-x86_64-cpython-311/analyzer/tools/build-logger/src
11.35       gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -D__LOGGER_MAIN__ -D_GNU_SOURCE -I/usr/include/python3.11 -c analyzer/tools/build-logger/src/ldlogger-hooks.c -o build/temp.linux-x86_64-cpython-311/analyzer/tools/build-logger/src/ldlogger-hooks.o
11.35       analyzer/tools/build-logger/src/ldlogger-hooks.c: In function 'unsetLDPRELOAD':
11.35       analyzer/tools/build-logger/src/ldlogger-hooks.c:46:64: warning: the comparison will always evaluate as 'true' for the pointer operand in 'pos + -1' must not be NULL [-Waddress]
11.35          46 |     if ((prefix_length == pos_number) && ( pos_number == 0 || (pos-1 && *--pos == '/')))
11.35             |                                                                ^~~
11.35       gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -D__LOGGER_MAIN__ -D_GNU_SOURCE -I/usr/include/python3.11 -c analyzer/tools/build-logger/src/ldlogger-logger.c -o build/temp.linux-x86_64-cpython-311/analyzer/tools/build-logger/src/ldlogger-logger.o
11.35       analyzer/tools/build-logger/src/ldlogger-logger.c: In function 'logExec':
11.35       analyzer/tools/build-logger/src/ldlogger-logger.c:214:11: warning: implicit declaration of function 'open'; did you mean 'popen'? [-Wimplicit-function-declaration]
11.35         214 |   logFd = open(logFileEnv, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
11.35             |           ^~~~
11.35             |           popen
11.35       analyzer/tools/build-logger/src/ldlogger-logger.c:214:28: error: 'O_CREAT' undeclared (first use in this function)
11.35         214 |   logFd = open(logFileEnv, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
11.35             |                            ^~~~~~~
11.35       analyzer/tools/build-logger/src/ldlogger-logger.c:214:28: note: each undeclared identifier is reported only once for each function it appears in
11.35       analyzer/tools/build-logger/src/ldlogger-logger.c:214:38: error: 'O_RDWR' undeclared (first use in this function)
11.35         214 |   logFd = open(logFileEnv, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
11.35             |                                      ^~~~~~
11.35       error: command '/usr/bin/gcc' failed with exit code 1
11.35       [end of output]

I do not know if the issue was the GCC 13.1.1 is now more restrictive on missing include or a alpine musl stuff but adding <fcntl.h> header fixed the issue.

It is required to use open function.

@bruntib
Copy link
Contributor

bruntib commented Jul 14, 2023

Thanks for the improvement, nice catch!

@bruntib bruntib merged commit b93641e into Ericsson:master Jul 14, 2023
8 checks passed
@whisperity whisperity added bug 🐛 dev env ⛑️ Development environment tools 🛠️ Meta-tag for all the additional tools supplied with CodeChecker: plist2html, tu_collector, etc. ld-logger 📃 labels Jul 14, 2023
@bruntib bruntib added this to the release 6.23.0 milestone Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 dev env ⛑️ Development environment ld-logger 📃 tools 🛠️ Meta-tag for all the additional tools supplied with CodeChecker: plist2html, tu_collector, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants