LuaJIT build failed with NDK, CentOS - android-ndk

I tried to build LuaJIT with Android NDK as the official guide. But some problems happened. I have search for 2 days but can't solve them.
Here's my build.sh:
NDK=/opt/android/ndk
NDKABI=14
NDKVER=$NDK/toolchains/arm-linux-androideabi-4.9
NDKP=$NDKVER/prebuilt/linux-x86_64/bin/arm-linux-androideabi-
NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-arm"
NDKARCH="-march=armv7-a -mfloat-abi=softfp -Wl,--fix-cortex-a8"
make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF $NDKARCH"
I'm sure the NDK path is correct and has be added to the environment variables. Also, the build.sh is in the correct place. And gcc has be installed. When I run the build.sh, some errors happened:
==== Building LuaJIT 2.0.5 ====
make -C src
gcc: Command not found/bin/arm-linux-androideabi-
make[1]: Entering directory `/root/LuaJIT-2.0.5/src'
gcc: Command not found/bin/arm-linux-androideabi-
gcc: Command not found/bin/arm-linux-androideabi-
gcc: Command not found/bin/arm-linux-androideabi-
gcc: Command not found/bin/arm-linux-androideabi-
gcc: Command not found/bin/arm-linux-androideabi-
Makefile:254: *** Unsupported target architecture. Stop.
make[1]: Leaving directory `/root/LuaJIT-2.0.5/src'
make: *** [default] Error 2
I have try my best but have no idea. Please help me, thanks.

I have solved it. Looks like the error caused by the variable reference. I just tried to write all the parameters in one line and it worked.
make HOST_CC="gcc -m32" CROSS=/opt/android/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi- TARGET_FLAGS="--sysroot=/opt/android/ndk/platforms/android-14/arch-arm -march=armv7-a -mfloat-abi=softfp -Wl,--fix-cortex-a8"
I'm not very good at shell so I don't know how to use variables even now. Fortunately, I have built the LuaJIT successfully.

Related

Kernel module on cross-compile kernel: /bin/sh: 1: scripts/basic/fixdep: Exec format error

I'm doing some experiment on rpi4, and trying to reproduce this kernel module from github https://github.com/sysprog21/dont-trace on my rpi4. I encounter this problem:
make -C /lib/modules/`uname -r`/build M=/home/ubuntu/dont-trace modules
make[1]: Entering directory '/usr/src/linux-headers-5.15.65-rt49-preemptrt-full-raspi'
warning: the compiler differs from the one used to build the kernel
The kernel was built by: aarch64-linux-gnu-gcc (Debian 10.2.1-6) 10.2.1 20210110
You are using: gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0
CC [M] /home/ubuntu/dont-trace/dont_trace.o
/bin/sh: 1: scripts/basic/fixdep: Exec format error
make[2]: *** [scripts/Makefile.build:289: /home/ubuntu/dont-trace/dont_trace.o] Error 126
make[2]: *** Deleting file '/home/ubuntu/dont-trace/dont_trace.o'
make[1]: *** [Makefile:1896: /home/ubuntu/dont-trace] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.15.65-rt49-preemptrt-full-raspi'
make: *** [Makefile:7: all] Error 2
The kernel here is cross-compiled from x86 server and do show above. I was wondering how to solve this problem & what's the root cause. I can make it on x86 server. It should be something fundamental knowledge I don't understand. Thks!
it seems work this time
My solution might be a bit workaround, but it works. I follow the clues /bin/sh: 1: scripts/basic/fixdep: Exec format error. So I copy the source code to local raspberry pi, and make modules_prepare to construct complete /scripts, then move it into /lib/modules/`uname -r\`/build. It remain the gcc version warning, but work properly.

Asterisk make crashes with cannot find -lwebrtc-x86_64-unknown-linux-gnu

I do ./configure with-pjproject-bundled, and it runs OK. Then, I issue make, and it crashes with cannot find -lwebrtc-x86_64-unknown-linux-gnu. Full stack here:
CC="cc" CXX="g++" LD="" AR="" RANLIB="" CFLAGS="" LDFLAGS="" make -C
menuselect CONFIGURE_SILENT="--silent" makeopts
make[1]: Entering directory `/usr/local/asterisk-14.4.0/menuselect'
make[1]: `makeopts' is up to date.
make[1]: Leaving directory `/usr/local/asterisk-14.4.0/menuselect'
Generating input for menuselect ...
menuselect/menuselect --check-deps menuselect.makeopts
menuselect/menuselect --check-deps menuselect.makeopts
Generating embedded module rules ...
[LD] libasteriskpj.o -> libasteriskpj.so.2
/usr/bin/ld: cannot find -lwebrtc-x86_64-unknown-linux-gnu
collect2: error: ld returned 1 exit status
make[1]: *** [libasteriskpj.so.2] Error 1
make: *** [main] Error 2
I use RedHat 7.3 and Asterisk 14.4.
If I do ./configure without parameters, then make runs without an error. What am I doing wrong?
You’re simply missing a library. Run this command to install it:
yum install webrtc-audio-processing-devel
Then clear out your settings before running configure again:
make clean all
I’m not at my computer now but I believe there’s a script bundled with the code that installs all the dependencies for you. Might be worth checking out.

GCC 5.3 failing in the make phase

Currently I have GCC 5.4.0-6 installed on my Ubuntu 16.04.4 machine. However nvcc wants me to use 5.3, so I am trying to install that version as well. I did this by:
1. downloading gcc-5.3.0.tar.gz
2. extracting it to ~/Documents/libraryDownloads/GCC-5/gcc-5.3.0
3. creating the folder ~/Documents/libraryDownloads/GCC-5/gcc-build
4. In ~/Documents/libraryDownloads/GCC-5/gcc-5.3.0 I used the command ./contrib/download_prerequisites.
5. In ~/Documents/libraryDownloads/GCC-5/gcc-build I used the command ./../gcc-5.3.0/configure --enable-multilib
6. and finally in ~/Documents/libraryDownloads/GCC-5/gcc-build I used the command make
The make-process rand for a short while and then ended with the following error:
checking whether the gcc -m32 linker (ld -m elf_x86_64 -m elf_i386) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.
Makefile:10699: recipe for target 'configure-stage1-zlib' failed
make[2]: *** [configure-stage1-zlib] Error 1
make[2]: Leaving directory '/home/myUser/Documents/libraryDownloads/GCC-5/gcc-build'
Makefile:22461: recipe for target 'stage1-bubble' failed
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory '/home/myUser/Documents/libraryDownloads/GCC-5/gcc-build'
Makefile:902: recipe for target 'all' failed
make: *** [all] Error 2
As far as I know, I have all prerequisites installed and I am doing all this in a separate build folder as recommended. I tried searching for error: Link tests are not allowed after GCC_NO_EXECUTABLES., but I couldn't find anyone with similar problems. Does anyone know what could be the cause of this error?

gcc 4.8.1 will not make

I have a new installation of Ubuntu linux and I am trying to update my gcc complier. The latest gcc compiler depends on gmp, mpfr, and mpc, so I downloaded those and placed the source into the gcc 4.8.1 source folder, as instructed.
configure seems to have run just fine. I did not include any options, because none seemed appropriate. I just ran with the defaults.
When I run make, I get the following error:
configure: error: C++ compiler missing or inoperational
make[2]: \*** [configure-stage1-libcpp] Error 1
make[2]: Leaving directory `/home/clay/programming/C++/gcc-4.8.1'
make[1]: \*** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/clay/programming/C++/gcc-4.8.1'
make: \*** [all] Error 2
I am running out of a terminal window as root, and I did a make distclean and tried a second time, but no dice. I know it can find both gcc and cc because it says so in the make output.
Any ideas?
You need a C++ compiler to build GCC. On Ubuntu, the C++ compiler is in the package g++, separate from gcc (which is a C compiler, not a C++ compiler), so be sure to:
sudo apt-get install g++
first you should ensure a C++ compiler to build on your machine
yum install gcc-c++

Building icu4c fails due to missing findBasename

I try to cross-compiler icu4c 51.1 with Emscripten (clang) via
emconfigure source/configure --host=i386-pc-linux-gnu --prefix=${myprefix} --enable-static --disable-shared --disable-dyload --disable-renaming CXXFLAGS='-DU_USING_ICU_NAMESPACE=0' CPPFLAGS='-DU_DISABLE_RENAMING=1'
emmake make
emmake make install
It compiles most of the sources fine, but fails with
Unpacking ../source/data/in/icudt51l.dat and generating out/tmp/icudata.lst (list of data files)
LD_LIBRARY_PATH=../lib:../stubdata:../tools/ctestfw:$LD_LIBRARY_PATH ../bin/icupkg -d ./out/build/icudt51l --list -x \* ../source/data/in/icudt51l.dat -o out/tmp/icudata.lst
run-detectors: warning: unable to exec /usr/bin/lli-2.8: No such file or directory
run-detectors: warning: unable to exec /usr/bin/lli-2.9: No such file or directory
LLVM ERROR: Program used external function 'findBasename' which could not be resolved!
make[1]: *** [out/tmp/icudata.lst] Error 1
make[1]: Leaving directory `/home/andreas/.emscripten-libs/sources/icu4c/51.1/data'
make: *** [all-recursive] Error 2
So I am wondering, where it tries to find findBasename and what this data compiling is all about.
EDIT:
The error messages come from icupkg being built with clang, which does not make sense in this case. How can I specifc that the libraries are built with clang, but the tools with another compiler?
Sounds like it wasn't able to find, I'm guessing, ICU tool utilities lib in ../lib - might try running ldd or equivalent on icupkg

Resources