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

Android libraries fail to build on macOS case-insensitive filesystem when using a release/pre-release version #6558

Closed
misl6 opened this issue Nov 20, 2022 · 4 comments

Comments

@misl6
Copy link
Contributor

misl6 commented Nov 20, 2022

Android libraries fail to build on macOS case-insensitive filesystem when using a release/pre-release version.

android-ndk-r25/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/limits includes version at line 121.
The root folder, which contains a file named VERSION is added as an include path via -I..
The case insensitivity on the macOS filesystem, makes the compiler think that VERSION, which resides in the root folder, is the file that should be included.

To reproduce:

wget https://github.com/libsdl-org/SDL/releases/download/prerelease-2.25.1/SDL2-2.25.1.zip
unzip SDL2-2.25.1.zip
cd SDL2-2.25.1
./build-scripts/androidbuildlibs.sh V=1

Logs:

[armeabi-v7a] Compile++ thumb: SDL2 <= hid.cpp
rm -f build/android/obj/local/armeabi-v7a/objs/SDL2/src/hidapi/android/hid.o
/Users/mirko/.buildozer/android/platform/android-ndk-r25/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ -MMD -MP -MF build/android/obj/local/armeabi-v7a/objs/SDL2/src/hidapi/android/hid.o.d -target armv7-none-linux-androideabi16 -fdata-sections -ffunction-sections -fstack-protector-strong -funwind-tables -no-canonical-prefixes  --sysroot /Users/mirko/.buildozer/android/platform/android-ndk-r25/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -g -Wno-invalid-command-line-argument -Wno-unused-command-line-argument  -D_FORTIFY_SOURCE=2 -fno-exceptions -fno-rtti -fpic -mthumb -Oz -DNDEBUG  -I./include -I/Users/mirko/.buildozer/android/platform/android-ndk-r25/sources/android/cpufeatures -I.    -DANDROID -DGL_GLEXT_PROTOTYPES -Wall -Wextra -Wdocumentation -Wdocumentation-unknown-command -Wmissing-prototypes -Wunreachable-code-break -Wunneeded-internal-declaration -Wmissing-variable-declarations -Wfloat-conversion -Wshorten-64-to-32 -Wunreachable-code-return -Wshift-sign-overflow -Wstrict-prototypes -Wkeyword-macro -Wno-unused-parameter -Wno-sign-compare -Wformat -Werror=format-security   -c  ./src/hidapi/android/hid.cpp -o build/android/obj/local/armeabi-v7a/objs/SDL2/src/hidapi/android/hid.o
In file included from ./src/hidapi/android/hid.cpp:21:
In file included from ./src/hidapi/android/../../SDL_internal.h:123:
In file included from ./include/SDL_assert.h:25:
In file included from ./include/SDL_stdinc.h:46:
In file included from /Users/mirko/.buildozer/android/platform/android-ndk-r25/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/stdlib.h:100:
In file included from /Users/mirko/.buildozer/android/platform/android-ndk-r25/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/math.h:311:
In file included from /Users/mirko/.buildozer/android/platform/android-ndk-r25/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/type_traits:417:
In file included from /Users/mirko/.buildozer/android/platform/android-ndk-r25/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/cstddef:37:
./version:1:1: error: unknown type name 'prerelease'
prerelease-2.25.1-0-g78ea6af2c
^
./version:1:11: error: expected unqualified-id
prerelease-2.25.1-0-g78ea6af2c
          ^
In file included from ./src/hidapi/android/hid.cpp:21:
In file included from ./src/hidapi/android/../../SDL_internal.h:123:
In file included from ./include/SDL_assert.h:25:
In file included from ./include/SDL_stdinc.h:46:
In file included from /Users/mirko/.buildozer/android/platform/android-ndk-r25/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/stdlib.h:100:
In file included from /Users/mirko/.buildozer/android/platform/android-ndk-r25/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/math.h:311:
In file included from /Users/mirko/.buildozer/android/platform/android-ndk-r25/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/type_traits:418:
./version:1:1: error: unknown type name 'prerelease'
prerelease-2.25.1-0-g78ea6af2c
^
./version:1:11: error: expected unqualified-id
prerelease-2.25.1-0-g78ea6af2c
          ^
In file included from ./src/hidapi/android/hid.cpp:21:
In file included from ./src/hidapi/android/../../SDL_internal.h:123:
In file included from ./include/SDL_assert.h:25:
In file included from ./include/SDL_stdinc.h:46:
In file included from /Users/mirko/.buildozer/android/platform/android-ndk-r25/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/stdlib.h:100:
In file included from /Users/mirko/.buildozer/android/platform/android-ndk-r25/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/math.h:312:
In file included from /Users/mirko/.buildozer/android/platform/android-ndk-r25/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/limits:121:
./version:1:1: error: unknown type name 'prerelease'
prerelease-2.25.1-0-g78ea6af2c
^
./version:1:11: error: expected unqualified-id
prerelease-2.25.1-0-g78ea6af2c
          ^
In file included from ./src/hidapi/android/hid.cpp:21:
In file included from ./src/hidapi/android/../../SDL_internal.h:123:
In file included from ./include/SDL_assert.h:25:
In file included from ./include/SDL_stdinc.h:46:
In file included from /Users/mirko/.buildozer/android/platform/android-ndk-r25/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/stdlib.h:100:
/Users/mirko/.buildozer/android/platform/android-ndk-r25/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/math.h:1377:93: error: no member named 'log2f' in the global namespace
inline _LIBCPP_INLINE_VISIBILITY float       log2(float __lcpp_x) _NOEXCEPT       {return ::log2f(__lcpp_x);}
                                                                                          ~~^
/Users/mirko/.buildozer/android/platform/android-ndk-r25/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/math.h:1378:93: error: no member named 'log2l' in the global namespace
inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return ::log2l(__lcpp_x);}
                                                                                          ~~^
/Users/mirko/.buildozer/android/platform/android-ndk-r25/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/math.h:1383:38: error: call to 'log2' is ambiguous
log2(_A1 __lcpp_x) _NOEXCEPT {return ::log2((double)__lcpp_x);}
                                     ^~~~~~
/Users/mirko/.buildozer/android/platform/android-ndk-r25/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/math.h:1377:46: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY float       log2(float __lcpp_x) _NOEXCEPT       {return ::log2f(__lcpp_x);}
                                             ^
/Users/mirko/.buildozer/android/platform/android-ndk-r25/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/math.h:1378:46: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return ::log2l(__lcpp_x);}
                                             ^
9 errors generated.
make: *** [/Users/mirko/.buildozer/android/platform/android-ndk-r25/build/core/build-binary.mk:424: build/android/obj/local/armeabi-v7a/objs/SDL2/src/hidapi/android/hid.o] Error 1
@madebr
Copy link
Contributor

madebr commented Nov 20, 2022

This is the culprit

@madebr
Copy link
Contributor

madebr commented Nov 20, 2022

Does the following patch fix your issue?

--- a/Android.mk
+++ b/Android.mk
@@ -12,7 +12,7 @@ LOCAL_MODULE := SDL2
 
 LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
 
-LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
+LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)/include
 
 LOCAL_SRC_FILES := \
        $(subst $(LOCAL_PATH)/,, \

Alternatively, we rename the VERSION file.

@slouken
Copy link
Collaborator

slouken commented Nov 21, 2022

Yep, that patch didn't work, something implicitly adds -I. in the Android build process, so I renamed the file to VERSION.txt

@misl6
Copy link
Contributor Author

misl6 commented Nov 21, 2022

Yep, that patch didn't work, something implicitly adds -I. in the Android build process, so I renamed the file to VERSION.txt

Thank you!

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