LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Embedded & Single-board computer (http://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/)
-   -   arm-none-linux-gnueabi/bin/ld: cannot find -lbluetooth (http://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/arm-none-linux-gnueabi-bin-ld-cannot-find-lbluetooth-762689/)

feiyinziiu 10-17-2009 11:36 PM

arm-none-linux-gnueabi/bin/ld: cannot find -lbluetooth
 
hello

Recently I compile the bluetooth test.Before compile ,I have install bluez-libs,bluez-utils.
When I use gcc to compile
gcc -o bluetest bluetest.c -lbluetooth
that works well.It can run correctly.
But if using arm-linux-gcc to compile,I get those problems below:

[root@feiyinziiu home]# arm-linux-gcc -o bluetest bluetest.c -lbluetooth

/usr/local/arm/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm-none-linux-gnueabi/bin/ld: cannot find -lbluetooth
collect2: ld returned 1 exit status




what can I do ?

Thank you.

jhwilliams 10-17-2009 11:47 PM

Hi feiyinziiu,

First, a bit of a science experiment. Can we reduce
Quote:

/usr/local/arm/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm-none-linux-gnueabi/bin/ld
to its reduced echelon form?

Solution:
Quote:

/usr/local/arm/4.3.2/arm-none-linux-gnueabi/bin/ld
The program above appears to be complaining that it does not have bluez-libz for the ARM processor. Well, it probably doesn't! apt-getting bluez-whatever will only get the libraries compiled for your local architecture (read: not ARM.) You will need to install bluetooth libraries for the ARM architecture into your /usr/local/arm/lib/ dir (most likely. or wherever the rest of your ARM libs are.)

Best,
Jameson

feiyinziiu 10-18-2009 12:17 AM

Quote:

Originally Posted by jhwilliams (Post 3723383)
Hi feiyinziiu,

First, a bit of a science experiment. Can we reduce to its reduced echelon form?

Solution:

The program above appears to be complaining that it does not have bluez-libz for the ARM processor. Well, it probably doesn't! apt-getting bluez-whatever will only get the libraries compiled for your local architecture (read: not ARM.) You will need to install bluetooth libraries for the ARM architecture into your /usr/local/arm/lib/ dir (most likely. or wherever the rest of your ARM libs are.)

Best,
Jameson



Thanks for your reply.

yesterday,I have cross compiled the bluez-libs and bluez-util for the ARM.And I have successfully transplant the libs and util to my ARM board

But how can I install bluetooth libraries for ARM on PC?

Because of cross-compiling my bluetoot test program on PC,how can I install bluetooth libraries for the ARM?
my bluetoot lib is like this:

[root@feiyinziiu lib]# pwd
/usr/local/lib
[root@feiyinziiu lib]# ls
alsa-lib libbluetooth.a libbluetooth.so libbluetooth.so.1.0.25 libbluetooth.so.2.11.2
bluetooth libbluetooth.la libbluetooth.so.1 libbluetooth.so.2 pkgconfig


Thank you!

jhwilliams 10-18-2009 12:20 AM

Quote:

Originally Posted by feiyinziiu (Post 3723404)
But how can I install bluetooth libraries for ARM on PC?

You could install a library whose bytecode was "0000" to your PC. It wouldn't do anything, but you could install it. So too can you install ARM libraries that don't do anything on your PC, but do on the target architecture.

If you've cross compiled the bluetooth libs for ARM, just copy them to the appropriate directory in which your ARM compiler looks for libaries via the -l flag.

cp /path/to/arm/bluetoothlib/libbluez.so /path/to/arm/ld/library/path/libbluez.so

feiyinziiu 10-18-2009 02:30 AM

Quote:

Originally Posted by jhwilliams (Post 3723406)
You could install a library whose bytecode was "0000" to your PC. It wouldn't do anything, but you could install it. So too can you install ARM libraries that don't do anything on your PC, but do on the target architecture.

If you've cross compiled the bluetooth libs for ARM, just copy them to the appropriate directory in which your ARM compiler looks for libaries via the -l flag.

cp /path/to/arm/bluetoothlib/libbluez.so /path/to/arm/ld/library/path/libbluez.so

[root@feiyinziiu lib]# pwd
/usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/armv4t/usr/lib

haha!.Thank you very much.I have solve the problem under your guiding.

I found it difficult for me to get the path of the arm-linux-gcc looks for libraries via the -l flag.

But,the other day ,I have completed a programm with the pthread.
# arm-linux-gcc -o xxx xxx.c -lpthread
it work correctly.

so,I turn to find the pthread.
# locate pthread

/usr/lib/libgpgme++-pthread.so.1.0.0
/usr/lib/libgpgme-pthread.so.11
/usr/lib/libgpgme-pthread.so.11.6.4
/usr/lib/libpthread.a
/usr/lib/libpthread.so
/usr/lib/libpthread_nonshared.a
/usr/lib/kde4/devel/libgpgme++-pthread.so
/usr/lib/perl5/5.10.0/i386-linux-thread-multi/bits/pthreadtypes.ph
/usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/armv4t/lib/libpthread-2.8.so
/usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/armv4t/lib/libpthread.so.0
/usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/armv4t/usr/lib/libpthread.a
/usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/armv4t/usr/lib/libpthread.so
/usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/armv4t/usr/lib/libpthread_nonshared.a


finally,I copy the bluetooth lib to the direction.


But I have much doubt about the cross-compiling.
Above all,the bluez-lib has been cross compiled by arm-linux-gcc compiler(Before I transplant the libs,I cross compiled the libs).But I copy the the bluez-lib to that path,when I do tihs:
# arm-linux-gcc -o bluetest bluetest.c -lbluetooth

That is to say,those libs have to be recompiled.
How can the cross compiler recognize the libs?


All times are GMT -5. The time now is 04:51 AM.