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

I can't get this to build using Android NDK #85

Closed
Stuggy opened this issue Mar 26, 2020 · 5 comments
Closed

I can't get this to build using Android NDK #85

Stuggy opened this issue Mar 26, 2020 · 5 comments

Comments

@Stuggy
Copy link

Stuggy commented Mar 26, 2020

I'm on Windows 10 with the Android NDK r21.

I'm trying to build Android libraries and am getting all kinds of errors related unknown types for int etc.

I'm guessing there is a define I need to use or could it be that zziplib isn't correctly set up for this build environment?

Some examples:
[armeabi-v7a] Compile thumb : zziplib <= fetch.c In file included from S:/And2020/zziplib/jni/zzip/fetch.c:13: In file included from S:/And2020/zziplib/jni\zzip/fetch.h:4: In file included from S:/And2020/zziplib/jni\zzip/types.h:26: In file included from S:/NDK-r21/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include\fcntl.h:33: In file included from S:/NDK-r21/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include\sys/types.h:39: S:/NDK-r21/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include\bits/pthread_types.h:36:3: error: unknown type name 'uint32_t' uint32_t flags; ^ S:/NDK-r21/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include\bits/pthread_types.h:40:3: error: unknown type name 'int32_t' int32_t sched_policy; ^ S:/NDK-r21/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include\bits/pthread_types.h:41:3: error: unknown type name 'int32_t' int32_t sched_priority; ^ S:/NDK-r21/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include\bits/pthread_types.h:65:3: error: unknown type name 'int32_t' int32_t __private[1]; ^ S:/NDK-r21/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include\bits/pthread_types.h:77:3: error: unknown type name 'int32_t' int32_t __private[1]; ^ S:/NDK-r21/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include\bits/pthread_types.h:89:3: error: unknown type name 'int32_t' int32_t __private[10]; ^ In file included from S:/And2020/zziplib/jni/zzip/fetch.c:13: In file included from S:/And2020/zziplib/jni\zzip/fetch.h:4: In file included from S:/And2020/zziplib/jni\zzip/types.h:26: In file included from S:/NDK-r21/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include\fcntl.h:33: S:/NDK-r21/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include\sys/types.h:48:9: error: unknown type name 'uint32_t' typedef uint32_t __id_t; ^ S:/NDK-r21/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include\sys/types.h:72:9: error: unknown type name 'uint64_t' typedef uint64_t ino64_t;

@gdraheim
Copy link
Owner

That should be a cross-compiler, isn't it?

Actually, both autoconf and cmake should be able to detect that. What build system do you use?

@Grimler91
Copy link

The actual problem seem to be the one described in ax_prefix_config_h.m4, zzip/_config.h contains entries like:

/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
   */
#ifndef ZZIP_^A
#define ZZIP_^A ^B
#endif

I tried changing ax_prefix_config_h.m4 to the latest one from the autoconf macro archive but it does not seem to make a difference. I have tested with libtool 2.4.6.

Using cmake instead of the configure and make works though (and that is recommended to use according to the README anyways)

Grimler91 added a commit to termux/termux-packages that referenced this issue Oct 1, 2020
Building zziplib with configure; make does not work on
android (gdraheim/zziplib#85) but building
with cmake works fine, but to be able to use cmake we cannot build it
during the texlive-bin build.
Grimler91 added a commit to termux/termux-packages that referenced this issue Oct 1, 2020
Building zziplib with configure; make does not work on
android (gdraheim/zziplib#85) but building
with cmake works fine, but to be able to use cmake we cannot build it
during the texlive-bin build.
@Stuggy
Copy link
Author

Stuggy commented Aug 9, 2021

I'm actually trying to get a NDK build script (Android.mk) to work using Windows and I still can't get it to work. Because I am doing it directly do I need to change some define in a config file or something?

An example error:
[armeabi-v7a] Compile thumb : zzip <= dir.c In file included from S:\OGRE1.12\Build32\zziplib-0.13.71\zzip\dir.c:9: In file included from S:\OGRE1.12\Build32\zziplib-0.13.71\zzip/lib.h:16: In file included from S:\OGRE1.12\Build32\zziplib-0.13.71\zzip/zzip.h:17: In file included from S:\OGRE1.12\Build32\zziplib-0.13.71\zzip/types.h:26: In file included from C:/Android/SDK/ndk/22.1.7171670/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include\fcntl.h:38: In file included from C:/Android/SDK/ndk/22.1.7171670/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include\sys/types.h:39: C:/Android/SDK/ndk/22.1.7171670/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include\bits/pthread_types.h:35:3: error: unknown type name 'uint32_t' uint32_t flags; ^

@gdraheim
Copy link
Owner

gdraheim commented Aug 9, 2021

Let's be clear, the uint32_t comes from C99 stdint.h - that file should be included at some point.

The zzip/dir.c goes to zzip/lib.h which does always include stdint.h - but may be too late as zzip/zzip.h comes before and it includes zzip/types.h which includes sys/types.h which includes pthread_types.h

The real problem seems to be in the pthread_types.h which uses a type definition that it did not include. On my Linux system, neither pthreadtypes.h nor pthread.h make use of bit-correct stdint.h types. It's a specialty of your target where the header files are broken - you should actually complain to the upstream libc maintainers.

Surely we can make a workaround for the situation but I am not sure if it is worth it. It would look like a patch to zzip/types.h that includes <stdint.h> right before <sys/types.h>

Last word: please do not use the automake/autoconf stuff anymore, always use the cmake variant. I don't think it will help in this case but I am not going to look into the details of the older build system anymore which will get removed in the next release.

@Stuggy
Copy link
Author

Stuggy commented Aug 10, 2021

Thanks for the reply. I did get it to finally build before your comment. I had included stdint.h and I think I was still getting errors. I ended up removing one file from the compilation and at least was able to get a library built which seems so far to have enough functions to continue.

I think that we can mark this as closed for now even though I wasn't able to create a full clean ndk-build.

@Stuggy Stuggy closed this as completed Aug 10, 2021
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

3 participants