NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Cross-compile with added opkg packages

When compiling a DLL or an EXE for a cRIO, it can either be done on the cRIO itself or on a desktop system with the use of a cross-compiler.

 

The trouble I'm having is seeing how to create a DLL or EXE that depends on a package that is installed through opkg, such as libcurl. In order to compile, I need the headers for the library in the same version as what will be present when the system runs. This is simple to do if compiling on the crio itself since I can just install the library. However, if I am cross-compiling, if I do have libcurl, it's the one from the desktop system, likely in a different version. The solution right now is to install what is needed on the crio and copy the library files to the desktop system so that it cross-compiles with the correct library version.

 

Is there a way to properly install opkg packages in the cross-compile environment on the desktop computer?

 

jtagg

0 Kudos
Message 1 of 3
(2,737 Views)

It's possible to run opkg on a sysroot. E.g.

 

# Setup a sysroot by cloning some target's opkg conf directory

mkdir ~/xxx

mkdir ~/xxx/etc

cp -R /etc/opkg ~/xxx/etc/

 

# Run opkg with `-o` to populate the sysroot with headers that match the target's libraries; libcurl's headers in this example

opkg -o ~/xxx update

opkg -o ~/xxx install curl-dev

 

You can then redirect gcc to the sysroot for build/link.

 

This may work on your desktop as well, so long as it can run opkg. You can build it from source ( https://git.yoctoproject.org/cgit/cgit.cgi/opkg/ ) if your distribution doesn't provide it.

 

0 Kudos
Message 2 of 3
(2,709 Views)

Thanks a lot. I'll try that out when I get some time to work on this again.

0 Kudos
Message 3 of 3
(2,700 Views)