Native library doesn't build with clang

Hey everyone,
I have a project that uses a native library with the ndk.
I noticed a strange behavior.

I was able to compile my lib for x86, but not for any other architecture,here are logs for x86 and x86_64 builds:

1> D:\AndroidSDK\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe -c -fdiagnostics-format=msvc -gcc-toolchain "D:\AndroidSDK\ndk-bundle\toolchains\x86_64-4.9\prebuilt\windows-x86_64" -target "x86_64-none-linux-android" --sysroot="D:\AndroidSDK\ndk-bundle\platforms\android-21\arch-x86_64" -I "D:\AndroidSDK\ndk-bundle\platforms\android-21\arch-x86_64\usr\include" -I "D:\AndroidSDK\ndk-bundle\sources\cxx-stl\gnu-libstdc++\4.9\include" -I "D:\AndroidSDK\ndk-bundle\sources\cxx-stl\gnu-libstdc++\4.9\libs\x86_64\include" -I "D:\AndroidSDK\ndk-bundle\sources\cxx-stl\gnu-libstdc++\4.9\include\backward" -I D:\coding_projects\ShiftGroove\FFmpegBuild\dist\x86_64\include -I "D:\AndroidSDK\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\lib64\clang\5.0.300080\include" -g2 -gdwarf-2 -o "x64\Debug\ffmpeg.o" -Wall -O0 -fno-strict-aliasing -fno-omit-frame-pointer -fno-exceptions -fstack-protector -fpic -fno-short-enums -x c ffmpeg.c
1>    ffmpeg.c
1>    Tracking command:
1>    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Tracker.exe /d "C:\Program Files (x86)\MSBuild\15.0\FileTracker\FileTracker32.dll" /i D:\coding_projects\ShiftGroove\App.ShiftGroove\FFmpeg\x64\Debug\FFmpeg.tlog /r D:\CODING_PROJECTS\SHIFTGROOVE\APP.SHIFTGROOVE\FFMPEG\FFMPEG.C /b MSBuildConsole_CancelEvent1e636890088b47eb9be4f27f245bfd9e  /c D:\AndroidSDK\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe  -c -fdiagnostics-format=msvc -gcc-toolchain "D:\AndroidSDK\ndk-bundle\toolchains\x86_64-4.9\prebuilt\windows-x86_64" -target "x86_64-none-linux-android" --sysroot="D:\AndroidSDK\ndk-bundle\platforms\android-21\arch-x86_64" -I "D:\AndroidSDK\ndk-bundle\platforms\android-21\arch-x86_64\usr\include" -I "D:\AndroidSDK\ndk-bundle\sources\cxx-stl\gnu-libstdc++\4.9\include" -I "D:\AndroidSDK\ndk-bundle\sources\cxx-stl\gnu-libstdc++\4.9\libs\x86_64\include" -I "D:\AndroidSDK\ndk-bundle\sources\cxx-stl\gnu-libstdc++\4.9\include\backward" -I D:\coding_projects\ShiftGroove\FFmpegBuild\dist\x86_64\include -I "D:\AndroidSDK\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\lib64\clang\5.0.300080\include" -g2 -gdwarf-2 -o "x64\Debug\ffmpeg.o" -Wall -O0 -fno-strict-aliasing -fno-omit-frame-pointer -fno-exceptions -fstack-protector -fpic -fno-short-enums -x c ffmpeg.c
1>    ffmpeg.c(4,10): fatal error : 'android/log.h' file not found
1>    #include <android/log.h>
1>             ^~~~~~~~~~~~~~~
1>    1 error generated.
1>    The command exited with code 1.
1>  Done executing task "ClangCompile" -- FAILED.
1>Done building target "ClCompile" in project "FFmpeg.vcxproj" -- FAILED.
1>
1>Done building project "FFmpeg.vcxproj" -- FAILED.

 Forcing rebuild of all source files due to missing command TLog "D:\coding_projects\ShiftGroove\App.ShiftGroove\FFmpeg\x86\Debug\FFmpeg.tlog\i686-linux-android-gcc.command.1.tlog".
1>    D:\AndroidSDK\ndk-bundle\toolchains\x86-4.9\prebuilt\windows-x86_64\bin\i686-linux-android-gcc.exe -c --sysroot="D:\\AndroidSDK\\ndk-bundle\\platforms\\android-19\\arch-x86" -I "D:\\AndroidSDK\\ndk-bundle\\platforms\\android-19\\arch-x86\\usr\\include" -I "D:\\AndroidSDK\\ndk-bundle\\sources\\cxx-stl\\gnu-libstdc++\\4.9\\include" -I "D:\\AndroidSDK\\ndk-bundle\\sources\\cxx-stl\\gnu-libstdc++\\4.9\\libs\\x86\\include" -I "D:\\AndroidSDK\\ndk-bundle\\sources\\cxx-stl\\gnu-libstdc++\\4.9\\include\\backward" -I D:\\coding_projects\\ShiftGroove\\FFmpegBuild\\dist\\x86\\include -I "D:\\AndroidSDK\\ndk-bundle\\toolchains\\x86-4.9\\prebuilt\\windows-x86_64\\lib\\gcc\\i686-linux-android\\4.9.x\\include" -g2 -gdwarf-2 -o "x86\\Debug\\ffmpeg.o" -Wall -O0 -fno-strict-aliasing -fno-omit-frame-pointer -fno-exceptions -fstack-protector -fpic -fno-short-enums -x c ffmpeg.c
1>    ffmpeg.c
1>    Tracking command:
1>    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Tracker.exe /d "C:\Program Files (x86)\MSBuild\15.0\FileTracker\FileTracker32.dll" /i D:\coding_projects\ShiftGroove\App.ShiftGroove\FFmpeg\x86\Debug\FFmpeg.tlog /r D:\CODING_PROJECTS\SHIFTGROOVE\APP.SHIFTGROOVE\FFMPEG\FFMPEG.C /b MSBuildConsole_CancelEvent1ec8d246650f47e1b584d076d62854fb  /c D:\AndroidSDK\ndk-bundle\toolchains\x86-4.9\prebuilt\windows-x86_64\bin\i686-linux-android-gcc.exe  -c --sysroot="D:\\AndroidSDK\\ndk-bundle\\platforms\\android-19\\arch-x86" -I "D:\\AndroidSDK\\ndk-bundle\\platforms\\android-19\\arch-x86\\usr\\include" -I "D:\\AndroidSDK\\ndk-bundle\\sources\\cxx-stl\\gnu-libstdc++\\4.9\\include" -I "D:\\AndroidSDK\\ndk-bundle\\sources\\cxx-stl\\gnu-libstdc++\\4.9\\libs\\x86\\include" -I "D:\\AndroidSDK\\ndk-bundle\\sources\\cxx-stl\\gnu-libstdc++\\4.9\\include\\backward" -I D:\\coding_projects\\ShiftGroove\\FFmpegBuild\\dist\\x86\\include -I "D:\\AndroidSDK\\ndk-bundle\\toolchains\\x86-4.9\\prebuilt\\windows-x86_64\\lib\\gcc\\i686-linux-android\\4.9.x\\include" -g2 -gdwarf-2 -o "x86\\Debug\\ffmpeg.o" -Wall -O0 -fno-strict-aliasing -fno-omit-frame-pointer -fno-exceptions -fstack-protector -fpic -fno-short-enums -x c ffmpeg.c
1>  Done executing task "ClangCompile".
1>Done building target "ClCompile" in project "FFmpeg.vcxproj".
1>Target "ManagedIncrementalBuildPostProcessDependencyGraph" skipped, due to false condition; ('@(ClCompile)' != '' and '$(EnableManagedIncrementalBuild)' == 'True') was evaluated as ('ffmpeg.c' != '' and '' == 'True').
1>Target "AfterClCompile" in file "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets":
1>Done building target "AfterClCompile" in project "FFmpeg.vcxproj".

After i switched in my configuration to use gcc 4.9 for x86_64, the build was successful. log:

1>    D:\AndroidSDK\ndk-bundle\toolchains\x86_64-4.9\prebuilt\windows-x86_64\bin\x86_64-linux-android-gcc.exe -c --sysroot="D:\\AndroidSDK\\ndk-bundle\\platforms\\android-21\\arch-x86_64" -I "D:\\AndroidSDK\\ndk-bundle\\platforms\\android-21\\arch-x86_64\\usr\\include" -I "D:\\AndroidSDK\\ndk-bundle\\sources\\cxx-stl\\gnu-libstdc++\\4.9\\include" -I "D:\\AndroidSDK\\ndk-bundle\\sources\\cxx-stl\\gnu-libstdc++\\4.9\\libs\\x86_64\\include" -I "D:\\AndroidSDK\\ndk-bundle\\sources\\cxx-stl\\gnu-libstdc++\\4.9\\include\\backward" -I D:\\coding_projects\\ShiftGroove\\FFmpegBuild\\dist\\x86_64\\include -I "D:\\AndroidSDK\\ndk-bundle\\toolchains\\x86_64-4.9\\prebuilt\\windows-x86_64\\lib\\gcc\\i686-linux-android\\4.9.x\\include" -g2 -gdwarf-2 -o "x64\\Debug\\ffmpeg.o" -Wall -O0 -fno-strict-aliasing -fno-omit-frame-pointer -fno-exceptions -fstack-protector -fpic -fno-short-enums -x c ffmpeg.c
1>    ffmpeg.c
1>    Tracking command:
1>    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Tracker.exe /d "C:\Program Files (x86)\MSBuild\15.0\FileTracker\FileTracker32.dll" /i D:\coding_projects\ShiftGroove\App.ShiftGroove\FFmpeg\x64\Debug\FFmpeg.tlog /r D:\CODING_PROJECTS\SHIFTGROOVE\APP.SHIFTGROOVE\FFMPEG\FFMPEG.C /b MSBuildConsole_CancelEvent85bc266932a44f00a7f52c18c96a5f91  /c D:\AndroidSDK\ndk-bundle\toolchains\x86_64-4.9\prebuilt\windows-x86_64\bin\x86_64-linux-android-gcc.exe  -c --sysroot="D:\\AndroidSDK\\ndk-bundle\\platforms\\android-21\\arch-x86_64" -I "D:\\AndroidSDK\\ndk-bundle\\platforms\\android-21\\arch-x86_64\\usr\\include" -I "D:\\AndroidSDK\\ndk-bundle\\sources\\cxx-stl\\gnu-libstdc++\\4.9\\include" -I "D:\\AndroidSDK\\ndk-bundle\\sources\\cxx-stl\\gnu-libstdc++\\4.9\\libs\\x86_64\\include" -I "D:\\AndroidSDK\\ndk-bundle\\sources\\cxx-stl\\gnu-libstdc++\\4.9\\include\\backward" -I D:\\coding_projects\\ShiftGroove\\FFmpegBuild\\dist\\x86_64\\include -I "D:\\AndroidSDK\\ndk-bundle\\toolchains\\x86_64-4.9\\prebuilt\\windows-x86_64\\lib\\gcc\\i686-linux-android\\4.9.x\\include" -g2 -gdwarf-2 -o "x64\\Debug\\ffmpeg.o" -Wall -O0 -fno-strict-aliasing -fno-omit-frame-pointer -fno-exceptions -fstack-protector -fpic -fno-short-enums -x c ffmpeg.c
1>  Done executing task "ClangCompile".

Why ?

PC environment,
Windows 10 64 bit
NDK r15c
Microsoft Visual Studio Community 2017
Version 15.4.1
VisualStudio.15.Release/15.4.1+27004.2005

Xamarin 4.7.10.22 (fe36bec)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android SDK 8.0.0.33 (HEAD/7a6a056e8)
Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK 11.2.0.8 (9a9f054)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
VS 15.4.1

Sign In or Register to comment.