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

Build fails on Android using Clang 16 (termux) #579

Open
orowith2os opened this issue May 4, 2023 · 8 comments
Open

Build fails on Android using Clang 16 (termux) #579

orowith2os opened this issue May 4, 2023 · 8 comments

Comments

@orowith2os
Copy link

orowith2os commented May 4, 2023

I installed all of the appropriate dependencies for building, save for libselinux. Everything goes well until I get to building bubblewrap. Here is the output:

~/oro/bubblewrap $ meson compile -C _builddir
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: /data/data/com.termux/files/usr/bin/ninja -C /data/data/com.termux/files/home/oro/bubblewrap/_builddir
ninja: Entering directory `/data/data/com.termux/files/home/oro/bubblewrap/_builddir'
[7/10] Compiling C object bwrap.p/bubblewrap.c.o
FAILED: bwrap.p/bubblewrap.c.o
cc -Ibwrap.p -I. -I.. -I/data/data/com.termux/files/usr/include -fcolor-diagnostics -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -O0 -g -D_GNU_SOURCE -Werror=shadow -Werror=empty-body -Werror=strict-prototypes -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=pointer-arith -Werror=init-self -Werror=missing-declarations -Werror=return-type -Werror=overflow -Werror=int-conversion -Werror=incompatible-pointer-types -Werror=misleading-indentation -Werror=missing-include-dirs -Werror=aggregate-return -Werror=switch-default -Wswitch-enum -Wno-sign-compare -Wno-error=sign-compare -Wno-missing-field-initializers -Wno-error=missing-field-initializers -Werror=format=2 -Werror=format-security -Werror=format-nonliteral -MD -MQ bwrap.p/bubblewrap.c.o -MF bwrap.p/bubblewrap.c.o.d -o bwrap.p/bubblewrap.c.o -c ../bubblewrap.c
../bubblewrap.c:3062:13: error: call to undeclared function 'get_current_dir_name'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  old_cwd = get_current_dir_name ();
            ^
../bubblewrap.c:3062:11: error: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
  old_cwd = get_current_dir_name ();
          ^ ~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
[9/10] Linking target tests/test-utils
ninja: build stopped: subcommand failed.

This is using Termux from F-Droid.

@orowith2os orowith2os closed this as not planned Won't fix, can't repro, duplicate, stale May 4, 2023
@orowith2os orowith2os changed the title Android Build fails on Android using Clang 16 May 4, 2023
@orowith2os orowith2os changed the title Build fails on Android using Clang 16 Build fails on Android using Clang 16 (termux) May 4, 2023
@orowith2os
Copy link
Author

I am currently unable to test this on Fedora or another normal Linux distribution, Android is all I have at the moment.

@orowith2os orowith2os reopened this May 4, 2023
@smcv
Copy link
Collaborator

smcv commented May 4, 2023

bubblewrap is primarily intended for, and tested on, GNU/Linux (Linux with GNU libc). Android uses bionic libc, which is lacking many GNU functions.

I'd (eventually, when time permits...) review a pull request adding a feature-check for "do we have get_current_dir_name()?", and if not, a fallback implementation in terms of calling getcwd() with an increasingly large buffer.

@orowith2os
Copy link
Author

bubblewrap is primarily intended for, and tested on, GNU/Linux (Linux with GNU libc). Android uses bionic libc, which is lacking many GNU functions.

I know, I was building it on Android mainly because I could. Would musl work here? I don't know if it implements the functions bwrap needs. Worst case I try to install glibc inside of Termux. Will give that a try and see if it works.

I know bwrap likely wouldn't work on Android in the first place, so again, pretty much just because I could.

I'd (eventually, when time permits...) review a pull request adding a feature-check for "do we have get_current_dir_name()?",

Would be appreciated, I'll keep an eye out for that.

@smcv
Copy link
Collaborator

smcv commented May 4, 2023

Would be appreciated, I'll keep an eye out for that

To be more clear, I meant "if you write it, I'll try to review it". I'm very unlikely to have time to implement fallback code for non-GNU operating system environments myself.

@smcv
Copy link
Collaborator

smcv commented May 4, 2023

Would musl work here?

musl is in the same situation as bionic libc: probably nobody is routinely building/testing bubblewrap for that environment, but if people (maybe you?) contribute portability improvements then I'll try to review them.

@orowith2os
Copy link
Author

To be more clear, I meant "if you write it, I'll try to review it".

Understood that, meant I'll be watching the PRs for any that might be relevant. I don't think I have the knowledge needed to implement a fallback, but who knows, could be worth a shot.

@orowith2os
Copy link
Author

Interesting, Alpine Linux has bubblewrap in their repos, no dependency on glibc. Maybe musl implements the gnu functions needed here?

@orowith2os
Copy link
Author

Very interesting: https://git.musl-libc.org/cgit/musl/tree/src/misc/get_current_dir_name.c

Seems the work is already done here. Shouldn't be too hard to get it going in bwrap.

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 a pull request may close this issue.

2 participants