PORTS Forum
Ports and Interfaces => USB => Topic started by: powerboy2988 on April 03, 2016, 03:24:04 am
-
Hi,, i have a problem with cross compile libusb :
settings :
export STAGING=$HOME/out
export HOST=arm-linux
CROSS_COMPILE=arm-none-linux-gnueabi-
CC=/home/hossein/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc
I did download libusb source from https://git.libusb.org/libusb.git , i did ./configure --host=$HOST --prefix=$STAGING & make & sudo make install
.
But in hidapi when i want make i get this error :
make[2]: Entering directory `/home/hossein/hidTest/hidapi/hidtest'
CXXLD hidtest-libusb
../libusb/.libs/libhidapi-libusb.so: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
make[2]: *** [hidtest-libusb] Error 1
make[2]: Leaving directory `/home/hossein/hidTest/hidapi/hidtest'
In checked /home/hossein/hidTest/hidapi/libusb/.libs/libhidapi-libusb.la that the link directory was correct :
# The name that we can dlopen(3).
dlname='libusb.so'
# Names of this library.
library_names='libusb.so'
# The name of the static archive.
old_library='libusb.a'
# Linker flags that can not go in dependency_libs.
inherited_linker_flags=' -pthread'
# Libraries that this one depends upon.
dependency_libs=' -L/home/hossein/out/lib /home/hossein/out/lib/libusb-1.0.la -lrt'
Now i confused why i got that problem! ..
- did I download wrong libusb ?
Thanks
Hossein
-
If you search the web on:
libusb error adding symbols: File in wrong format
you will find various reasons for and possible solutions for this error.
For example:
http://www.edaboard.com/thread256758.html
http://libusb.6.n5.nabble.com/Cross-Compilig-Issue-for-MIPS-Little-Endain-Architecture-td4872500.html
-
Thanks :)
Sorry for my persecute
Finally i could cross compile without any error, i following these commands :
mkdir hid
cd hid
git clone git://git.libusb.org/libusb.git
git clone git://github.com/signal11/hidapi.git
git clone https://github.com/gentoo/eudev.git
export STAGING=$HOME/out
export HOST=arm-linux
CROSS_COMPILE=arm-none-linux-gnueabi-
CXX=/home/hossein/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-g++
CC=/home/hossein/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc
export CC CROSS_COMPILE
cd libusb
./configure --host=$HOST --prefix=$STAGING
make
sudo make install
cd ../eudev
./configure --disable-gudev --disable-introspection --disable-hwdb --host=$HOST --prefix=$STAGING
make
sudo make install
cd ../hidapi
./bootstrap
PKG_CONFIG_DIR= PKG_CONFIG_LIBDIR=$STAGING/lib/pkgconfig:$STAGING/share/pkgconfig PKG_CONFIG_SYSROOT_DIR=$STAGING ./configure --host=$HOST --prefix=$STAGING
make
sudo make install
/////
But when i compile in Qt, i get these errors :
hossein@hossein-laptop:~/hid/hidapi/hidtest$ arm-linux-gnueabihf-g++ hidtest.cpp -o myTest
/tmp/ccX4fi6L.o: In function `main':
hidtest.cpp:(.text+0x14): undefined reference to `hid_init'
hidtest.cpp:(.text+0x44): undefined reference to `hid_enumerate'
hidtest.cpp:(.text+0x11c): undefined reference to `hid_free_enumeration'
hidtest.cpp:(.text+0x154): undefined reference to `hid_open'
hidtest.cpp:(.text+0x198): undefined reference to `hid_get_manufacturer_string'
hidtest.cpp:(.text+0x1e8): undefined reference to `hid_get_product_string'
hidtest.cpp:(.text+0x238): undefined reference to `hid_get_serial_number_string'
hidtest.cpp:(.text+0x29c): undefined reference to `hid_get_indexed_string'
hidtest.cpp:(.text+0x2d8): undefined reference to `hid_set_nonblocking'
hidtest.cpp:(.text+0x2f0): undefined reference to `hid_read'
hidtest.cpp:(.text+0x338): undefined reference to `hid_send_feature_report'
hidtest.cpp:(.text+0x38c): undefined reference to `hid_get_feature_report'
hidtest.cpp:(.text+0x3b0): undefined reference to `hid_error'
hidtest.cpp:(.text+0x470): undefined reference to `hid_write'
hidtest.cpp:(.text+0x494): undefined reference to `hid_error'
hidtest.cpp:(.text+0x4cc): undefined reference to `hid_write'
hidtest.cpp:(.text+0x504): undefined reference to `hid_read'
hidtest.cpp:(.text+0x5cc): undefined reference to `hid_close'
hidtest.cpp:(.text+0x5d0): undefined reference to `hid_exit'
...
I dont know what can i do for solve these errors , i searching a lot in web and read a lot of web pages and documents, but i cant do anything...
Thanks a lot
-
I am not a Qt expert. You might have more luck asking here:
https://forum.qt.io
or
http://www.qtforum.org
-
Thanks i can cross compile hidapi from commadline ,, but those errors still exist in qt .
this link is my solution : https://www.raspberrypi.org/forums/viewtopic.php?f=33&t=143377
Thanks a lot
-
It looks like you are making good progress! I'm glad you found a site with some answers. Thanks for reporting back.
-
Your welcome .. ;)