unrecognized option '-EL' android kernel build - android

I'm trying to build an android kernel. On every build I get a few errors:
/usr/bin/as: unrecognized option '-EL' clang-16: error: assembler
command failed with exit code 1 (use -v to see invocation)
warning: field 'cgrp' with variable sized type 'struct cgroup' not at
the end of a struct or class is a GNU extension
[-Wgnu-variable-sized-type-not-at-end] struct group cgrp;
warning: unused function 'dump_workqueue' [-Wunused-function] static
void dump_workqueue(void) {}
I've already tried a lot. No more ideas and information on the Internet. Please help me how to solve this.
I use clang-r475365b and gcc android-11.0.0_r48
My Kernel: https://github.com/OnePlusOSS/android_kernel_oneplus_sm8250/tree/oneplus/SM8250_R_11.0
My build.sh:
#!/usr/bin/bash
if [[ -d "out" ]]
then
cd out && make clean && make distclean && make mrproper && cd ..
else
mkdir -p out
fi
make O=out ARCH=arm64 vendor/bengal-perf_defconfig
PATH="${HOME}/heh/Desktop/clang/bin:${HOME}/heh/Desktop/toolchains/bin${PATH}" \
LD_LIBRARY_PATH="${HOME}/heh/Desktop/clang/lib:${HOME}/heh/Desktop/toolchains/lib${PATH}" \
make O=out \
ARCH=arm64 \
SUBARCH=arm64 \
CROSS_COMPILE=aarch64-linux-android- \
CROSS_COMPILER=$PATH \
CLANG_TRIPLE=aarch64-linux-gnu- \
RANLIB=/home/heh/Desktop/clang/bin/llvm-ranlib \
CC='/home/heh/Desktop/clang/bin/clang -fintegrated-as' \
AR=/home/heh/Desktop/clang/bin/llvm-ar \
AS=/home/heh/Desktop/clang/bin/llvm-as \
NM=/home/heh/Desktop/clang/bin/llvm-nm \
OBJCOPY=/home/heh/Desktop/clang/bin/llvm-objcopy \
OBJDUMP=/home/heh/Desktop/clang/bin/llvm-objdump \
READELF=/home/heh/Desktop/clang/bin/llvm-readelf \
OBJSIZE=/home/heh/Desktop/clang/bin/llvm-size \
STRIP=/home/heh/Desktop/clang/bin/llvm-strip \
-j4
I took it from here, but the solution presented there did not help

Related

React Native error Unable to extract native debug metadata - Gradle 7.X +

i am facing some annoying issue. I am working in a project, where the base is kotlin with a external module in react (0.61.5). Works perfect with config: Plugin 4.0.1 & Gradle 6.6, but we implemented a new module (this module is in compose), so we had to update to gradle 7.X + and app started crashing.
Error: Unable to load script.Make sure you are either running a Metro server or that your bundle 'index.android.bundle' is packaged correctly for release & Unable to extract native debug metadata.
Current Config: Plugin 7.2.2 & Gradle 7.5.2
React: 0.61.5
Please let me know if is fixed, need help!!!!!
PS: For release build, we use a docker image, follow
FROM ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive
# Replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# Aliases
RUN alias l="ls -altr"
# set default build arguments
ARG SDK_VERSION=commandlinetools-linux-8512546_latest.zip
ARG ANDROID_BUILD_VERSION=31
ARG ANDROID_TOOLS_VERSION=31.0.0
ARG BUCK_VERSION=2022.05.05.01
ARG NDK_VERSION=21.4.7075529
ARG NODE_VERSION=10.16.3
ARG WATCHMAN_VERSION=4.9.0
ARG CMAKE_VERSION=3.18.1
# nvm environment variables
ENV NVM_DIR /usr/local/nvm
# set default environment variables, please don't remove old env for compatibilty issue
ENV ADB_INSTALL_TIMEOUT=10
ENV ANDROID_HOME=/opt/android
ENV ANDROID_SDK_ROOT=${ANDROID_HOME}
ENV ANDROID_NDK=${ANDROID_HOME}/ndk/$NDK_VERSION
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
ENV CMAKE_BIN_PATH=${ANDROID_HOME}/cmake/$CMAKE_VERSION/bin
ENV PATH=${ANDROID_NDK}:${CMAKE_BIN_PATH}:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/emulator:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:/opt/buck/bin/:${PATH}
# Install system dependencies
RUN apt update -qq && apt install -qq -y --no-install-recommends \
apt-transport-https \
curl \
file \
gcc \
git \
g++ \
gnupg2 \
libc++1-10 \
libgl1 \
libtcmalloc-minimal4 \
make \
openjdk-11-jdk-headless \
openssh-client \
patch \
python3 \
python3-distutils \
rsync \
ruby \
ruby-dev \
tzdata \
unzip \
sudo \
ninja-build \
zip \
# Dev libraries requested by Hermes
libicu-dev \
# Emulator & video bridge dependencies
libc6 \
libdbus-1-3 \
libfontconfig1 \
libgcc1 \
libpulse0 \
libtinfo5 \
libx11-6 \
libxcb1 \
libxdamage1 \
libnss3 \
libxcomposite1 \
libxcursor1 \
libxi6 \
libxext6 \
libxfixes3 \
zlib1g \
libgl1 \
pulseaudio \
socat \
&& gem install bundler \
&& rm -rf /var/lib/apt/lists/*;
# Install nvm
RUN curl --silent -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.2/install.sh | bash
# Install node and npm
RUN source $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default \
&& ln -s "$(which node)" /usr/local/bin/node
# Add node and npm to path so the commands are available
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
# Install NPM Stuff
RUN npm install -g yarn
RUN npm install -g firebase-tools
# download and install buck using the java11 pex from Jitpack
RUN curl -L https://jitpack.io/com/github/facebook/buck/v${BUCK_VERSION}/buck-v${BUCK_VERSION}-java11.pex -o /tmp/buck.pex \
&& mv /tmp/buck.pex /usr/local/bin/buck \
&& chmod +x /usr/local/bin/buck
# Install SDK & NDK
RUN curl -sS https://dl.google.com/android/repository/${SDK_VERSION} -o /tmp/sdk.zip \
&& mkdir -p ${ANDROID_HOME}/cmdline-tools \
&& unzip -q -d ${ANDROID_HOME}/cmdline-tools /tmp/sdk.zip \
&& mv ${ANDROID_HOME}/cmdline-tools/cmdline-tools ${ANDROID_HOME}/cmdline-tools/latest \
&& rm /tmp/sdk.zip \
&& yes | sdkmanager --licenses \
&& yes | sdkmanager "platform-tools" \
"emulator" \
"platforms;android-$ANDROID_BUILD_VERSION" \
"build-tools;$ANDROID_TOOLS_VERSION" \
"cmake;$CMAKE_VERSION" \
"system-images;android-21;google_apis;armeabi-v7a" \
"ndk;$NDK_VERSION" \
&& rm -rf ${ANDROID_HOME}/.android \
&& chmod 777 -R /opt/android \
&& ln -s ${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/9.0.9 ${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/9.0.8
Try this:
1- add classpath('com.android.tools.build:gradle:7.0.3') in your dependencies located in android/build.gradle
basically the gradle version is not compatible with react native on android at the time of posting this answer.
2- If that doesn't work, before doing build, run:
npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle
then:
cd android
./gradlew assembleRelease
This github issue can give you more information.

Compiling ffmpeg for android on Mac

I tried to compile ffmpeg for android on Mac, but it does not work for me.
#!/bin/bash
NDK=/Users/user/Library/Android/sdk/ndk-bundle
SYSROOT=$NDK/platforms/android-18/arch-arm/
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64
function build_one
{
./configure \
--prefix=$PREFIX \
--enable-shared \
--disable-static \
--disable-doc \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-network \
--disable-filters \
--disable-avdevice \
--disable-doc \
--disable-symver \
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
--target-os=linux \
--arch=arm \
--enable-cross-compile \
--sysroot=$SYSROOT \
--extra-cflags="-Os -fpic $ADDI_CFLAGS" \
--extra-ldflags="$ADDI_LDFLAGS" \
$ADDITIONAL_CONFIGURE_FLAG
make clean all
make
make install
}
CPU=arm
PREFIX=$(pwd)/android/$CPU
ADDI_CFLAGS="-marm"
build_one
I also give execute permission via chmod +x build_script.sh
I tried ffmpeg 4.1 and 4.0.3 but both are not work and same error reason.
I also tried on android-21 and android-18
test_cpp_condition stddef.h defined __ARM_ARCH_4__ || defined __TARGET_ARCH_4
test_cpp
BEGIN /tmp/ffconf.bgSdFwkD/test.c
1 #include <stddef.h>
2 #if !(defined __ARM_ARCH_4__ || defined __TARGET_ARCH_4)
3 #error "unsatisfied condition: defined __ARM_ARCH_4__ || defined __TARGET_ARCH_4"
4 #endif
END /tmp/ffconf.bgSdFwkD/test.c
/Users/user/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc --sysroot=/Users/user/Library/Android/sdk/ndk-bundle/platforms/android-21/arch-arm/ -Os -fpic -marm -E -o /tmp/ffconf.bgSdFwkD/test.o /tmp/ffconf.bgSdFwkD/test.c
/tmp/ffconf.bgSdFwkD/test.c:3:2: error: "unsatisfied condition: defined __ARM_ARCH_4__ || defined __TARGET_ARCH_4"
#error "unsatisfied condition: defined __ARM_ARCH_4__ || defined __TARGET_ARCH_4"
^
1 error generated.
test_cpp_condition stddef.h defined __ARM_ARCH_4T__ || defined __TARGET_ARCH_4T
test_cpp
BEGIN /tmp/ffconf.bgSdFwkD/test.c
1 #include <stddef.h>
2 #if !(defined __ARM_ARCH_4T__ || defined __TARGET_ARCH_4T)
3 #error "unsatisfied condition: defined __ARM_ARCH_4T__ || defined __TARGET_ARCH_4T"
4 #endif
END /tmp/ffconf.bgSdFwkD/test.c
/Users/user/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc --sysroot=/Users/user/Library/Android/sdk/ndk-bundle/platforms/android-21/arch-arm/ -Os -fpic -marm -E -o /tmp/ffconf.bgSdFwkD/test.o /tmp/ffconf.bgSdFwkD/test.c
test_ld cc
test_cc
BEGIN /tmp/ffconf.bgSdFwkD/test.c
1 int main(void){ return 0; }
END /tmp/ffconf.bgSdFwkD/test.c
/Users/user/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc --sysroot=/Users/user/Library/Android/sdk/ndk-bundle/platforms/android-21/arch-arm/ -Os -fpic -marm -march=armv4t -c -o /tmp/ffconf.bgSdFwkD/test.o /tmp/ffconf.bgSdFwkD/test.c
/Users/user/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc --sysroot=/Users/user/Library/Android/sdk/ndk-bundle/platforms/android-21/arch-arm/ -march=armv4t -o /tmp/ffconf.bgSdFwkD/test /tmp/ffconf.bgSdFwkD/test.o
ld: unknown option: --sysroot=/Users/user/Library/Android/sdk/ndk-bundle/platforms/android-21/arch-arm/
clang: error: linker command failed with exit code 1 (use -v to see invocation)
C compiler test failed.
Is there any tools/Applications or libraries I have to additionally install for compiling? I'm confused.... (THIS QUESTION IS MAY DUPLICATE BUT NONE OF SOLUTION WAS WORKED FOR ME)
EDIT To clarify my system environment.
Mac OS X High Sierra (10.13.6)
Android NDK (18.1.5063045)
Android SDK Tools and SDK Build-Tools
CMake
EDIT I also tried ffmpeg version 3.3.9 but it does not work either.
I was installed NDK through Android Studio and I think it was the problem, so I downloaded Android NDK manually and now I can configure and run the makefile.
Wait! Not done yet. When I ran makefile with latest stable NDK (r16b), it says:
./libavutil/common.h:33:19: fatal error: errno.h: No such file or directory
According to this document, so I tried using NDK r15c and it finally works for me.
To summarize how I solve this problem: Manually install NDK r15c and DON'T FORGET update your shell script file!
Hope this help!!
You can use wrappers https://github.com/WritingMinds/ffmpeg-android
if you want to use most of the command. It will increase the size of apk.
I also tried to compile it and after several attempts, I compiled my own one. But it is hard to integrate as well. I used below tutorials to compile it.
https://syllogismobile.wordpress.com/2017/02/19/building-ffmpeg-for-android/
https://enoent.fr/blog/2014/06/20/compile-ffmpeg-for-android/
https://yesimroy.gitbooks.io/android-note/content/compile_ffmpeg_for_android.html
But I just wanted to tell, use FFmpeg wrapper for it if u don't consider the size of apk. There is not the considerable gain of performance in own compiled FFmpeg. Use above mentioned wrapper u want. It works well. If u more enthusiastic about compile and integrate your own FFmpeg, try above tutorials.

Compiling ffmpeg for Android on OSX

I'm trying to compile ffmpeg for Android, on OSX 10.12.4 .
Here are the steps I followed:
1°) Compile pkg-config
Download the sources from here . Extract && cd in the pkg-config folder.
export DST=/a/path/on/my/computer
./configure --with-internal-glib --prefix=$DST --exec-prefix=$DST
make -j2
make install
export PATH=$PATH:$DST/bin
2°) Compile ffmpeg
Download the sources from here. Extract && cd in the ffmpeg folder.
export NDK=/path/to/android-ndk-r15c
export PLATFORM_VERSION=android-26
export ARCH=arm
export PLATFORM=$NDK/platforms/$PLATFORM_VERSION/arch-$ARCH
export TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64
export PREFIX=$(pwd)/android/$ARCH
export ADDI_CFLAGS="-Os -fpic -marm"
export ADDI_CONFIGURE_FLAG=""
export ADDI_LDFLAGS=""
./configure \
--prefix=$PREFIX \
--enable-shared \
--disable-static \
--disable-doc \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--disable-symver \
--disable-avdevice \
\
--pkg-config=pkg-config \
\
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
--target-os=linux \
--arch=$ARCH \
--enable-cross-compile \
--sysroot=$PLATFORM \
--extra-cflags="$ADDI_CFLAGS" \
--extra-ldflags="$ADDI_LDFLAGS" \
\
$ADDI_CONFIGURE_FLAG
make -j2
Make fails with the following error:
AR libavfilter/libavfilter.a
AR libavformat/libavformat.a
CC libavcodec/aaccoder.o
In file included from /Users/Tim/Library/Android/android-ndk-r15c/platforms/android-26/arch-arm/usr/include/asm/termbits.h:19:0,
from /Users/Tim/Library/Android/android-ndk-r15c/platforms/android-26/arch-arm/usr/include/asm-generic/termios.h:21,
from /Users/Tim/Library/Android/android-ndk-r15c/platforms/android-26/arch-arm/usr/include/asm/termios.h:19,
from /Users/Tim/Library/Android/android-ndk-r15c/platforms/android-26/arch-arm/usr/include/linux/termios.h:22,
from /Users/Tim/Library/Android/android-ndk-r15c/platforms/android-26/arch-arm/usr/include/sys/ioctl.h:37,
from ./libavutil/timer.h:36,
from ./libavutil/internal.h:42,
from ./libavutil/common.h:467,
from libavcodec/mathops.h:27,
from libavcodec/aaccoder.c:38:
libavcodec/aaccoder.c: In function 'search_for_ms':
libavcodec/aaccoder.c:803:25: error: expected identifier or '(' before numeric constant
int B0 = 0, B1 = 0;
^
libavcodec/aaccoder.c:865:28: error: lvalue required as left operand of assignment
B0 += b1+b2;
^
libavcodec/aaccoder.c:866:25: error: 'B1' undeclared (first use in this function)
B1 += b3+b4;
^
libavcodec/aaccoder.c:866:25: note: each undeclared identifier is reported only once for each function it appears in
make: *** [libavcodec/aaccoder.o] Error 1
make: *** Waiting for unfinished jobs....
I'm able to fix that error by renaming B0 & B1 variables in the source to A0 & A1 (don't know why it fixes the problem), but then it fails somewhere else. I guess something is wrong in my config, and I'd prefer to avoid having to patch the source.
So the questions are:
does someone know what's wrong here? Do I need to give some args to gcc?
is the --target-os=linux correct, or should it be --target-os=darwin? Is target-os the OS where the compilation is done, or where ffmpeg will be executed? By using darwin, I can compile using --enable-static, but not --enable-shared (which I want).
Note: I need to compile it myself as I want only an arm version, with HTTPS support. Thus I can't use the existing built versions.
I also met this problem when I tried to build the ffmpeg 3.4 the latest version.I wish you could try the 3.3 version.I built it successfully.
I doubt that latest version is unstable and with some bug.
By the way,You can take some answer By this article:
http://alientechlab.com/how-to-build-ffmpeg-for-android/
Issue closed by FFmpeg team
--target-os=android solves it
./configure \
...
--target-os=android

Unable to upload an APK file to hockey app via their API

I am unable to upload an android apk to hockeyapp through the API provided by them.When i use
curl \ -F "status=2" \
-F "notify=1" \
-F "notes=Some new features and fixed bugs." \
-F "notes_type=0" \
-F "apk=#app-release.apk" \
-H "X-HockeyAppToken: MY_TOKEN" \https://rink.hockeyapp.net/api/2/apps/MY_APP_ID/app_versions/upload
i am getting an error : {"status":null}
And when I try
curl \
-F "status=2" \
-F "notify=1" \
-F "notes=Some new features and fixed bugs." \
-F "notes_type=0" \ -F "apk=#app-release.apk" \
-H "X-HockeyAppToken: MY_TOKEN" \ https://rink.hockeyapp.net/api/2/apps/upload
an error occurs : {"status":"error","message":"File not found. Please check that your file is not a directory or bundle."}
Please give me a solution.Drag and drop is working for me.But I need it to be done through their API.I am using Team City as my CI server.
The parameter for the build is called "ipa" on all platforms, i.e. -F "ipa=#app-release.apk" would be correct.

How to compile Protobuf 2.6.0 for Android on Windows

I'm trying to compile Protobuf 2.6.0 for Android on Windows.
I have to say that I need a staic Protobuf library for using with Qt 5 on Android.
In Cygwin bash I run the next command:
./configure --prefix=c:/Thirdparty/Android/protobuf/build \
--host=arm-linux-androideabi \
--disable-shared \
--enable-cross-compile \
--with-protoc=c:/Thirdparty/bin/protoc \
CC=c:/Thirdparty/Android/NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-gcc.exe \
CXX=c:/Thirdparty/Android/NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++.exe \
LDFLAGS=-Lc:/Thirdparty/Android/NDK/platforms/android-5/arch-arm/usr/lib \
CPPFLAGS=-Ic:/Thirdparty/Android/NDK/platforms/android-5/arch-arm/usr/include
But I got the next error:
configure:3474: checking whether the C compiler works
configure:3496: c:/Thirdparty/Android/NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-gcc.exe \
-Ic:/Thirdparty/Android/NDK/platforms/android-5/arch-arm/usr/include \
-Lc:/Thirdparty/Android/NDK/platforms/android-5/arch-arm/usr/lib conftest.c >&5
c:/thirdparty/android/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld.exe:
error: cannot open crtbegin_dynamic.o: No such file or directory
c:/thirdparty/android/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld.exe:
error: cannot open crtend_android.o: No such file or directory
collect2.exe: error: ld returned 1 exit status
What should I do else? Thank you.
I found the solution. I had to define --sysroot="", like this:
LDFLAGS="-Lc:/Thirdparty/Android/NDK/platforms/android-5/arch-arm/usr/lib \
--sysroot=c:/Thirdparty/Android/NDK/platforms/android-5/arch-arm"

Categories

Resources