LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

C/C++ Cross compile for cRIO problem

We need to cross compile some C/C++ code and create a callable .so file.

 

I have successfully setup the environment, compiled, deployed, and called a sample .so file using the 2018-2019 tool chain setup.  My efforts to update to either 23Q1 or 23Q4 have failed.  Below are the errors received when trying to build.

 

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/build/23Q1/x64/sysroots/x86_64-w64-mingw32/usr/bin/x86_64-nilrt-linux/x86_64-nilrt-linux-gcc.exe
-- Check for working C compiler: C:/build/23Q1/x64/sysroots/x86_64-w64-mingw32/usr/bin/x86_64-nilrt-linux/x86_64-nilrt-linux-gcc.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.28/Modules/CMakeTestCCompiler.cmake:67 (message):
  The C compiler

    "C:/build/23Q1/x64/sysroots/x86_64-w64-mingw32/usr/bin/x86_64-nilrt-linux/x86_64-nilrt-linux-gcc.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: 'C:/Users/<user>/Documents/sharedObject/build/CMakeFiles/CMakeScratch/TryCompile-rv8yrf'

    Run Build Command(s): C:/PROGRA~1/Ninja/ninja.exe -v cmTC_b6864
    [1/2] C:\build\23Q1\x64\sysroots\x86_64-w64-mingw32\usr\bin\x86_64-nilrt-linux\x86_64-nilrt-linux-gcc.exe   -O2 -pipe -g -feliminate-unused-debug-types -o CMakeFiles\cmTC_b6864.dir\testCCompiler.c.o -c C:\Users\<user>\Documents\sharedObject\build\CMakeFiles\CMakeScratch\TryCompile-rv8yrf\testCCompiler.c
    FAILED: CMakeFiles/cmTC_b6864.dir/testCCompiler.c.o
    C:\build\23Q1\x64\sysroots\x86_64-w64-mingw32\usr\bin\x86_64-nilrt-linux\x86_64-nilrt-linux-gcc.exe   -O2 -pipe -g -feliminate-unused-debug-types -o CMakeFiles\cmTC_b6864.dir\testCCompiler.c.o -c C:\Users\<user>\Documents\sharedObject\build\CMakeFiles\CMakeScratch\TryCompile-rv8yrf\testCCompiler.c
    ninja: build stopped: subcommand failed.

 Could someone please point me in the right direction to fix this?

0 Kudos
Message 1 of 7
(1,229 Views)

Those docs have a bunch of issues right now.

 

The batch file in the download is causing double slashes "\\" in the paths its setting in environment variables if you look closely. Take out the '\' after the %SDKROOT% in the batch file and try again.

 

Those VS Code instructions are suggesting some bad practices and my ticket from years ago on the github for those docs has gone unnoticed.

~ The wizard formerly known as DerrickB ~
Gradatim Ferociter
0 Kudos
Message 2 of 7
(1,193 Views)

Welp - Tried that and still broken.

 

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/build/23Q1/x64/sysroots/x86_64-w64-mingw32/usr/bin/x86_64-nilrt-linux/x86_64-nilrt-linux-gcc.exe
-- Check for working C compiler: C:/build/23Q1/x64/sysroots/x86_64-w64-mingw32/usr/bin/x86_64-nilrt-linux/x86_64-nilrt-linux-gcc.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.28/Modules/CMakeTestCCompiler.cmake:67 (message):
The C compiler

"C:/build/23Q1/x64/sysroots/x86_64-w64-mingw32/usr/bin/x86_64-nilrt-linux/x86_64-nilrt-linux-gcc.exe"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: 'C:/Users/<user>/Documents/sharedObject/build/CMakeFiles/CMakeScratch/TryCompile-fj531i'

Run Build Command(s): C:/PROGRA~1/Ninja/ninja.exe -v cmTC_71907
[1/2] C:\build\23Q1\x64\sysroots\x86_64-w64-mingw32\usr\bin\x86_64-nilrt-linux\x86_64-nilrt-linux-gcc.exe -O2 -pipe -g -feliminate-unused-debug-types -o CMakeFiles\cmTC_71907.dir\testCCompiler.c.o -c C:\Users\<user>\Documents\sharedObject\build\CMakeFiles\CMakeScratch\TryCompile-fj531i\testCCompiler.c
FAILED: CMakeFiles/cmTC_71907.dir/testCCompiler.c.o
C:\build\23Q1\x64\sysroots\x86_64-w64-mingw32\usr\bin\x86_64-nilrt-linux\x86_64-nilrt-linux-gcc.exe -O2 -pipe -g -feliminate-unused-debug-types -o CMakeFiles\cmTC_71907.dir\testCCompiler.c.o -c C:\Users\<user>\Documents\sharedObject\build\CMakeFiles\CMakeScratch\TryCompile-fj531i\testCCompiler.c
x86_64-nilrt-linux-gcc.exe: fatal error: cannot execute 'c:/build/23q1/x64/sysroots/x86_64-w64-mingw32/usr/bin/x86_64-nilrt-linux/../../libexec/x86_64-nilrt-linux/gcc/x86_64-nilrt-linux/10.3.0/as.exe': CreateProcess: No such file or directory
compilation terminated.
C:\Users\<user>\Documents\sharedObject\build\CMakeFiles\CMakeScratch\TryCompile-fj531i\testCCompiler.c:11:1: fatal error: error closing -: Invalid argument
11 | { (void)argv; return argc-1;}
| ^
compilation terminated.
ninja: build stopped: subcommand failed.

 

This is a new error however:

11 | { (void)argv; return argc-1;}
| ^

Feeling kinda dumb here.  Been building C/C++ for years but always had the luxury of a fully integrated IDE.

0 Kudos
Message 3 of 7
(1,167 Views)

that looks like you copied the examples including the line numbers.

 

You should still get to a point where cmake can identify the compilers (first two lines)

~ The wizard formerly known as DerrickB ~
Gradatim Ferociter
0 Kudos
Message 4 of 7
(1,129 Views)

@IlluminatedG wrote:

that looks like you copied the examples including the line numbers.

 

Not sure what you mean by this.  What I posted is a copy of the output after trying what you suggested.


 

0 Kudos
Message 5 of 7
(1,065 Views)

Hello!

Do you have any updates on the topic? I have the same issue and could not find a solution yet. 

Any info would be really helpful. 

Thanks

0 Kudos
Message 6 of 7
(981 Views)

Sorry no useful updates I am afraid.  Because of project time constraints we just reverted back to the 2018-2019 tool chain setup.  It works fine.

0 Kudos
Message 7 of 7
(973 Views)