Reputation: 61
I have been working on setting up a toolchain for Raspberry Pi development. I have had no problem setting up the official Raspberry Pi cross-compiler, but now I am beginning to require some external libraries, like OpenSSL, as well as the OpenMAX libraries that were recently released.
What is the simplest way to integrate C/C++ libraries into the cross-compiler?
Upvotes: 3
Views: 3316
Reputation: 61
OK, so I have found a way to use 3rd party libraries with the cross compilers, however it doesn't seem optimal. Basically, I just installed the libraries I required onto my Raspberry Pi (running Arch Linux)
pi:# pacman -S libssl-dev
then used
pi:# tar -zcvf include.tar.gz /usr/include
pi:# tar -zcvf lib.tar.gz /usr/lib
to compress the include and lib directories on my Pi.
Next, I copied them over to my local machine (i686 running Debian squeeze) running the cross compiler via sftp
:
debian:$ sftp root@<pi_ip_address>:/usr/include.tar.gz
debian:$ sftp root@<pi_ip_address>:/usr/lib.tar.gz
I backed up the cross compiler's include
and lib
directories using the command (as root, since my cross directory is in /opt
)
debian:# tar -zcvf OLDinclude.tar.gz ./include
debian:# tar -zcvf OLDlib.tar.gz ./lib
and proceded to extract the archives from the Pi to the cross compiler's sysroot/usr/
directory.
Finally, to test if it worked, I compiled a program I using the library using both <cross>-gcc
and <cross>-g++
. . . and it worked! Now, I might write a bash script to take care of most of these steps for me. If anybody has any tips on how to streamline this process, please advise.
Note: For other Linux newcomers like me, '$'
represents a normal user shell, while '#'
represents a superuser (i.e. root) shell. Normal users can upgrade to a super user using the su
command.
Upvotes: 1