Closed iantaylor-NOAA closed 1 year ago
One way is to update the compiler in rtools42 to latest current version.
$ pacman -Syuu
If that is not possible, I will locate a machine that has gcc-10 with rtools42.
Hi @johnoel, Both @e-gugliotti-NOAA and I have tried a bunch of ways to install MingGW via Rtools or other methods and are still getting errors. Mostly the problem is not getting the right version of gcc, but in this one case we had gcc version 12 installed but there were errors in the linking step: https://github.com/nmfs-stock-synthesis/stock-synthesis/actions/runs/3838983951/jobs/6536134683#step:20:67 for example:
*** Linking: ss.obj
g++ -static -o ss.exe ss.obj "D:\a\stock-synthesis\stock-synthesis\admb-13.1\lib\libadmb-contrib-mingw64-g++12.a"
c:/programdata/chocolatey/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ss.obj:ss.cpp:(.text+0xfa109): undefined reference to `ad_comm::change_datafile_name(adstring const&, std::fpos<_Mbstatet> const&)'
Using a simplified version of that github action to compile the "simple" ADMB example with gcc version 12 worked fine here:
https://github.com/iantaylor-NOAA/actions_sandbox/actions/runs/3848970910/jobs/6557397687#step:9:28 but maybe that's because simple doesn't use change_datafile_name
or change_pinfile_name
.
I don't know what the benefits of gcc version 12 vs 10 are, but it seems that we could either build ADMB from source in the github action for Stock Synthesis or you could try adding a gcc-10-compatible version to the release by compiling within a github action where gcc is installed via something like
- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
r-version: 'release'
rtools-version: '42'
windows-path-include-rtools: true
what is the link to the github action link that uses mingw gcc-10?
Hi @johnoel, Here is the simplified github action which installs mingw gcc-10: https://github.com/iantaylor-NOAA/actions_sandbox/blob/main/.github/workflows/test.yml (most recent run is here). The test2.yml file in that same repo uses gcc-12. -Ian
Hi @iantaylor-NOAA, Updated the windows installers (.exe and .zip) to include support for gcc versions 4, 8, 10 and 12. Please give it a try and let me know if there are still issues.
That did the trick and @e-gugliotti-NOAA was able to update our the github action for Stock Synthesis successfully. Thank you @johnoel! Sorry it was such a pain to get this sorted out.
The exe installer produced an ADMB that failed to link the simple example:
*** Compile: simple.cpp cl /c /nologo /EHsc /O2 /DUSE_ADMB_CONTRIBS /D_USE_MATH_DEFINES /I. /I"C:\ADMB-13.1\include" /I"C:\ADMB-13.1\include\contrib" /Fosimple.obj simple.cpp simple.cpp
*** Linking: simple.obj
cl /nologo /Fesimple.exe simple.obj "C:\ADMB-13.1\lib\admb-contrib-win64-cl19.lib" /link
admb-contrib-win64-cl19.lib(saflp-linad99-ivect_io.obj) : error LNK2019: unresolved external symbol std_find_trivial_1 referenced in function "protected: virtual class std::ostreambuf_iterator<char,struct std::char_traits
Error: Unable to build.
COMSPEC=C:\WINDOWS\system32\cmd.exe.
PATH=C:\ADMB-13.1\bin;C:\ADMB-13.1\bin;C:\ADMB-13.1\bin..\utilities\mingw64\bin;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\Extensions\Microsoft\IntelliCode\CLI;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX64\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\bin\Roslyn;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Team Tools\Performance Tools\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Team Tools\Performance Tools;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\vs2019\x64;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\vs2019\;C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64;C:\Program Files (x86)\Windows Kits\10\bin\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS\;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\IDM Computer Solutions\UltraEdit;C:\Program Files\IDM Computer Solutions\UltraCompare;C:\Program Files\dotnet\;C:\Program Files\IDM Computer Solutions\UEStudio;C:\Program Files (x86)\HID Global\ActivClient\;C:\Program Files\HID Global\ActivClient\;C:\Program Files\Tumbleweed\Desktop Validator\;C:\Program Files\Tumbleweed\Desktop Validator\x86;C:\Program Files\Git\cmd;C:\Users\Richard.Methot\AppData\Local\Microsoft\WindowsApps;C:\Users\Richard.Methot\AppData\Local\Programs\Git\cmd;C:\Users\Richard.Methot\AppData\Local\GitHubDesktop\bin;C:\Users\Richard.Methot\AppData\Local\Microsoft\WindowsApps;;C:\Users\Richard.Methot\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja.
ADMB_HOME: C:\ADMB-13.1
C:\ADMB-13.1\examples\admb\simple>
Bummer, what version of Visual Studio C++ are you using?
VS 2019
can you post the top line for the command below?
> cl /?
Microsoft (R) C/C++ Optimizing Compiler Version 19.27.29111 for x64 C
When I ran simple example, I did not use: set cxx=g++ That explains why I was perplexed about the error because I have not been using the visual studio compiler recently. When I set cxx=g++, simple compiles and links.
It should still work with Visual C++. Thanks for finding this, I will look into more.
Created a new issue #283 for cl.exe.
Hi @johnoel, @e-gugliotti-NOAA, @k-doering-NOAA and I are working on updating the github actions for building Stock Synthesis from ADMB 13.0 to 13.1. The Mac and Linux worked flawlessly by just changing the one digit, but the Windows action is failing with a message
Error: Error: Unable to find ADMB library 'libadmb-mingw64-g++10.a'
. The failed action is here: https://github.com/nmfs-stock-synthesis/stock-synthesis/actions/runs/3807356702/jobs/6476966130#step:18:53 (where the .yml workflow file it depends on is here: https://github.com/nmfs-stock-synthesis/workflows/blob/admb-13.1-test/.github/workflows/build-ss3.yml).I was able to replicate the issue on my local computer by relying on just the files in
admb-13.1-windows.zip
combined with rtools42 (which has gcc version 10.4.0). When I used rtools40 (which has gcc version 8.3.0) or use theadmb-13.1-windows.exe
installer (which installed gcc version 12.2.0 in theutilities
folder) then ADMB worked fine. Without knowing much about the compilation process, I'm guessing that this is connected to theadmb-13.1-windows.zip
includinglibadmb-contribo-mingw64-g++8.a
andlibadmb-contribo-mingw64-g++12.a
but notlibadmb-contribo-mingw64-g++10.a
.Do you have suggestions for how best to get the github action working? I'm assuming we could build from source or install a different gcc version within the github action, but we figured that you would know the easiest solution.