Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project fails to build on Windows Server 2019 #5507

Closed
jakubgs opened this issue Oct 16, 2023 · 18 comments
Closed

Project fails to build on Windows Server 2019 #5507

jakubgs opened this issue Oct 16, 2023 · 18 comments

Comments

@jakubgs
Copy link
Member

jakubgs commented Oct 16, 2023

Describe the bug
The build fails on Windows Server 2019 on the make update call.

More specifically it can be reproduced with make libminiupnpc.a.

To Reproduce
Steps to reproduce the behavior:

  1. Platform details (OS, architecture): Microsoft Windows Server 2019 Standard, 10.0.17763 N/A Build 17763
  2. Branch/commit used: stable/23.9.1/cfa0268d89461bfcba75a6d15e994037a0527726
  3. Commands being executed: make update
  4. Relevant log lines(with --debug flag for make):
make[1]: Entering directory 'D:/beacon-node-prater-stable/repo/vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc'                                                                   
process_begin: CreateProcess(NULL, git rev-parse --short HEAD, ...) failed.                                                                                                          
Makefile.mingw:56: pipe: No error                                                                                                                                                    
Updating makefiles....                                                                                                                                                               
Updating goal targets....                                                                                                                                                            
 File 'libminiupnpc.a' does not exist.                                                                                                                                               
  File 'miniwget.o' does not exist.                                                                                                                                                  
   File 'miniupnpcstrings.h' does not exist.                                                                                                                                         
    Prerequisite 'wingenminiupnpcstrings.c' is newer than target 'wingenminiupnpcstrings.exe'.                                                                                       
   Must remake target 'wingenminiupnpcstrings.exe'.                                                                                                                                  
gcc -Os -Wall -W -Wstrict-prototypes -DNDEBUG -D_WIN32_WINNT=0x501 -Iinclude -I. -o wingenminiupnpcstrings.exe wingenminiupnpcstrings.c                                              
process_begin: CreateProcess(NULL, gcc -Os -Wall -W -Wstrict-prototypes -DNDEBUG -D_WIN32_WINNT=0x501 -Iinclude -I. -o wingenminiupnpcstrings.exe wingenminiupnpcstrings.c, ...) failed.                                                                                                                                                                                   
make (e=2): The system cannot find the file specified.                                                                                                                               
make[1]: *** [Makefile.mingw:121: wingenminiupnpcstrings.exe] Error 2                                                                                                                
make[1]: Leaving directory 'D:/beacon-node-prater-stable/repo/vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc'                                                                    
make: *** [vendor/nimbus-build-system/makefiles/targets.mk:134: libminiupnpc.a] Error 2      

Additional context
Found a relevant issue:

There was a fix applied in transmission/miniupnpc@fa4fa71 from this PR:

But it appears we already have this fix in our fork: status-im/miniupnp@d3a7441

Although this comment states that it was not really fixed: miniupnp/miniupnp#270 (comment)

@jakubgs
Copy link
Member Author

jakubgs commented Oct 16, 2023

If I go into vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc and call make I can get some more output:

Click to see full build log:
admin@windows-01 MINGW64 .../miniupnp/miniupnpc ((17cecd5...))
$ make
gcc  -o build/upnpc-static build/upnpc.o build/libminiupnpc.a
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x93): undefined reference to `__imp_UPNP_GetConnectionTypeInfo'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0xc6): undefined reference to `__imp_UPNP_GetStatusInfo'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0xf8): undefined reference to `__imp_UPNP_GetLinkLayerMaxBitRates'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x1f1): undefined reference to `__imp_UPNP_GetExternalIPAddress'c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x462): undefined reference to `__imp_UPNP_GetExternalIPAddress'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x4c9): undefined reference to `__imp_UPNP_AddAnyPortMapping'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x543): undefined reference to `__imp_strupnperror'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x59f): undefined reference to `__imp_UPNP_AddPortMapping'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x5f1): undefined reference to `__imp_UPNP_GetSpecificPortMappingEntry'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x663): undefined reference to `__imp_strupnperror'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x691): undefined reference to `__imp_strupnperror'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x793): undefined reference to `__imp_WSAStartup'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0xd56): undefined reference to `__imp_UPNP_GetIGDFromUrl'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0xd92): undefined reference to `__imp_UPNP_GetValidIGD'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0xe29): undefined reference to `__imp_upnpDiscover'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0xf2d): undefined reference to `__imp_FreeUPNPUrls'c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0xf38): undefined reference to `__imp_freeUPNPDevlist'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0xf3e): undefined reference to `__imp_WSACleanup'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x1032): undefined reference to `__imp_UPNP_GetGenericPortMappingEntry'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x1194): undefined reference to `__imp_strupnperror'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x120b): undefined reference to `__imp_UPNP_GetListOfPortMappings'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x128f): undefined reference to `__imp_FreePortListing'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x12d8): undefined reference to `__imp_UPNP_GetListOfPortMappings'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x134a): undefined reference to `__imp_strupnperror'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x1371): undefined reference to `__imp_FreePortListing'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x137e): undefined reference to `__imp_strupnperror'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x1481): undefined reference to `__imp_UPNP_DeletePortMapping'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x1619): undefined reference to `__imp_UPNP_DeletePortMappingRange'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x1708): undefined reference to `__imp_UPNP_GetTotalBytesSent'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x171c): undefined reference to `__imp_UPNP_GetTotalBytesReceived'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x1730): undefined reference to `__imp_UPNP_GetTotalPacketsSent'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x1744): undefined reference to `__imp_UPNP_GetTotalPacketsReceived'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x1a24): undefined reference to `__imp_UPNP_AddPinhole'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x1a32): undefined reference to `__imp_strupnperror'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x1acb): undefined reference to `__imp_UPNP_CheckPinholeWorking'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x1b30): undefined reference to `__imp_UPNP_UpdatePinhole'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x1b54): undefined reference to `__imp_strupnperror'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x1b95): undefined reference to `__imp_strupnperror'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x1c26): undefined reference to `__imp_UPNP_CheckPinholeWorking'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x1c34): undefined reference to `__imp_strupnperror'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x1cd7): undefined reference to `__imp_strupnperror'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x1cf6): undefined reference to `__imp_UPNP_GetPinholePackets'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x1d55): undefined reference to `__imp_UPNP_DeletePinhole'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x1da1): undefined reference to `__imp_UPNP_GetFirewallStatus'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x1e0e): undefined reference to `__imp_UPNP_GetTotalBytesSent'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x1e22): undefined reference to `__imp_UPNP_GetTotalBytesReceived'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x1e36): undefined reference to `__imp_UPNP_GetTotalPacketsSent'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x1e4a): undefined reference to `__imp_UPNP_GetTotalPacketsReceived'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x1ef1): undefined reference to `__imp_UPNP_GetOutboundPinholeTimeout'
c:/programdata/scoop/apps/mingw-nuwen/current/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/upnpc.o:upnpc.c:(.text+0x1eff): undefined reference to `__imp_strupnperror'
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:327: build/upnpc-static] Error 1
>/pre>

What's interesting is that here the error is collect2.exe: error: ld returned 1 exit status, while when calling this via our own make setup it's make (e=2): The system cannot find the file specified..

@jakubgs
Copy link
Member Author

jakubgs commented Oct 16, 2023

What's also interesting is that if I run the command make shows manually it works fine:

admin@windows-01 MINGW64 .../miniupnp/miniupnpc ((17cecd5...))
$ ls -l wingenminiupnpcstrings.exe
ls: cannot access 'wingenminiupnpcstrings.exe': No such file or directory

admin@windows-01 MINGW64 .../miniupnp/miniupnpc ((17cecd5...))
$ gcc -Os -Wall -W -Wstrict-prototypes -DNDEBUG -D_WIN32_WINNT=0x501 -Iinclude -I. -o wingenminiupnpcstrings.exe wingenminiupnpcstrings.c

admin@windows-01 MINGW64 .../miniupnp/miniupnpc ((17cecd5...))
$ ls -l wingenminiupnpcstrings.exe
-rwxr-xr-x 1 admin 197121 238482 Oct 16 06:22 wingenminiupnpcstrings.exe*

@jakubgs
Copy link
Member Author

jakubgs commented Oct 16, 2023

And after that another thing fails, this time miniwget.o:

Updating goal targets....
 File 'libminiupnpc.a' does not exist.
  File 'miniwget.o' does not exist.                                                                                                                                                  
 Must remake target 'miniwget.o'.
gcc -Os -Wall -W -Wstrict-prototypes -DNDEBUG -D_WIN32_WINNT=0x501 -Iinclude -I. -DMINIUPNP_STATICLIB -c -o miniwget.o src/miniwget.c
process_begin: CreateProcess(NULL, gcc -Os -Wall -W -Wstrict-prototypes -DNDEBUG -D_WIN32_WINNT=0x501 -Iinclude -I. -DMINIUPNP_STATICLIB -c -o miniwget.o src/miniwget.c, ...) failed.

make (e=2): The system cannot find the file specified.                                                                                                                               
make[1]: *** [Makefile.mingw:101: miniwget.o] Error 2 

But again, if I take that command and run it manually:

admin@windows-01 MINGW64 .../miniupnp/miniupnpc ((17cecd5...))
$ gcc -Os -Wall -W -Wstrict-prototypes -DNDEBUG -D_WIN32_WINNT=0x501 -Iinclude -I. -DMINIUPNP_STATICLIB -c -o miniwget.o src/miniwget.c

admin@windows-01 MINGW64 .../miniupnp/miniupnpc ((17cecd5...))
$ ls -l miniwget.o
-rw-r--r-- 1 admin 197121 5372 Oct 16 06:34 miniwget.o

It works... and then minixml.o becomes the problem. So there's something wrong with our Makefiles probably.

@jakubgs
Copy link
Member Author

jakubgs commented Oct 16, 2023

Upgrading from mingw-nuwen GCC distribution:

$ gcc --version
gcc.exe (GCC) 11.2.0

To recent normal mingw

$ gcc --version
gcc.exe (x86_64-posix-seh-rev0, Built by MinGW-Builds project) 13.2.0

Resulted in error:

Updating goal targets....
 File 'libminiupnpc.a' does not exist.
    Prerequisite 'wingenminiupnpcstrings.c' is newer than target 'wingenminiupnpcstrings.exe'.
   Must remake target 'wingenminiupnpcstrings.exe'.
gcc -Os -Wall -W -Wstrict-prototypes -DNDEBUG -D_WIN32_WINNT=0x501 -Iinclude -I. -o wingenminiupnpcstrings.exe wingenminiupnpcstrings.c
gcc: fatal error: cannot execute 'cc1': CreateProcess: No such file or directory
compilation terminated.
make[1]: *** [Makefile.mingw:121: wingenminiupnpcstrings.exe] Error 1

Which I guess means I have to adjust PATH:

admin@windows-01 MINGW64 /d/beacon-node-prater-stable
$ find /c/ProgramData/scoop/apps/ -iname 'cc1.exe'
/c/ProgramData/scoop/apps/gcc/11.2.0/libexec/gcc/x86_64-w64-mingw32/11.2.0/cc1.exe
/c/ProgramData/scoop/apps/mingw/13.2.0-rt_v11-rev0/libexec/gcc/x86_64-w64-mingw32/13.2.0/cc1.exe
/c/ProgramData/scoop/apps/mingw-nuwen/18.0/libexec/gcc/x86_64-w64-mingw32/11.2.0/cc1.exe

@jakubgs
Copy link
Member Author

jakubgs commented Oct 16, 2023

Interestingly -print-prog-name=cc1 flag works correctly:

admin@windows-01 MINGW64 /d/beacon-node-prater-stable
$ gcc -print-prog-name=cc1
C:/ProgramData/scoop/apps/mingw/13.2.0-rt_v11-rev0/bin/../libexec/gcc/x86_64-w64-mingw32/13.2.0/cc1.exe

@tersec
Copy link
Contributor

tersec commented Mar 9, 2024

Does this still apply to Windows Server 2022? https://learn.microsoft.com/en-us/lifecycle/products/windows-server-2019 states that as of 2024-01-09T22:59:59.999-08:00, Windows Server 2019 is EOL.

@cheatfate
Copy link
Contributor

If i remember correctly you need to have cmake to be installed to build miniupnpc and friends.
Also i would recommend to keep gcc at version 12.3.0

@jakubgs
Copy link
Member Author

jakubgs commented Mar 21, 2024

I have not checked this in a while. Now that Prater is essentially dead it's time to deploy Holesky nodes.

Will get back to you once it's re-installed by support and I try to build nimbus-eth2.

@jakubgs
Copy link
Member Author

jakubgs commented Mar 21, 2024

@tersec extended support for 2019 version is until 2029:

image

https://learn.microsoft.com/en-us/lifecycle/products/windows-server-2019

@jakubgs
Copy link
Member Author

jakubgs commented Mar 26, 2024

I manged to build stable beacon node on Windows Server 2019 Standard, but it segfaults at startup:

nimbus@windows-01 MINGW64 ~/beacon-node-holesky-stable
$ bin/nimbus_beacon_node.exe --help
Segmentation fault

nimbus@windows-01 MINGW64 ~/beacon-node-holesky-stable
$ bin/nimbus_beacon_node.exe --version
Segmentation fault

I guess I need to open a new issue.

@jakubgs
Copy link
Member Author

jakubgs commented Mar 26, 2024

I think the build issue is no longer relevant. And possibly it was caused by use of Essentials rather than Standard Windows.

@jakubgs
Copy link
Member Author

jakubgs commented Mar 26, 2024

Actually, I just got build failures for unstable branch that look familiar:

which gcc &>/dev/null || { echo "C compiler (gcc) not installed. Aborting."; exit 1; }
gcc -Os -Wall -W -Wstrict-prototypes -DNDEBUG -D_WIN32_WINNT=0x501 -Iinclude -I. -o wingenminiupnpcstrings.exe wingenminiupnpcstri
ngs.c
gcc -Os -Wall -W -Wstrict-prototypes -DNDEBUG -D_WIN32_WINNT=0x501 -Iinclude -I. -DMINIUPNP_STATICLIB -c -o minixml.o src/minixml.
c
gcc -Os -Wall -W -Wstrict-prototypes -DNDEBUG -D_WIN32_WINNT=0x501 -Iinclude -I. -DMINIUPNP_STATICLIB -c -o igd_desc_parse.o src/i
gd_desc_parse.c
gcc: fatal error: cannot execute 'cc1': CreateProcess: No such file or directory
compilation terminated.
make[1]: *** [Makefile.mingw:121: wingenminiupnpcstrings.exe] Error 1
make[1]: *** Waiting for unfinished jobs....
gcc: fatal error: cannot execute 'cc1': CreateProcess: No such file or directory
compilation terminated.
make[1]: *** [Makefile.mingw:101: minixml.o] Error 1
gcc: fatal error: cannot execute 'cc1': CreateProcess: No such file or directory
compilation terminated.
make[1]: *** [Makefile.mingw:101: igd_desc_parse.o] Error 1
make[1]: Leaving directory 'D:/beacon-node-holesky-unstable/repo/vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc'
make: *** [vendor/nimbus-build-system/makefiles/targets.mk:134: libminiupnpc.a] Error 2

@jakubgs jakubgs reopened this Mar 26, 2024
@jakubgs
Copy link
Member Author

jakubgs commented Mar 26, 2024

I managed to fix it by copying these files from stable repo that built fine:

nimbus@windows-01 MINGW64 .../miniupnp/miniupnpc ((97d928b...))
$ ls -l wingenminiupnpcstrings.exe
-rwxr-xr-x 1 nimbus 197121 236465 Mar 25 12:23 wingenminiupnpcstrings.exe*

@jakubgs
Copy link
Member Author

jakubgs commented Mar 26, 2024

If I build the target directly it works fine:

nimbus@windows-01 MINGW64 /d/beacon-node-holesky-libp2p/repo (nim-libp2p-auto-bump-unstable)
$ make -C vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc -f Makefile.mingw CC=gcc libminiupnpc.a
make: Entering directory 'D:/beacon-node-holesky-libp2p/repo/vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc'
gcc -Os -Wall -W -Wstrict-prototypes -DNDEBUG -D_WIN32_WINNT=0x501 -Iinclude -I. -o wingenminiupnpcstrings.exe wingenminiupnpcstrings.c
.\wingenminiupnpcstrings.exe miniupnpcstrings.h.in miniupnpcstrings.h rc_version.h
Windows 6.2 Build 9200
MiniUPnPc version 2.2.6
27 lines written to miniupnpcstrings.h.
rc_version.h written
gcc -Os -Wall -W -Wstrict-prototypes -DNDEBUG -D_WIN32_WINNT=0x501 -Iinclude -I. -DMINIUPNP_STATICLIB -c -o miniwget.o src/miniwget.c
gcc -Os -Wall -W -Wstrict-prototypes -DNDEBUG -D_WIN32_WINNT=0x501 -Iinclude -I. -DMINIUPNP_STATICLIB -c -o minixml.o src/minixml.c
gcc -Os -Wall -W -Wstrict-prototypes -DNDEBUG -D_WIN32_WINNT=0x501 -Iinclude -I. -DMINIUPNP_STATICLIB -c -o igd_desc_parse.o src/igd_desc_parse.c
gcc -Os -Wall -W -Wstrict-prototypes -DNDEBUG -D_WIN32_WINNT=0x501 -Iinclude -I. -DMINIUPNP_STATICLIB -c -o minisoap.o src/minisoap.c
gcc -Os -Wall -W -Wstrict-prototypes -DNDEBUG -D_WIN32_WINNT=0x501 -Iinclude -I. -DMINIUPNP_STATICLIB -c -o minissdpc.o src/minissdpc.c
gcc -Os -Wall -W -Wstrict-prototypes -DNDEBUG -D_WIN32_WINNT=0x501 -Iinclude -I. -DMINIUPNP_STATICLIB -c -o miniupnpc.o src/miniupnpc.c
gcc -Os -Wall -W -Wstrict-prototypes -DNDEBUG -D_WIN32_WINNT=0x501 -Iinclude -I. -DMINIUPNP_STATICLIB -c -o upnpreplyparse.o src/upnpreplyparse.c
gcc -Os -Wall -W -Wstrict-prototypes -DNDEBUG -D_WIN32_WINNT=0x501 -Iinclude -I. -DMINIUPNP_STATICLIB -c -o upnpcommands.o src/upnpcommands.c
gcc -Os -Wall -W -Wstrict-prototypes -DNDEBUG -D_WIN32_WINNT=0x501 -Iinclude -I. -DMINIUPNP_STATICLIB -c -o upnperrors.o src/upnperrors.c
gcc -Os -Wall -W -Wstrict-prototypes -DNDEBUG -D_WIN32_WINNT=0x501 -Iinclude -I. -DMINIUPNP_STATICLIB -c -o connecthostport.o src/connecthostport.c
gcc -Os -Wall -W -Wstrict-prototypes -DNDEBUG -D_WIN32_WINNT=0x501 -Iinclude -I. -DMINIUPNP_STATICLIB -c -o portlistingparse.o src/portlistingparse.c
gcc -Os -Wall -W -Wstrict-prototypes -DNDEBUG -D_WIN32_WINNT=0x501 -Iinclude -I. -DMINIUPNP_STATICLIB -c -o receivedata.o src/receivedata.c
gcc -Os -Wall -W -Wstrict-prototypes -DNDEBUG -D_WIN32_WINNT=0x501 -Iinclude -I. -DMINIUPNP_STATICLIB -c -o upnpdev.o src/upnpdev.c
gcc -Os -Wall -W -Wstrict-prototypes -DNDEBUG -D_WIN32_WINNT=0x501 -Iinclude -I. -DMINIUPNP_STATICLIB -c -o addr_is_reserved.o src/addr_is_reserved.c
ar cr libminiupnpc.a miniwget.o minixml.o igd_desc_parse.o minisoap.o minissdpc.o miniupnpc.o upnpreplyparse.o upnpcommands.o upnperrors.o connecthostport.o portlis
tingparse.o receivedata.o upnpdev.o addr_is_reserved.o
make: Leaving directory 'D:/beacon-node-holesky-libp2p/repo/vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc'

So it seems to me the issue is clearly directly related to nimbus-build-system.

@jakubgs
Copy link
Member Author

jakubgs commented Mar 26, 2024

This is what Hmake libminiupnpc.a --debug -n shows:

Must remake target 'libminiupnpc.a'.                                                                                                                               
[ -e vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc/libminiupnpc.a ] || \                                                                                      
        PATH=".:C:\Users\nimbus\bin;C:\ProgramData\scoop\apps\git\2.44.0\mingw64\bin;C:\ProgramData\scoop\apps\git\2.44.0\usr\local\bin;C:\ProgramData\scoop\apps\gi
t\2.44.0\usr\bin;C:\ProgramData\scoop\apps\git\2.44.0\usr\bin;C:\ProgramData\scoop\apps\git\2.44.0\mingw64\bin;C:\ProgramData\scoop\apps\git\2.44.0\usr\bin;C:\Users
\nimbus\bin;C:\ProgramData\scoop\apps\mingw-nuwen\current\bin;C:\ProgramData\scoop\apps\gcc\current\bin;C:\ProgramData\scoop\apps\python\current\Scripts;C:\ProgramD
ata\scoop\apps\python\current;C:\ProgramData\scoop\shims;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windo
ws\System32\OpenSSH;C:\Program Files\WireGuard;C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps;C:\Users\nimbus\AppData\Local\Microsoft\
WindowsApps;C:\ProgramData\scoop\apps\git\2.44.0\usr\bin\vendor_perl;C:\ProgramData\scoop\apps\git\2.44.0\usr\bin\core_perl" "C:/ProgramData/scoop/apps/mingw-nuwen/
current/bin/make.exe" -C vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc -f Makefile.mingw CC=gcc libminiupnpc.a >/dev/null

Best bet is that this is caused by order of entries in PATH.

@jakubgs
Copy link
Member Author

jakubgs commented Mar 26, 2024

Seems the only modification is addition of . at the beginning:

libminiupnpc.a: | sanity-checks
ifeq ($(OS), Windows_NT)
	+ [ -e vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc/$@ ] || \
		PATH=".:${PATH}" "$(MAKE)" -C vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc -f Makefile.mingw CC=$(CC) $@ $(HANDLE_OUTPUT)
else
	+ "$(MAKE)" -C vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc build/$@ $(HANDLE_OUTPUT)
endif

I actually have absolutely no idea what's the point of that . at the beginning.

@jakubgs
Copy link
Member Author

jakubgs commented Mar 26, 2024

That was added in:

But WHY?

@jakubgs
Copy link
Member Author

jakubgs commented Mar 26, 2024

Interestingly, after I cleaned up miniupnpc:

nimbus@windows-01 MINGW64 .../miniupnp/miniupnpc ((f5d0e49...))
$ g clean -fdx
Removing .Makefile.mingw.swp
Removing addr_is_reserved.o
Removing connecthostport.o
Removing igd_desc_parse.o
Removing minisoap.o
Removing minissdpc.o
Removing miniupnpc.o
Removing miniupnpcstrings.h
Removing miniwget.o
Removing minixml.o
Removing portlistingparse.o
Removing rc_version.h
Removing receivedata.o
Removing upnpcommands.o
Removing upnpdev.o
Removing upnperrors.o
Removing upnpreplyparse.o

It started failing again, so i removed the PATH=".:${PATH}" part from makefiles/targets.mk and it worked:

nimbus@windows-01 MINGW64 /d/beacon-node-holesky-libp2p/repo (nim-libp2p-auto-bump-unstable)
$ make libminiupnpc.a --debug
Reading makefiles...
Updating makefiles....
Updating goal targets....
 File 'libminiupnpc.a' does not exist.
   File 'sanity-checks' does not exist.
  Must remake target 'sanity-checks'.
  Successfully remade target file 'sanity-checks'.
Must remake target 'libminiupnpc.a'.
Successfully remade target file 'libminiupnpc.a'.

No idea why it's necessary at all.

jakubgs added a commit to status-im/nimbus-build-system that referenced this issue Mar 26, 2024
Otherwise the build fails with:
```
nimbus@windows-01 MINGW64 /d/beacon-node-holesky-libp2p/repo (nim-libp2p-auto-bump-unstable)
$ make libminiupnpc.a --debug
Reading makefiles...
Updating makefiles....
Updating goal targets....
 File 'libminiupnpc.a' does not exist.
   File 'sanity-checks' does not exist.
  Must remake target 'sanity-checks'.
  Successfully remade target file 'sanity-checks'.
Must remake target 'libminiupnpc.a'.
process_begin: CreateProcess(NULL, git rev-parse --short HEAD, ...) failed.
Makefile.mingw:56: pipe: No error
gcc: fatal error: cannot execute 'cc1': CreateProcess: No such file or directory
compilation terminated.
make[1]: *** [Makefile.mingw:121: wingenminiupnpcstrings.exe] Error 1
make: *** [vendor/nimbus-build-system/makefiles/targets.mk:134: libminiupnpc.a] Error 2
```
For more details see:
status-im/nimbus-eth2#5507

Signed-off-by: Jakub Sokołowski <jakub@status.im>
jakubgs added a commit to status-im/nimbus-build-system that referenced this issue Mar 26, 2024
Otherwise the build fails with:
```
nimbus@windows-01 MINGW64 /d/beacon-node-holesky-libp2p/repo (nim-libp2p-auto-bump-unstable)
$ make libminiupnpc.a --debug
Reading makefiles...
Updating makefiles....
Updating goal targets....
 File 'libminiupnpc.a' does not exist.
   File 'sanity-checks' does not exist.
  Must remake target 'sanity-checks'.
  Successfully remade target file 'sanity-checks'.
Must remake target 'libminiupnpc.a'.
process_begin: CreateProcess(NULL, git rev-parse --short HEAD, ...) failed.
Makefile.mingw:56: pipe: No error
gcc: fatal error: cannot execute 'cc1': CreateProcess: No such file or directory
compilation terminated.
make[1]: *** [Makefile.mingw:121: wingenminiupnpcstrings.exe] Error 1
make: *** [vendor/nimbus-build-system/makefiles/targets.mk:134: libminiupnpc.a] Error 2
```
Resolves:
status-im/nimbus-eth2#5507

Signed-off-by: Jakub Sokołowski <jakub@status.im>
jakubgs added a commit to status-im/nimbus-build-system that referenced this issue Mar 27, 2024
Also use correct `;` divider. Otherwise the build fails with:
```
nimbus@windows-01 MINGW64 /d/beacon-node-holesky-libp2p/repo (nim-libp2p-auto-bump-unstable)
$ make libminiupnpc.a --debug
Reading makefiles...
Updating makefiles....
Updating goal targets....
 File 'libminiupnpc.a' does not exist.
   File 'sanity-checks' does not exist.
  Must remake target 'sanity-checks'.
  Successfully remade target file 'sanity-checks'.
Must remake target 'libminiupnpc.a'.
process_begin: CreateProcess(NULL, git rev-parse --short HEAD, ...) failed.
Makefile.mingw:56: pipe: No error
gcc: fatal error: cannot execute 'cc1': CreateProcess: No such file or directory
compilation terminated.
make[1]: *** [Makefile.mingw:121: wingenminiupnpcstrings.exe] Error 1
make: *** [vendor/nimbus-build-system/makefiles/targets.mk:134: libminiupnpc.a] Error 2
```
Resolves:
status-im/nimbus-eth2#5507

I still don't get why this `PATH` modification is even necessary, it works without it.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants