unknown file type on MacOS

For about 3 weeks now I have been experiencing a strange error when building for Android under MacOS.

ld: error: /Users/patrick/src/android/Android_Player/libMediaExtractor/build/intermediates/cxx/Debug/5p272q2v/obj/local/arm64-v8a/ unknown file type

The crazy thing is that it works from time to time.
Occasionally I have to do a clean and rebuild.

I can only narrow it down a little.

file ./gst-android-build/arm64-v8a/libgstreamer_android.so_this_works ./gst-android-build/arm64-v8a/
./gst-android-build/arm64-v8a/libgstreamer_android.so_this_works: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, with debug_info, not stripped
./gst-android-build/arm64-v8a/                 data

It seems when building, first a version is created that works, then another step is taken that makes the file broken. Perhaps a strip or a conversion.

I have seen the problem so far with Gst > 1.22.0
It could be that it has to do with MacOS 14.3.1. That would fit in time. On the other hand, I have also updated Android Studio.

I have tried different NDK versions. That makes no difference.
I currently use the prebuild versions of gstreamer from the homepage.

Has anyone seen this problem before or has an idea what the problem could be?

This seems to be a problem within macOS.
The cp command has an issue.

cp A B && md5sum A B
gives me differents md5summes.

A workaround is:
edit the within your used ndk Version.

for me it is:
line 90

ifeq ($(HOST_OS),windows)
host-cp = copy /b/y $(subst /,\,"$1" "$2") > NUL
host-cp = cp -c -f $1 $2

add the “-c” to the cp command fix the problem for me

Thank you for doing this investigative work! Your provided solution also worked for me.

I’ve faced it after a macOS update to 14.4.1