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

[question] Proper Android NDK Usage #25342

Open
cjserio opened this issue Sep 20, 2024 · 1 comment
Open

[question] Proper Android NDK Usage #25342

cjserio opened this issue Sep 20, 2024 · 1 comment
Labels
question Further information is requested

Comments

@cjserio
Copy link

cjserio commented Sep 20, 2024

What is your question?

Hi all,

In light of this thread I've configured my Android profile as follows:

[settings]
arch=armv8
os=Android
os.api_level=24
compiler=clang
compiler.version=14
compiler.libcxx=c++_static
compiler.cppstd=20

[tool_requires]
android-ndk/r25c

This seems to work for packages such as boost however I cannot get freetype/2.13.2 to compile because using the android-ndk as a tool causes Conan to populate its conanbuildenv-release-armv8.sh file with a line like this:

export SYSROOT="/Users/cjserio/.conan2/p/andro355698625527f/p/bin/toolchains/llvm/prebuilt/darwin-x86_64/sysroot"

It seems that meson sees that line and then creates a conan_meson_cross.ini file that contains these snippets:

[properties]
needs_exe_wrapper = true
sys_root = '/Users/cjserio/.conan2/p/andro355698625527f/p/bin/toolchains/llvm/prebuilt/darwin-x86_64/sysroot'
# C/C++ arguments
c_args = ['--sysroot=/Users/cjserio/.conan2/p/andro355698625527f/p/bin/toolchains/llvm/prebuilt/darwin-x86_64/sysroot'] + preprocessor_definitions
c_link_args = ['--sysroot=/Users/cjserio/.conan2/p/andro355698625527f/p/bin/toolchains/llvm/prebuilt/darwin-x86_64/sysroot']
cpp_args = ['--sysroot=/Users/cjserio/.conan2/p/andro355698625527f/p/bin/toolchains/llvm/prebuilt/darwin-x86_64/sysroot'] + preprocessor_definitions
cpp_link_args = ['--sysroot=/Users/cjserio/.conan2/p/andro355698625527f/p/bin/toolchains/llvm/prebuilt/darwin-x86_64/sysroot']

And then when it comes time to actually compile I get this output:

[9/46] Compiling C object libfreetype.a.p/src_sfnt_sfnt.c.o
FAILED: libfreetype.a.p/src_sfnt_sfnt.c.o
/Users/cjserio/.conan2/p/andro355698625527f/p/bin/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android24-clang -Ilibfreetype.a.p -I. -I../src -I../src/include -I/Users/cjserio/.conan2/p/andro355698625527f/p/bin/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/Users/cjserio/.conan2/p/zlibb1e8c6365dfaa/p/include -I/Users/cjserio/.conan2/p/andro355698625527f/p/bin/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/Users/cjserio/.conan2/p/bzip2d3df4e2c5adee/p/include -I/Users/cjserio/.conan2/p/andro355698625527f/p/bin/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/Users/cjserio/.conan2/p/b/libpn4cc933203066c/p/include -I/Users/cjserio/.conan2/p/andro355698625527f/p/bin/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/Users/cjserio/.conan2/p/brotlf2a109645ecdb/p/include -I/Users/cjserio/.conan2/p/andro355698625527f/p/bin/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/Users/cjserio/.conan2/p/brotlf2a109645ecdb/p/include/brotli -fvisibility=hidden -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O3 --sysroot=/Users/cjserio/.conan2/p/andro355698625527f/p/bin/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -fPIC '-DFT_CONFIG_MODULES_H=<ftmodule.h>' -DFT2_BUILD_LIBRARY=1 '-DFT_CONFIG_OPTIONS_H=<ftoption.h>' '-DFT_CONFIG_CONFIG_H=<ftconfig.h>' -MD -MQ libfreetype.a.p/src_sfnt_sfnt.c.o -MF libfreetype.a.p/src_sfnt_sfnt.c.o.d -o libfreetype.a.p/src_sfnt_sfnt.c.o -c ../src/src/sfnt/sfnt.c
In file included from ../src/src/sfnt/sfnt.c:21:
../src/src/sfnt/pngshim.c:31:10: fatal error: 'png.h' file not found
#include <png.h>
         ^~~~~~~
1 error generated.
[18/46] Compiling C object libfreetype.a.p/src_truetype_truetype.c.o
ninja: build stopped: subcommand failed.

freetype/2.13.2: ERROR:
Package '66b8f533f7934c9cd1bfa22db0fd2e5729766db1' build failed
freetype/2.13.2: WARN: Build folder /Users/cjserio/.conan2/p/b/freetc81a098733940/b/build-release
ERROR: freetype/2.13.2: Error in build() method, line 113
	meson.build()
	ConanException: Error 1 while executing

As you can see, it can't find png.h because the include path for png.h has the sys_root stuck in front of it. So I'm just not sure if this is a Conan bug, a meson bug, a bug in freetype's recipe or if my Android profile is not setup correctly. Any help would be appreciated.

/cc @uilianries @neobrain

@cjserio cjserio added the question Further information is requested label Sep 20, 2024
@AbrilRBS
Copy link
Member

/cc @perseoGI @uilianries which have been looking into this recently :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants