Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run make_release_linux.sh #14

Open
racroi3010 opened this issue Dec 1, 2016 · 25 comments
Open

run make_release_linux.sh #14

racroi3010 opened this issue Dec 1, 2016 · 25 comments

Comments

@racroi3010
Copy link

Dear Team,

I run make_release_linux.sh to build on Linux, but it's failed

cannot stat ‘commandline/makemake/hidusb-relay-cmd’: No such file or directory

I think there are some missing files, could you please help me solve it?

Best regards.

@pavel-a
Copy link
Owner

pavel-a commented Jan 2, 2017

Run make_release_linux.sh after successful build. This script does not build, it only copies build products.

@rochajoel
Copy link

the file name is therefore a 'lie' or at least 'misleading', i would at least expect it to MAKE (what?) a RELEASE (for what?) LINUX.
Pavel, i think i'll make a fork of this and contribute with my understanding of this project, thank you for making this sources available, hope you can contribute further!
Thanks!

@pavel-a
Copy link
Owner

pavel-a commented Mar 17, 2017 via email

@rochajoel
Copy link

I already did, i'm not an expert on using git, but i tried to make a linux folder on my fork, and added a Makefile on that root folder, have a look at it if you'd like. Given what i have on my fork, all we need is to deploy libusb artifacts to include/usb and to lib/usb/x86 to be able to build the relay cmd utility.

@pavel-a
Copy link
Owner

pavel-a commented Mar 17, 2017 via email

@rochajoel
Copy link

Great! If you like my changes be my guest to push them to your repository!

Cheers, Joel.

@zeeshan-k
Copy link

How to build command line version on linux? I tried cd commandline/makemake && make as given in the wiki but encountered following error:

make: libusb-config: Command not found
make: libusb-config: Command not found
gcc -O -Wall -I.. -I../../lib -fPIC -c -o usbrelay-cmd.o ../usbrelay-cmd.c
../usbrelay-cmd.c: In function ‘enumFunc’:
../usbrelay-cmd.c:84:2: warning: statement with no effect [-Wunused-value]
(context); // ~ unreferenced warning
^
gcc -O -Wall -I.. -I../../lib -fPIC -c -o hiddata_libusb01.o ../hiddata_libusb01.c
../hiddata_libusb01.c:14:17: fatal error: usb.h: No such file or directory
compilation terminated.
: recipe for target 'hiddata_libusb01.o' failed
make: *** [hiddata_libusb01.o] Error 1

@rochajoel
Copy link

Please have a look at my repository https://github.com/rochajoel/usb-relay-hid

As i have run into the same issue, i contributed with a makefile capable of building the cmd line utility. You are still required to build libusb on your own and to put it on the correct paths,

see my repository for more details.

@pavel-a
Copy link
Owner

pavel-a commented Apr 12, 2017 via email

@rochajoel
Copy link

rochajoel commented Apr 13, 2017

You DON'T NEED libusb installed on your system, AS LONG AS you have the libraries.

See this:
https://github.com/rochajoel/usb-relay-hid/tree/master/linux/include/usb
https://github.com/rochajoel/usb-relay-hid/tree/master/linux/lib/usb/x86

If i wanted to have support for ARM, i would have to cross-compile libusb for ARM and include it in (...)linux/lib/usb/arm to be able to compile this utility

If you want to cross-compile run:

ARCH=arm make clean all

I never tested it, but any feedback is welcome! :)

@zeeshan-k
Copy link

Thanks @pavel-a I installed libusb-dev and the build succeeded.

@zeeshan-k
Copy link

zeeshan-k commented Apr 15, 2017

@rochajoel I will try your method on another linux machine and update soon.

@mengzhuo
Copy link

mengzhuo commented Nov 5, 2017

@rochajoel cross compile won't work

ARCH=arm make clean all

host

Linux web1 4.10.17-041017-generic #201705201051 SMP Sat May 20 14:53:33 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

target
Linux RT-AC68U 2.6.36.4brcmarm #16 SMP PREEMPT Sun May 28 12:34:56 CST 2017 armv7l ASUSWRT-Merlin

@rochajoel
Copy link

Thank you for the negative feedback. However, the reason why the build fails is unclear to me. Can you be more specific?

@mengzhuo
Copy link

mengzhuo commented Nov 5, 2017

@rochajoel

root@web1:~/usb-relay-hid/commandline/makemake# ARCH=arm make clean all

rm -f *.o hidusb-relay-cmd usb_relay_device.so
gcc -O -Wall   -I.. -I../../lib -fPIC   -c -o usbrelay-cmd.o ../usbrelay-cmd.c
gcc -O -Wall   -I.. -I../../lib -fPIC   -c -o hiddata_libusb01.o ../hiddata_libusb01.c
gcc -o hidusb-relay-cmd usbrelay-cmd.o hiddata_libusb01.o -L/usr/lib/x86_64-linux-gnu -lusb
gcc -O -Wall   -I.. -I../../lib -fPIC   -c -o usb_relay_lib.o ../../lib/usb_relay_lib.c
../../lib/usb_relay_lib.c: In function ‘usb_relay_device_enumerate’:
../../lib/usb_relay_lib.c:382:9: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
     int ret;
         ^
../../lib/usb_relay_lib.c: At top level:
../../lib/usb_relay_lib.c:74:20: warning: ‘usbErrorMessage’ defined but not used [-Wunused-function]
 static const char *usbErrorMessage(int errCode)
                    ^
gcc -shared -Wl,-shared hiddata_libusb01.o usb_relay_lib.o -L/usr/lib/x86_64-linux-gnu -lusb -o usb_rela
y_device.so

and I copy hidusb-relay-cmd to my router

admin@RT-AC68U:/mnt/sda# ./hidusb-relay-cmd
bash: ./hidusb-relay-cmd: cannot execute binary file: Exec format error

@rochajoel
Copy link

Your build is probably not using any cross compiler such as arm-linux-gnueabi-gcc (or something of the like). It uses plain gcc. Are you using the sources from my fork of this repository? It's been a long time since i've looked into this. Please inspect my makefile and make sure it contains instructions to use a cross-compiler. (Maybe you have to define it?)

Any way. The problem is that you are not cross compiling. Use readelf or ldd to inspect the output binary so that you know it is in the proper ARM format.

@rochajoel
Copy link

If you look closely into my Makefile, it does not declare the ARM GCC compiler, it just has some statements that help you organize the libs in folders preceeded by the name of the arch you are targeting. It is hard coded to work with GCC so, either you create a sym link of GCC to your cross compiler, or you change the CC definition to your cross compiler name. You can even change it so that if ARCH == x86 it uses gcc, otherwise it will use arm-linux-****-gcc.

Also: from your log i can see you are probably forgetting to cross compile libusb!
Compile it and add the library to the proper lib folder. If you are going to use 'arm' as ARCH=arm, you have to put it under 'lib/usb/arm'.

@ekakela
Copy link

ekakela commented Mar 25, 2018

Is there ARM binary available or any instructions how to compile this on Raspberry Pi?

@mengzhuo
Copy link

@ekakela if you like Golang , you can try my lib
https://github.com/mengzhuo/go-usb-relay
no cross compile issue

@rochajoel
Copy link

https://github.com/ekakela : I think one can manage to build this for ARM, at least i think i did (it's been a while and i did not save the bin) however, you have to change some stuff as i say in the previous comments above.
I'm not saying for sure it will work on your case (i never tried) but that there is a chance you can build it using the sources available at my branch.

@ekakela
Copy link

ekakela commented Mar 26, 2018

Managed to get it working with your branch.

@deurenkletser
Copy link

Can someone help me with more instructions to run this on a respberrypi? I copied rochajoel git to /domoticz/scripts/ but it's unable to run... I also used input from this git: https://github.com/bbqkees/Domoticz-Pi-USB8-relay-board-SOS-solutions. I have that board I want to run on the pi. But it's always giving this error:

image

@rochajoel
Copy link

rochajoel commented Aug 2, 2018

Have you built the executable? Please make sure to build it before you try to run it.

And if you run into some issue, please post the build log so that we can help.

Thanks!

@pavel-a
Copy link
Owner

pavel-a commented Aug 2, 2018

Of course. There is no such file usbrelay-cmd. The correct name is hidusb-relay.cmd.

Regards,
P.

@deurenkletser
Copy link

Ik was following BBQkees instructions to get this to run. Where can I find more instructions on how you build this on the pi? Or does someone know where i can find more on how they build/compile. I now some Linux commands but nothing from programming. Sorry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants