Xymon Mailing List Archive search

cross compilation and endianness detection

4 messages in this thread

list Damien Martins · Sun, 1 Jul 2018 21:39:06 +0200 ·
Hi,

I'm trying to compile xymon client for several OpenWRT devices (www.openwrt.org).
Most targets are MIPS-based.
When trying to compile, I encounter the following error:
xymon-4.3.28$ make CC=mips-openwrt-linux-musl-gcc LD=mips-openwrt-linux-musl-ld
CC="mips-openwrt-linux-musl-gcc" CFLAGS="-g -O2 -Wall -Wno-unused -D_REENTRANT -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DLINUX -I`pwd`/include -DCLIENTONLY=1" LDFLAGS="" OSDEF="-DLINUX" RPATHOPT="-Wl,--rpath," PCREINCDIR="" ZLIBINCDIR="" SSLFLAGS="" SSLINCDIR="" SSLLIBS="" NETLIBS="" LIBRTDEF="" XYMONTOPDIR="/var/lib/xymon" XYMONHOME="/var/lib/xymon" XYMONCLIENTHOME=/var/lib/xymon XYMONLOGDIR="" XYMONHOSTNAME="" XYMONHOSTIP="A.B.C.D" XYMONHOSTOS="" LOCALCLIENT="no" make -C lib client
make[1] : entering « /home/src/xymon-4.3.28/lib »
mips-openwrt-linux-musl-gcc -g -O2 -Wall -Wno-unused -D_REENTRANT -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DLINUX -I/home/src/xymon-4.3.28/include -DCLIENTONLY=1 -I../include `./test-endianness` -c -o sha1.o sha1.c
/bin/sh: 1: ./test-endianness: Exec format error
sha1.c:38:2: error: #error "Endianness is UNDEFINED"

This part is far beyond my computers skills, so I'm requesting some help :)
list Christian Herzog · Tue, 3 Jul 2018 16:09:25 +0200 ·
Hi Damien,

I just checked and test-endianness is compiled from test-endianness.c - for
some reason the one you have doesn't seem to work for you. Can you just do

gcc -o test-endianness test-endianness.c

and see if that works better?

best,
-Christian
list Damien Martins · Tue, 3 Jul 2018 16:20:31 +0200 ·
Hi  Christian,

In fact, test-endianness is compiled using OpenWRT toolchain for cross compilation, so it can not be executed on my local computer (the compiler host, not the target). I compiled the test-endianness.c file, and uploaded the resulting binary to my target OS. I executed it successfully and retrieved the value, then inserted in in lib/Makefile file. For cross compilation purpose, should be good to be able to pass the endianness information during the "configure" execution.
quoted from Christian Herzog


Le 03/07/2018 à 16:09, Christian Herzog a écrit :
Hi Damien,

I just checked and test-endianness is compiled from test-endianness.c - for
some reason the one you have doesn't seem to work for you. Can you just do

gcc -o test-endianness test-endianness.c

and see if that works better?

best,
-Christian
-- 

Cordialement,
Damien Martins
list Damien Martins · Tue, 3 Jul 2018 16:28:30 +0200 ·
Moreover, I faced this issue:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=887633

and used Debian xymon-4.3.28-3 sources to compile successfully.
quoted from Damien Martins


Le 03/07/2018 à 16:20, Damien Martins a écrit :
Hi Christian,

In fact, test-endianness is compiled using OpenWRT toolchain for cross compilation, so it can not be executed on my local computer (the compiler host, not the target). I compiled the test-endianness.c file, and uploaded the resulting binary to my target OS. I executed it successfully and retrieved the value, then inserted in in lib/Makefile file. For cross compilation purpose, should be good to be able to pass the endianness information during the "configure" execution.


Le 03/07/2018 à 16:09, Christian Herzog a écrit :
Hi Damien,

I just checked and test-endianness is compiled from test-endianness.c - for
some reason the one you have doesn't seem to work for you. Can you just do

gcc -o test-endianness test-endianness.c

and see if that works better?

best,
-Christian
-- 
Cordialement,
Damien Martins