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

Unable to compile with CLANG+LLVM under toolchain (clang+musl) #61

Closed
Cerberios opened this issue Dec 20, 2021 · 2 comments
Closed

Unable to compile with CLANG+LLVM under toolchain (clang+musl) #61

Cerberios opened this issue Dec 20, 2021 · 2 comments

Comments

@Cerberios
Copy link

Hello there!
I am unable to compile LVM2 under Gentoo with GCC-free toolchain (clang+musl).

CBUILD="x86_64-gentoo-linux-musl"
CHOST="x86_64-gentoo-linux-musl"
CC="clang"
CFLAGS="-O2 -march=native -mtune=corei7 -pipe"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -Wl,--as-needed -Wl,-z,relro,-z,now -pie"

Getting alot of errors (please, see below)

daemon-server.c:248:6: warning: implicit declaration of function 'fcntl' is invalid in C99 [-Wimplicit-function-declaration]
if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK))
^
daemon-server.c:248:16: error: use of undeclared identifier 'F_SETFL'
if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK))
^
daemon-server.c:248:35: error: use of undeclared identifier 'F_GETFL'
if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK))
^
daemon-server.c:248:49: error: use of undeclared identifier 'O_NONBLOCK'
if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK))
^
daemon-server.c:335:12: warning: implicit declaration of function 'open' is invalid in C99 [-Wimplicit-function-declaration]
if ((fd = open("/dev/null", O_RDWR)) == -1) {
^
daemon-server.c:335:30: error: use of undeclared identifier 'O_RDWR'
if ((fd = open("/dev/null", O_RDWR)) == -1) {
^
daemon-server.c:520:6: warning: implicit declaration of function 'fcntl' is invalid in C99 [-Wimplicit-function-declaration]
if (fcntl(client.socket_fd, F_SETFD, FD_CLOEXEC))
^
daemon-server.c:520:30: error: use of undeclared identifier 'F_SETFD'
if (fcntl(client.socket_fd, F_SETFD, FD_CLOEXEC))
^
daemon-server.c:520:39: error: use of undeclared identifier 'FD_CLOEXEC'
if (fcntl(client.socket_fd, F_SETFD, FD_CLOEXEC))
^
daemon-server.c:641:17: warning: implicit declaration of function 'fcntl' is invalid in C99 [-Wimplicit-function-declaration]
if (!failed && fcntl(s.socket_fd, F_SETFD, 1))
^
daemon-server.c:641:36: error: use of undeclared identifier 'F_SETFD'
if (!failed && fcntl(s.socket_fd, F_SETFD, 1))
^

Please, provide some patch of instruction how to resolve this issue.
Thanks!

@zkabelac
Copy link
Contributor

zkabelac commented Feb 6, 2022

Maybe try to add this header file into problematic file:

#include <fcntl.h>

jollaitbot pushed a commit to sailfishos-mirror/lvm2 that referenced this issue Feb 16, 2022
Try to help resolving reported compilation problem with
clang & musl C.
lvmteam/lvm2#61
@zkabelac
Copy link
Contributor

Closing as assuming it has helped.

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

2 participants