admb-project / admb

AD Model Builder
http://admb-project.org
Other
64 stars 19 forks source link

Problems compiling SS3 with different flavors of gcc 12.2.0 on Windows #285

Closed iantaylor-NOAA closed 1 year ago

iantaylor-NOAA commented 1 year ago

Hi @johnoel, The github actions used to compile stock synthesis started failing which @e-gugliotti-NOAA traced back to a change in the Rtools installation we rely on getting updated behind the scenes from Rtools42 to Rtools43. She was able to revert to the earlier Rtools so the build is working again, but it would be good to understand the source of the problem and get it sorted out for the future.

The working version uses gcc version 10.3.0 (as discussed in #282--thank you for all the work to get that working). The github action is here, including info on the gcc version.

The failing build (link here) uses "gcc version 12.2.0 (GCC)" and fails with the following error:

*** 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:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: ss.obj:ss.cpp:(.text+0x1018[69](https://github.com/nmfs-stock-synthesis/stock-synthesis/actions/runs/4799674396/jobs/8539616855#step:20:70)): undefined reference to `ad_comm::change_datafile_name(adstring const&, std::fpos<_Mbstatet> const&)'
C:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: ss.obj:ss.cpp:(.text+0x113389): undefined reference to `ad_comm::change_datafile_name(adstring const&, std::fpos<_Mbstatet> const&)'
C:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: ss.obj:ss.cpp:(.text+0x116032): undefined reference to `ad_comm::change_datafile_name(adstring const&, std::fpos<_Mbstatet> const&)'
C:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: ss.obj:ss.cpp:(.text+0x1160be): undefined reference to `ad_comm::change_datafile_name(adstring const&, std::fpos<_Mbstatet> const&)'
C:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: ss.obj:ss.cpp:(.text+0x128d5e): undefined reference to `ad_comm::change_datafile_name(adstring const&, std::fpos<_Mbstatet> const&)'
C:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: ss.obj:ss.cpp:(.text+0x12ccf3): more undefined references to `ad_comm::change_datafile_name(adstring const&, std::fpos<_Mbstatet> const&)' follow
C:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: ss.obj:ss.cpp:(.text+0x17dec3): undefined reference to `ad_comm::change_pinfile_name(adstring const&, std::fpos<_Mbstatet> const&)'
collect2.exe: error: ld returned 1 exit status

Error: Error: Unable to build.

I installed Rtools43 on my Windows computer and was able to replicate the error. However, it builds just fine using the gcc that came with ADMB 13.1, where the only difference I see is that running gcc -v with the ADMB version returns gcc version 12.2.0 (Rev6, Built by MSYS2 project) while that command with the Rtools version returns gcc version 12.2.0 (GCC).

Do you have any idea what's going on? The errors are mostly related to the function ad_comm::change_datafile_name() so perhaps there's some change in how that function is being used which could solve the problem instead.

Tagging @rick-methot-NOAA as well.

johnoel commented 1 year ago

Unable to duplicate errors. I get a clean compile with rtools43.

iantaylor-NOAA commented 1 year ago

Thanks for trying, @johnoel. I'll update you as we learn anything more about this.

johnoel commented 1 year ago

Okay, I was able to duplicate the errors. I will figure this one out.

johnoel commented 1 year ago

rebuilt and update zip file for windows. please rerun actions to see if it works.

iantaylor-NOAA commented 1 year ago

Thank you @johnoel, I appreciate the quick turnaround. We'll try it out.

e-perl-NOAA commented 1 year ago

Thank you Johnoel. Windows is now compiling stock synthesis successfully in the github action here.

Rick-Methot-NOAA commented 1 year ago

Good work. Thanks to all.

johnoel commented 1 year ago

Also, updated .exe installer.