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
How can I implement curl command in Android? I am using https://places.cit.api.here.com/places/v1/autosuggest?app_id=appid&app_code=appcode&at=52.5304417,13.4111201&q=rest&pretty but it does not return JSON file. It returns an HTML page.I want to do search on the maps and show nearby restaurants.
curl \
--compressed \
-H 'Accept-Encoding:gzip' \
-H 'Accept-Language:en-US,en;q=0.5' \
--get 'https://places.cit.api.here.com/places/v1/autosuggest' \
--data-urlencode 'app_code=appcode' \
--data-urlencode 'app_id=appid' \
--data-urlencode 'at=52.5304417,13.4111201' \
--data-urlencode 'pretty=true' \
--data-urlencode 'q=rest'
Please note that you've just published your app id and app code publicly. They are very likely going to be abused. You should probably delete the project associated with these credentials and create a new one to prevent this.
Let me directly come to the point.
I have one curl url like below
curl https://api.start.payfort.com/tokens/ \
-u test_open_k_1741a9b51afbb3a986f2: \
-d "number=4242424242424242" \
-d "exp_month=11" \
-d "exp_year=2016" \
-d "cvc=123" \
-d "name=Abdullah Mohammed"
I am not pretty good with curl URL calling.
I want to call this URL in android how can I pass header in Android in this example?
Any help would be highly appreciated.
Now I want to add a function into RenderScript to support a new interface by myself.
I wrote the code and add myFunc.c file into "android-4.4-src/frameworks/rs/driver/runtime/", and modify Android.mk(append myFunc.c to clcore_base_files at line 20):
clcore_base_files := \
rs_allocation.c \
rs_cl.c \
rs_core.c \
rs_element.c \
rs_mesh.c \
rs_matrix.c \
rs_program.c \
rs_sample.c \
rs_sampler.c \
convert.ll \
allocation.ll \
rsClamp.ll \
myFunc.c
Then add myFunc.rsh into "android-4.4-src/frameworks/rs/scriptc/", and include myFunc.rsh in rs_core.rsh which in the same directory:
#include "myFunc.rsh"
And then I rebuild:
$ source build/envsetup.sh
$ lunch sdk-eng
$ make sdk
The weird thing is: libclcore.bc in "out/target/product/generic/system/lib/" is the new version which contains the function I wrote, but the libclcore.bc in "out/host.linux-x86/sdk/androidXXX/build-tools/android-4.4.3.2xxx/renderscript/lib" is the old version.
I want to update the old version in "host" like the one in "target" when rebuild.
Is there some configurations I forgot?
Any suggestions would be appreciated!
I need to stream from an android camera/ file to a remote ffserver which will broadcast my video. I can do this on the desktop in ubuntu by issuing a command like:
ffmpeg -f video4linux2 -s 640x480 -r 25 -i /dev/video0 http://192.168.0.20:8090/cam1.ffm
or stream a file like this:
ffmpeg -i /home/kev/share/movie.mp4 http://192.168.0.20:8090/cam1.ffm
So basically i want to be able to do the above from android. After several searches this is what i've done so far - i came across this link http://bambuser.com/opensource from which i downloaded the ffmpeg source and built it. The build outputs several things:
1. shared libs [libavcodec, libavcore, libavdevice, libavfilter,libavformat,libavutil,libswscale]
2. executables [ffmpeg,ffprobe]
Not sure how to plug my functionality with these resources this is what i've tried so far:
1. loaded the libs in my Activity using System.loadLibrary() then copied the ffmpeg executable to the assets folder which at runtime i copied to my application's "files" directory i then set permissions for the executable using Runtime.getRuntime().exec(). then the last step was to execute it in java with the following statement:
Runtime.getRuntime().exec("ffmpeg -i file:///android_asset/movie.mp4http://<server>:8090/cam1.ffm");
2. copied ffmpeg.c,the shared libraries and the "include" folder that was generated by the build to my jni folder and added a jni function that wraps around the main() function in ffmpeg.c. With this approach i've found myself having to copy several header files from the ffmpeg source for the ndk-build to succeed and i highly doubt if this is the way to go.
The above two approaches havnt worked for me, i'm not sure where i'm going wrong, so any help on how to do a simple ffmpeg streaming like an mp4 file from android would be highly appreciated.
I got it working by using apporach 2, this is what i did.
1. copied ffmpeg.c,the "include" folder and the shared libraries to my project's jni folder.
modified ffmpeg.c with reference to this blog post http://demo860.blogspot.com/2010/07/android-ffmpeg-dynamic-module-jni.html
there were several errors while building with ndk so i just added the missing dependencies until finally the build succeeded.
At first the app would start and then immediately exit, this was due to a couple of things i forgot to do so make sure you've done the following to save yourself some hours and hair loss:
- set internet permission on manifest(if media file is in sdcard, set write external storage permission and make sure the sdcard is mounted)
- make sure the remote ffserver is running and configured correctly. you can confirm by streaming from a desktop
- make sure you have the correct params passed
Now i can stream from an mp4 file in my sdcard to a remote ffserver, havnt tried streaming from the device camera yet.
It seems to be a bit late to answer this question, but if you need a solution, here's one...
Well, I had devised a workaround to the same problem but through the first approach that is using a compiled FFmpeg Binary rather than JNI...
First, as far as it seems to me, the builds provided by Bambuser are way too old and FFmpeg has a vicious development cycle...
So I'd rather suggest to custom build your own binary from the latest FFmpeg Source...
Here's a script that could be used to generate one :
#!/bin/bash
echo ""
echo " ********** FFmpeg Android Build ********** "
echo ""
NDK=$HOME/android-ndk-r8d
PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86
PLATFORM=$NDK/platforms/android-14/arch-arm
PREFIX=$HOME/FFmpeg.Binaries.Android
FFMPEG_BASE=$HOME/FFmpeg.Build
if [ -d "$FFMPEG_BASE" ]; then
rm -v -r -f $FFMPEG_BASE
fi
if [ -d "$PREFIX" ]; then
rm -v -r -f $PREFIX
fi
mkdir $FFMPEG_BASE
mkdir $PREFIX
# x264 Installation
echo ""
echo " ********** libx264 Installation ********** "
echo ""
cd $FFMPEG_BASE
git clone --depth 1 git://git.videolan.org/x264
cd $FFMPEG_BASE/x264
./configure --prefix=$PREFIX \
--enable-static \
--enable-pic \
--disable-asm \
--disable-cli \
--host=arm-linux \
--cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \
--sysroot=$PLATFORM
make
sudo make install
sudo ldconfig
#FFmpeg Installation
echo ""
echo " ********** FFmpeg (Android) Installation ********** "
echo ""
cd $FFMPEG_BASE
# git clone --depth 1 git://source.ffmpeg.org/ffmpeg
cd $FFMPEG_BASE/ffmpeg
./configure --target-os=linux --prefix=$PREFIX \
--enable-cross-compile \
--enable-runtime-cpudetect \
--disable-asm \
--arch=arm \
--cc=$PREBUILT/bin/arm-linux-androideabi-gcc \
--cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \
--disable-stripping \
--nm=$PREBUILT/bin/arm-linux-androideabi-nm \
--sysroot=$PLATFORM \
--enable-nonfree \
--enable-version3 \
--enable-gpl \
--disable-doc \
--enable-avresample \
--enable-demuxer=rtsp \
--enable-muxer=rtsp \
--disable-ffserver \
--disable-ffprobe \
--enable-ffmpeg \
--enable-ffplay \
--enable-libx264 \
--enable-encoder=libx264 \
--enable-decoder=h264 \
--enable-protocol=rtp \
--enable-hwaccels \
--enable-zlib \
--extra-cflags="-I$PREFIX/include -fPIC -DANDROID -D__thumb__ -mthumb -Wfatal-errors -Wno-deprecated -mfloat-abi=softfp -mfpu=vfpv3-d16 -marm -march=armv7-a" \
--extra-ldflags="-L$PREFIX/lib"
make -j4 install
$PREBUILT/bin/arm-linux-androideabi-ar d libavcodec/libavcodec.a inverse.o
$PREBUILT/bin/arm-linux-androideabi-ld -rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -L$PREFIX/lib -soname libffmpeg.so -shared -nostdlib -z,noexecstack -Bsymbolic --whole-archive --no-undefined -o $PREFIX/libffmpeg.so libavcodec/libavcodec.a libavfilter/libavfilter.a libavresample/libavresample.a libavformat/libavformat.a libavutil/libavutil.a libswscale/libswscale.a -lc -lm -lz -ldl -llog -lx264 --warn-once --dynamic-linker=/system/bin/linker $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a
# rm -v -r -f $FFMPEG_BASE
clear
echo ""
echo "FFmpeg Android Build Successful..."
echo ""
ls -l -R $PREFIX
exit
For the above script to work, Android NDK is required and could be downloaded from here. Download the NDK and extract to your /home/<username> directory or else customize the script as per your needs...
And also avoid using the file:// protocol in the command line, just specify the absolute path of the input file. And try to log the output from the FFmpeg process by gettin' instances of its stdout and stderr streams...
You don't have to copy shared libraries and include folder. You can use the "PREBUILD_SHARED_LIBRARY" feature of Andriod.mk instead.