Help, Leia ate my binaries / WirigPi and 433Mhz remote on Odroid C2

  • Dear all,

    I upgraded from Krypton to Leia this week. Despite the usual minor and unimportant glitches on a release change all went well. Kodi immediately worked and played some test videos just fine. But I ran into a problem where I had not expected one. I had some program binaries for WiringPi and a remote sender that ran fine in the previous release. These were stored in a selfmade "addon" and where left untouched by the upgrade. Now they don't work anymore for reasons I cannot explain. ?(

    I don't think it is of importance, but Leia runs on an Odroid C2.

    When I open a console via SSH, go to the program folder and try to run the binaries, I get a confusing error.

    Odroid:~/.kodi/addons/service.wiringPi/bin # ./gpio

    -sh: ./gpio: not found

    Not found?? The file is just there. And look Leia, it's even executable!

    Odroid:~/.kodi/addons/service.wiringPi/bin # ls -Alh

    -rwxr-xr-x 1 root root 48.6K Mar 31 03:40 gpio

    I already tried rebuilding the programs from source ( git://http://github.com/hardkernel/wiringPi , and git://http://github.com/xkonni/raspberry-remote.git for the interested ), but to no avail.

    Do you have an idea where the problem is?

  • You mean directly in the program's folder or in /bin ?

    In the program folder it results in this:

    Odroid:~/.kodi/addons/service.wiringPi/bin # .gpio

    -sh: .gpio: not found

    But wouldn't calling .gpio refer to another binary named ".gpio" instead of the file "gpio" I have?

    If you mean ./gpio, that is what I did originally. Also returns "not found".

    In /bin nothing works either. .gpio and gpio return "not found", and of course ./gpio does, too.

    I'm pretty sure it is not a simple syntax error. Either something changed in the core which renders the executables useless (but then why "not found"?) or for some reason the executables are hidden for the shell. But where could I place them to cross that out?

  • Are you sure you are using correct addon for Odroid? You could get not found when binary is used for wrong architecture or something else is wrong with the binary.

    Btw: you need to use ./gpio or gpio if file is on the path (which is after log out and log back in).

    Did you made this addon yourself?

  • You mean directly in the program's folder or in /bin ?

    In the program folder it results in this:

    Odroid:~/.kodi/addons/service.wiringPi/bin # .gpio

    -sh: .gpio: not found

    The space between the point and the program name is missing at your command.

    Do "<point><space>gpio" in the folder of your program. Or use the full path:

    Code
    . <full-path-to-folder>/gpio
  • The space between the point and the program name is missing at your command.

    Ah, indeed I overlooked the space. With space at least I get a new error syntax error: unexpected word (expecting ")")

    Unfortunately that doesn't really help me any further...

    I think the problem is that gpio binary is build for wrong arch (arm/aarch64).

    Did the arch change from Krypton to Leia? As I wrote the binary ran perfectly well under Krypton.

    I already did try to rebuild (as aarch64). Should that be aarch32? At least uname says aarch64.

    I did not take notes back when I compiled the old – then working – binary, what exactly the settings were. My bad!

  • Now I see the difference:

    Code
    LibreELEC-Odroid_C2.aarch64-8.2.5.img.gz
    ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 3.7.0, stripped
    
    LibreELEC-Odroid_C2.arm-9.0.1.img.gz
    ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 3.2.0, stripped

    So just build addon correctly and it will work again in LE 9 too :)

  • Ok, it took me quite a while and I'm still surprised how complicated it is to correctly compile binaries for the Odroid/LE9.

    For the record and possibly others, trying to achieve something similar, here is what I did:

    • Installed Oracle Virtualbox on a PC (any other VM should do, too)

    • Set up a Ubuntu VM

    • Downloaded the LE source and built it for the Odroid (with "PROJECT=Amlogic DEVICE=Odroid_C2 ARCH=arm" like described here) – this took serveral hours!

    • Downloaded Hardkernel's WiringPi from Github. There I adjusted the makefiles to use /path/to/toolchain/arm-something-libreelec-linux-gnueabi-gcc instead of the default gcc, install to a temporary folder instead of /usr/local/... , and adjusted the library and LD paths to this temporary directory.

    e.g. Makefile for ./wiringPi/gpio:

    #…Leading annotations yadda yadda

    #################################################################################

    CFLAGS = $(DEBUG) -Wall -Wextra $(INCLUDE) -Winline -pipe

    DESTDIR?=/home/username/build/compiled/usr

    PREFIX?=/local

    ifneq ($V,1)

    Q ?= @

    endif

    #DEBUG = -g -O0

    DEBUG = -O2

    CC = /home/username/build/libreelec/build.LibreELEC-Odroid_C2.arm-9.0-devel/toolchain/bin/armv8a-libreelec-linux-gnueabi-gcc

    INCLUDE = -I$(DESTDIR)$(PREFIX)/include

    LDFLAGS = -L$(DESTDIR)$(PREFIX)/lib

    # May not need to alter anything below this line


    In the end I got working files for WiringPi. Hooray!! :)


    This whole cross compiling thing is still quite new to me, and I'm struggling with compiling raspberry remote (raspberry-remote) though. It gives me an error make: *** No rule to make target 'RCSwitch.o', needed by 'send'. Stop., which I don't understand. I tried adjusting the compiler, library and LD paths like with WiringPi, but the compiler just won't digest my makefile. Any advice is greatly appreciated.

    Makefile for raspberry-remote

    DESCRIPTION = "RCSwitch on Raspberry Pi"

    LICENSE = "GPL"

    VERSION = 1.0

    CXX = "/home/username/build/libreelec/build.LibreELEC-Odroid_C2.arm-9.0-devel/toolchain/bin/armv8a-libreelec-linux-gnueabi-cpp"

    DESTDIR?=/home/username/build/compiled/usr

    PREFIX?=/local


    INCLUDE = -I$(DESTDIR)$(PREFIX)/include

    CXXFLAGS += -Wall $(INCLUDE)

    LDFLAGS = -L$(DESTDIR)$(PREFIX)/lib

    LIBS = -lwiringPi -lwiringPiDev

    default: send

    send: RCSwitch.o send.o

    $(CXX) $+ -o $@ $(CXXFLAGS) $(LDFLAGS) $(LIBS)


    • Official Post

    "No rule to make target" means you're calling "make <something>" and <something> doesn't exist in the "Makefile" in the sources.

    e.g. Makefile provides build targets for apples, pears and organges, but you're running "make apricots" which doesn't exist.

  • Thank you for the quick answer!

    While this was not exactly the problem you still set me on the right track. Turned out that somewhere in trying to set up the makefile I unintentionally deleted the file "RCSwitch.cpp" and only left the .h file there. Also 'git pull' didn't restore the missing file. Now I got everything back to the original state (except the makefile of course) and can resume with the next error. :S But this one really seems to be more related to all that cross compiling thing...

    armv8a-libreelec-linux-gnueabi-cpp: fatal error: '-c' is not a valid option to the preprocessor

    Changing the compiler from …cpp to …c++ resolves it. Now I only had to iron out what was seemingly an error in the source:

    Code
    undefined reference to `pthread_join'
    collect2: error: ld returned 1 exit status

    So adding -pthread to the compiler command finally produced a file! ^^

    Now I need to test if it works as supposed and then maybe this problem is finally solved.

    Will check back and document for the interested.