NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Stuck unable to cross compile in Windows for cRIO

Solved!
Go to solution

I've been reading up and down many of the posts here and elsewhere, but still unable to compile.

 

We want to use either thrift c++ server to communicate with the NICrio .. OR if that doesn't work, use a boost socket... we just have not had any success doing either of these from the windows based cross compiler.  How many people have used the linux cross compilers?  How do we set it up?  I have a link to a download but it is not mentioned as an option in the getting started instructions at all...  

 

I tried to target mingw and compiling boost but it fails on the bootstrap step

 

C:\boost_1_58_0>bootstrap mingw

 

when i try to just target a project via batch file.. it seems to fail to find 

 

"C:\build\17.0\x64\sysroots\i686-nilrtsdk-mingw32\usr\bin\x86_64-nilrt-linux\x86_64-nilrt-linux-c++.exe" -c example.cpp -std=c++11 -IC:\boost_1_58_0 -Wall

The example cpp file

 

#include <boost/lambda/lambda.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>

int main()
{
    using namespace boost::lambda;
    typedef std::istream_iterator<int> in;

    std::for_each(
        in(std::cin), in(), std::cout << (_1 * 3) << " " );
}

 

The error

 

In file included from C:\boost_1_58_0/boost/config.hpp:44:0,
                 from C:\boost_1_58_0/boost/type_traits/remove_reference.hpp:12,
                 from C:\boost_1_58_0/boost/type_traits/add_pointer.hpp:12,
                 from C:\boost_1_58_0/boost/type_traits/transform_traits.hpp:15,
                 from C:\boost_1_58_0/boost/lambda/core.hpp:25,
                 from C:\boost_1_58_0/boost/lambda/lambda.hpp:14,
                 from example.cpp:1:
C:\boost_1_58_0/boost/config/select_stdlib_config.hpp:18:21: fatal error: cstddef: No such file or directory
 #  include <cstddef>

                     ^
compilation terminated.

 

0 Kudos
Message 1 of 3
(2,711 Views)
Solution
Accepted by topic author jimmyjohns

In general, you'll want to match the compilation steps that are applied by Eclipse as described in the getting started white paper. Eclipse builds in two steps - first, we compile, and then we link. 

 

So, if you were building hello_world.c, your compilation step might look like this: 

 

C:\build\17.0\x64\sysroots\i686-nilrtsdk-mingw32\usr\bin\x86_64-nilrt-linux\x86_64-nilrt-linux-gcc.exe -O0 -g3 -Wall -c -fmessage-length=0 --sysroot="C:\build\17.0\x64\sysroots\core2-64-nilrt-linux" -o ".\hello_world.o" ".\hello_world.c"

 

And your linking step would look like this:

 

C:\build\17.0\x64\sysroots\i686-nilrtsdk-mingw32\usr\bin\x86_64-nilrt-linux\x86_64-nilrt-linux-gcc.exe --sysroot="C:\build\17.0\x64\sysroots\core2-64-nilrt-linux" -o ".\hello_world.so" ".\hello_world.o"

 

Try adapting this approach to your specific scenario to see if you have any luck.

Message 2 of 3
(2,683 Views)

that worked until I needed the ARM Boost libraries to also be ready to go... seems I need to now compile a copy of Boost for ARM so I can reference it... what a pain, going to switch to Linux for all building going forward.

 

the rest of your advice worked though, thank you!

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