I’m trying to build a program to run on the driverstation to interface with xkeys, networktables, and maybe some other things in the future. My goal is to compile with only g++ mingw64 using a makefile, but I cannot find libntcore.a or libwpiutil.a files or get them to build from wpilibsuite/allwpilib. I have found some .lib files from 2019 but I get linking errors when using them, a bunch of undefined references to the networktables library.
Trying to build the .a files from the allwpilib repository is also getting me nowhere, I keep getting errors running ./gradlew :ntcore:build
I’ve been banging my head against the wall the last two days, any help with this would be greatly appreciated.
Have you looked at the WPILib docs for creating a Client-side Program?
yes, it did not help, it goes into very little detail and only describes building with gradle, which I did try and only got build errors
What you’ll want to do is build using the CMake build instead of Gradle, since you’re using a non-standard compiler and configuration. The Gradle build only will work with specific supported compilers (MSVC on Windows, GCC on Linux, clang on Mac). See README-CMAKE.md in the repo for more info on building with cmake.
Mingw64 is not a tested platform for us; you will need to be using a recent GCC (11+) and you may run into other issues due to required dependencies such as protobuf. A much easier path would be to use MSVC.
alright, I will try this, thankyou!
alright, running cmake -B allwpilib\build-cmake -S allwpilib
from the visual studio command prompt starts the compilation and gives several errors,
The C compiler
"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.37.32822/bin/Hostx86/x86/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: D:/Documents/workspaces/frc-workspace/allwpilib/build-cmake/CMakeFiles/CMakeTmp
Run Build Command(s):nmake /nologo cmTC_efe19\fast && "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\bin\HostX86\x86\nmake.exe" -f CMakeFiles\cmTC_efe19.dir\build.make /nologo -L CMakeFiles\cmTC_efe19.dir\build
Building C object CMakeFiles/cmTC_efe19.dir/testCCompiler.c.obj
"C:\PROGRA~1\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\bin\Hostx86\x86\cl.exe" @C:\Users\braju\AppData\Local\Temp\nm19A0.tmp
testCCompiler.c
Linking C executable cmTC_efe19.exe
"C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_efe19.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests -- "C:\PROGRA~1\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\bin\Hostx86\x86\link.exe" /nologo @CMakeFiles\cmTC_efe19.dir\objects1.rsp @C:\Users\braju\AppData\Local\Temp\nm1A2E.tmp
RC Pass 1: command "rc /fo CMakeFiles\cmTC_efe19.dir/manifest.res CMakeFiles\cmTC_efe19.dir/manifest.rc" failed (exit code 0) with the following output:
The system cannot find the file specifiedNMAKE : fatal error U1077: '"C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_efe19.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests -- "C:\PROGRA~1\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\bin\Hostx86\x86\link.exe" /nologo @CMakeFiles\cmTC_efe19.dir\objects1.rsp @C:\Users\braju\AppData\Local\Temp\nm1A2E.tmp' : return code '0xffffffff'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\bin\HostX86\x86\nmake.exe" -f CMakeFiles\cmTC_efe19.dir\build.make /nologo -L CMakeFiles\cmTC_efe19.dir\build' : return code '0x2'
Stop.
CMake will not be able to correctly generate this project.
I am using Mingw since it’s simpler for other parts of what I’m trying to build. my current goal is to get libntcore.a and libwpiutil.a files, and so far building anything using visual studio is no easier
That’s still trying to use msvc. There’s probably something you have to do to get make to target mingw but since none of us use it, I’m not sure what that command would be.
I would also be very surprised if mingw works for wpilib. A lot of the code and the cmake files assume msvc. It might work, but it also might require major changes to work.
do you mean even if I can build .a library files for ntcore and wpiutil only using MSVC, it likely won’t be compatible with mingw?
Likely not. I’ve never gotten it working, and from everything I’ve ever seen they need to be considered separate ecosystems. You can try though.
suppose I’ll just start setting up msvc then… thanks
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.