Failure when trying to cross-compile Erlang R13B04 for ARM - erlang

I am trying to cross-compile Erlang and running into a weird bug. The commands used are
make clean
./otp_build configure --host=arm-none-linux-gnueabi --build=i686-pc-linux-gnu
--prefix=/opt/erlang erl_xcomp_sysroot=~/sbctools/arm-2007q3 --disable-hipe
--disable-threads --disable-smp --disable-megaco-flex-scanner-lineno
--disable-megaco-reentrant-flex-scanner --disable-dynamic-ssl-lib
--without-termcap --without-javac --without-ssl
./otp_build boot
Their output can be seen at http://gist.github.com/576199 (it's too big to paste here), but the error which ends the process is
/home/aromanov/sbctools/arm-2007q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.2.1/../../../../arm-none-linux-gnueabi/bin/ld: /home/aromanov/otp_src/erts/emulator/zlib/obj/arm-none-linux-gnueabi/opt/libz.a(adler32.o): Relocations in generic ELF (EM: 3)
/home/aromanov/sbctools/arm-2007q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.2.1/../../../../arm-none-linux-gnueabi/bin/ld: /home/aromanov/otp_src/erts/emulator/zlib/obj/arm-none-linux-gnueabi/opt/libz.a(adler32.o): Relocations in generic ELF (EM: 3)
/home/aromanov/sbctools/arm-2007q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.2.1/../../../../arm-none-linux-gnueabi/bin/ld: /home/aromanov/otp_src/erts/emulator/zlib/obj/arm-none-linux-gnueabi/opt/libz.a(adler32.o): Relocations in generic ELF (EM: 3)
/home/aromanov/sbctools/arm-2007q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.2.1/../../../../arm-none-linux-gnueabi/bin/ld: /home/aromanov/otp_src/erts/emulator/zlib/obj/arm-none-linux-gnueabi/opt/libz.a(adler32.o): Relocations in generic ELF (EM: 3)
/home/aromanov/sbctools/arm-2007q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.2.1/../../../../arm-none-linux-gnueabi/bin/ld: /home/aromanov/otp_src/erts/emulator/zlib/obj/arm-none-linux-gnueabi/opt/libz.a(adler32.o): Relocations in generic ELF (EM: 3)
/home/aromanov/otp_src/erts/emulator/zlib/obj/arm-none-linux-gnueabi/opt/libz.a: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make[3]: *** [/home/aromanov/otp_src/bin/arm-none-linux-gnueabi/beam] Error 1
make[3]: Leaving directory `/home/aromanov/otp_src/erts/emulator'
make[2]: *** [opt] Error 2
make[2]: Leaving directory `/home/aromanov/otp_src/erts/emulator'
make[1]: *** [opt] Error 2
make[1]: Leaving directory `/home/aromanov/otp_src/erts'
make: *** [emulator] Error 2
Indeed, viewing ~/otp_src/erts/emulator/zlib/obj/arm-none-linux-gnueabi/opt/libz.a shows it's compiled for Intel 30386. But why? And how can I avoid it?
EDIT: ~/sbctools/arm-2007q3/bin is the first directory in the PATH. Do I perhaps need to add other toolchain directories as well?

make[4]: Entering directory /home/aromanov/otp_src/erts/emulator/zlib'
make -f arm-none-linux-gnueabi/Makefile TYPE=opt
make[5]: Entering directory/home/aromanov/otp_src/erts/emulator/zlib'
make[5]: Nothing to be done for all'.
make[5]: Leaving directory/home/aromanov/otp_src/erts/emulator/zlib'
make[4]: Leaving directory `/home/aromanov/otp_src/erts/emulator/zlib'
Looks like you've built zlib part before... when it was not correctly configured.
Try make clean or make distclean and then recompile.

Related

Can't activate Lua-support in freeswitch

If activating Lua-Support in modules.conf, ./configure, make , install yields the following error:
*
making install mod_lua
make[4]: Entering directory '/home/jklou/jkl/fs/freeswitch-1.8.2/src/mod/languages/mod_lua'
CXX mod_lua_la-mod_lua.lo
mod_lua.cpp:37:17: fatal error: lua.h: 没有那个文件或目录
compilation terminated.
Makefile:687: recipe for target 'mod_lua_la-mod_lua.lo' failed
make[4]: *** [mod_lua_la-mod_lua.lo] Error 1
make[4]: Leaving directory '/home/jklou/jkl/fs/freeswitch-1.8.2/src/mod/languages/mod_lua'
Makefile:679: recipe for target 'mod_lua-install' failed
make[3]: *** [mod_lua-install] Error 1
make[3]: Leaving directory '/home/jklou/jkl/fs/freeswitch-1.8.2/src/mod'
Makefile:587: recipe for target 'install-recursive' failed
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory '/home/jklou/jkl/fs/freeswitch-1.8.2/src'
Makefile:3257: recipe for target 'install-recursive' failed
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory '/home/jklou/jkl/fs/freeswitch-1.8.2'
Makefile:3729: recipe for target 'install' failed
make: *** [install] Error 2
*
so Lua cannot be used.
Google: Several Forums advise to refresh the GIT-repository, but this cannot be used because I need an older Version of freeswitch
I've found a solution:
apt-get install libreadline-dev apt-get install lua5.2 lua5.2-doc liblua5.2-dev
then copy LUA-sh-files to LUA-mod-directory of Freeswitch:
cp /usr/include/lua5.2/*.h [Installationsverzeichnis Freeswitch]]/src/mod/languages/mod_lua/
then link it:
sudo ln -s /usr/lib/x86_64-linux-gnu/liblua5.2.so /usr/lib/x86_64-linux-gnu/liblua.so
then repeat make install (don't repeat ./configure and make)
sudo make install
this worked perfectly for me (Freeswitch 1.8.2. and Ubuntu 18.04 LTS running in Virtual Box)

compile libffi on openwrt fatal error: sys/xattr.h: No such file or directory

when i build libffi on a SDK forwarded by linkit smart 7688,the error comes out,and i couldnt find any help by search.
libattr/attr_copy_fd.c:25:24: fatal error: sys/xattr.h: No such file or directory
Config-build.in:12603:warning: defaults for choice values not supported
Config-build.in:12619:warning: defaults for choice values not supported
Config-build.in:14019:warning: defaults for choice values not supported
Config-build.in:14499:warning: defaults for choice values not supported
warning: (boost-libs-all) selects boost-coroutine2 which has unmet direct dependencies (PACKAGE_boost && !GCC_VERSION_4_8)
warning: (boost-libs-all) selects boost-coroutine2 which has unmet direct dependencies (PACKAGE_boost && !GCC_VERSION_4_8)
\#
\# configuration written to .config
\#
make[1]: Entering directory '/home/color/mt7688'
make[2]: Entering directory '/home/color/mt7688/feeds/packages/libs/glib2'
make[2]: Leaving directory '/home/color/mt7688/feeds/packages/libs/glib2'
make[1]: Leaving directory '/home/color/mt7688'
Config-build.in:12603:warning: defaults for choice values not supported
Config-build.in:12619:warning: defaults for choice values not supported
Config-build.in:14019:warning: defaults for choice values not supported
Config-build.in:14499:warning: defaults for choice values not supported
warning: (boost-libs-all) selects boost-coroutine2 which has unmet direct dependencies (PACKAGE_boost && !GCC_VERSION_4_8)
warning: (boost-libs-all) selects boost-coroutine2 which has unmet direct dependencies (PACKAGE_boost && !GCC_VERSION_4_8)
\#
\# configuration written to .config
\#
make[1]: Entering directory '/home/color/mt7688'
make[2]: Entering directory '/home/color/mt7688/feeds/packages/utils/attr'
CFLAGS="-Os -pipe -mno-branch-likely -mips32r2 -mtune=24kec -mdsp -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -msoft-float -I/home/color/mt7688/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/include -I/home/color/mt7688/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/include -I/home/color/mt7688/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/usr/include -I/home/color/mt7688/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/include " CXXFLAGS="-Os -pipe -mno-branch-likely -mips32r2 -mtune=24kec -mdsp -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -msoft-float -I/home/color/mt7688/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/include -I/home/color/mt7688/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/include -I/home/color/mt7688/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/usr/include -I/home/color/mt7688/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/include " LDFLAGS="-L/home/color/mt7688/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/lib -L/home/color/mt7688/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/lib -L/home/color/mt7688/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/usr/lib -L/home/color/mt7688/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/lib " make -j1 -C /home/color/mt7688/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/attr-20170915/. AR="mipsel-openwrt-linux-uclibc-gcc-ar" AS="ccache_cc -c -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kec -mdsp -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -msoft-float" LD=mipsel-openwrt-linux-uclibc-ld NM="mipsel-openwrt-linux-uclibc-gcc-nm" CC="ccache_cc" GCC="ccache_cc" CXX="ccache_cxx" RANLIB="mipsel-openwrt-linux-uclibc-gcc-ranlib" STRIP=mipsel-openwrt-linux-uclibc-strip OBJCOPY=mipsel-openwrt-linux-uclibc-objcopy OBJDUMP=mipsel-openwrt-linux-uclibc-objdump SIZE=mipsel-openwrt-linux-uclibc-size CROSS="mipsel-openwrt-linux-uclibc-" ARCH="mipsel" ;
make[3]: Entering directory '/home/color/mt7688/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/attr-20170915'
CC libattr/libattr_la-attr_copy_fd.lo
****libattr/attr_copy_fd.c:25:24: fatal error: sys/xattr.h: No such file or directory
\# include <sys/xattr.h>
\^****
compilation terminated.
Makefile:929: recipe for target 'libattr/libattr_la-attr_copy_fd.lo' failed
make[3]: * [libattr/libattr_la-attr_copy_fd.lo] Error 1
make[3]: Leaving directory '/home/color/mt7688/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/attr-20170915'
Makefile:93: recipe for target '/home/color/mt7688/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/attr-20170915/.built' failed
make[2]: * [/home/color/mt7688/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/attr-20170915/.built] Error 2
make[2]: Leaving directory '/home/color/mt7688/feeds/packages/utils/attr'
package/Makefile:191: recipe for target 'package/feeds/packages/attr/compile' failed
make[1]: * [package/feeds/packages/attr/compile] Error 2
make[1]: Leaving directory '/home/color/mt7688'
/home/color/mt7688/include/toplevel.mk:174: recipe for target 'package/feeds/packages/glib2/compile' failed
make: * [package/feeds/packages/glib2/compile] Error 2
It seems the library you are looking for is not included in OpenWrt SDK by default.
Being this way you should look for it and add it manually. In my case I have the libraries inside the folder $ROOT_DIR/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/include, so you should find and add mannualy xattr.h and move it to $ROOT_DIR/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/include/sys.

foreach & silencer in a makefile target

I am using a foreach in a makefile for a particular target.
my_Target:
$(foreach x,$(MY_TARGET_DIRS), #echo " BUILD $(x)";$(Q)$(MAKE) --directory=$(x) LIB_DIR=$(MY_LIB_DIR) $(MY_TARGET_RULES); )
This is intended call the makefiles contained every specified directory of MY_TARGET_DIRS, after a string has been printed to tell which build is ongoing.
The Q variable is defined as follows:
# Silent per default, 'make V=1' shows all compiler calls.
ifneq ($(V),1)
Q := #
endif
So that the make command is verbose if V=1 is defined.
For V=1 the output log is:
make my_Target V=1
BUILD /dir1
make[1]: Entering directory `/dir1'
make[1]: Nothing to be done for `elf'.
make[1]: Nothing to be done for `bin'.
make[1]: Leaving directory `/dir1'
/bin/sh: #echo: command not found
make[1]: Entering directory `/dir2'
make[1]: Nothing to be done for `elf'.
make[1]: Nothing to be done for `bin'.
make[1]: Leaving directory `/dir2'
While if I do not define V=1, the output log is:
make my_Target
BUILD /dir1
/bin/sh: #make: command not found
/bin/sh: #echo: command not found
/bin/sh: #make: command not found
make: *** [my_Target] Error 127
How can I get the behavior I desire correctly?
Bye!
Put the # ($(Q)) at the beginning of the recipe:
my_Target:
$(Q)$(foreach x,$(MY_TARGET_DIRS), echo " BUILD $(x)";$(MAKE) --directory=$(x) LIB_DIR=$(MY_LIB_DIR) $(MY_TARGET_RULES); )
Notice that the foreach will ouptut a single recipe line, and the # will apply to all of it. An alternative, if you want to get more fancy is to create a rule for each of the target dirs:
MY_TARGET_DIRS_TARGS=$(MY_TARGET_DIRS:%=%/.phony)
my_Target: $(MY_TARGET_DIRS_TARG)
$(MY_TARGET_DIRS_TARGS):
#echo " BUILD $(x)"
$(Q)(MAKE) --directory=$(x) LIB_DIR=$(MY_LIB_DIR) $(MY_TARGET_RULES);
.PHONY: $(MY_TARGET_DIRS_TARGS)

Error: File format not recognized

I'm using a Raspberry Pi 2 running Ubuntu MATE 15.10 to work on a project.
I'm trying to run a makefile and got this error
/home/dpanagou/Quadrotors/Vicon/libs/libViconDataStreamSDK_CPP.so: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
Makefile:8: recipe for target '../bin/Vicon_state' failed
make[1]: *** [../bin/Vicon_state] Error 1
make[1]: Leaving directory '/home/dpanagou/Quadrotors/HLP/Vicon'
Makefile:40: recipe for target 'Vicon' failed
make: *** [Vicon] Error 2
I've also tried make clean before make.
From research, a lot of people have suggested that the object file might be corrupted. So I downloaded new files from the developer and ran the makefile again. I still get the same error.
Here is my makefile:
CUR_DIR = $(shell pwd)
CFLAGS = `pkg-config --cflags lcm`
LDFLAGS = `pkg-config --libs lcm` ../src/filter_util.o ../src/util.o
vicon_lib = $(CUR_DIR:%/HLP/Vicon=%/Vicon/libs)
../bin/Vicon_state:
g++ $(CFLAGS) Vicon_state_data.cpp -o ../bin/Vicon_state -Wl,- rpath=../../Vicon/libs -L$(vicon_lib) -lViconDataStreamSDK_CPP -lDebugServices $(LDFLAGS)
Please help with specific instructions as I am very new to Linux and programming.
Check the format of the file with the "file" command, and compare it to the format of any .so that comes with rpi.
I'm not 100% sure, but might it be that the library is for raspbian with its v6 compatible HF vs generic V7-only HF in debian?

asm/socket.h: No such file or directory cross compiling Dart for Raspberry pi

I'm cross-compiling the Dart runtime using the instruction here.
I've installed all the dependencies as specified. I've also cloned the git repository with the necessary tool chain.
I'm running the runtime compilation with this command:
./tools/build.py -m release -a arm --toolchain=../tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf runtime
The compilation starts with no problem then it stops with this error:
LINK(target) out/ReleaseXARM/libdart_dependency_helper.target
CXX(host) out/ReleaseXARM/obj.host/libdart_lib_withcore/runtime/vm/bootstrap.o
In file included from /usr/include/sys/socket.h:38:0,
from /usr/include/netinet/in.h:23,
from /usr/include/arpa/inet.h:22,
from runtime/platform/globals.h:56,
from runtime/platform/assert.h:16,
from runtime/vm/allocation.h:8,
from runtime/vm/bootstrap.h:9,
from runtime/vm/bootstrap.cc:5:
/usr/include/bits/socket.h:345:24: fatal error: asm/socket.h: No such file or directory
#include <asm/socket.h>
^
compilation terminated.
CXX(host) out/ReleaseXARM/obj.host/libdart_lib_withcore/gen/async_gen.o
In file included from /usr/include/sys/socket.h:38:0,
from /usr/include/netinet/in.h:23,
from /usr/include/arpa/inet.h:22,
from runtime/platform/globals.h:56,
from runtime/platform/assert.h:16,
from runtime/vm/allocation.h:8,
from runtime/vm/bootstrap.h:9,
from out/ReleaseXARM/obj/gen/async_gen.cc:5:
/usr/include/bits/socket.h:345:24: fatal error: asm/socket.h: No such file or directory
#include <asm/socket.h>
^
compilation terminated.
runtime/libdart_lib_withcore.host.mk:978: recipe for target 'out/ReleaseXARM/obj.host/libdart_lib_withcore/runtime/vm/bootstrap.o' failed
make: *** [out/ReleaseXARM/obj.host/libdart_lib_withcore/runtime/vm/bootstrap.o] Error 1
make: *** Waiting for unfinished jobs....
runtime/libdart_lib_withcore.host.mk:986: recipe for target 'out/ReleaseXARM/obj.host/libdart_lib_withcore/gen/async_gen.o' failed
make: *** [out/ReleaseXARM/obj.host/libdart_lib_withcore/gen/async_gen.o] Error 1
BUILD FAILED
Am I missing any dependency or package?
I hit the same problem. On my ubuntu 14.04 system /usr/include/asm didn't exist. It was called asm-generic instead. I sym-linked it and the build was able to continue.
cd /usr/include
sudo ln -s asm-generic/ asm
The build was able to continue after that.
This is probably because you're trying to build an application without some of the include paths correctly set, for example using a 32-bit gcc on a 64-bit platform.
To resolve:
sudo apt-get install gcc-multilib
I'm not sure why this happens, but sometimes /usr/include/asm gets deleted. My teammates who looked at their Ubuntu x86-64 workstations found that the asm symlink was:
0 lrwxrwxrwx 1 root root 20 May 22 2013 /usr/include/asm -> x86_64-linux-gnu/asm
And the command to recreate it is:
$ cd /usr/include
$ sudo ln -s x86_64-linux-gnu/asm asm
The files in /usr/include/asm-generic are sometimes, but not always, equivalent to the files in the x86-64 specific directory; so it's difficult to recommend symlinking it as a workaround.

Resources