nimbus-eth2 icon indicating copy to clipboard operation
nimbus-eth2 copied to clipboard

Project fails to build on Windows Server 2019

Open jakubgs opened this issue 2 years ago • 5 comments

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:

  • https://github.com/miniupnp/miniupnp/issues/270

There was a fix applied in https://github.com/transmission/miniupnpc/commit/fa4fa71245f05166af05c059dc38371db408f33b from this PR:

  • https://github.com/miniupnp/miniupnp/pull/304

But it appears we already have this fix in our fork: https://github.com/status-im/miniupnp/commit/d3a7441aebd50c210758a844495e6b9ea2f184d8

Although this comment states that it was not really fixed: https://github.com/miniupnp/miniupnp/issues/270#issuecomment-443504371

jakubgs avatar Oct 16 '23 13:10 jakubgs

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 avatar Oct 16 '23 13:10 jakubgs

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 avatar Oct 16 '23 13:10 jakubgs

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 avatar Oct 16 '23 13:10 jakubgs

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 avatar Oct 16 '23 16:10 jakubgs

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

jakubgs avatar Oct 16 '23 16:10 jakubgs

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.

tersec avatar Mar 09 '24 21:03 tersec

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

cheatfate avatar Mar 21 '24 04:03 cheatfate

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 avatar Mar 21 '24 17:03 jakubgs

@tersec extended support for 2019 version is until 2029:

image

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

jakubgs avatar Mar 21 '24 18:03 jakubgs

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 avatar Mar 26 '24 09:03 jakubgs

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

jakubgs avatar Mar 26 '24 09:03 jakubgs

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 avatar Mar 26 '24 20:03 jakubgs

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 avatar Mar 26 '24 20:03 jakubgs

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 avatar Mar 26 '24 22:03 jakubgs

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 avatar Mar 26 '24 22:03 jakubgs

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 avatar Mar 26 '24 22:03 jakubgs

That was added in:

  • https://github.com/status-im/nimbus-build-system/commit/6589cedffa2eb083f838d15c70c45ce000596859 - libminiupnpc.a: fix Windows build when '.' not in PATH

But WHY?

jakubgs avatar Mar 26 '24 22:03 jakubgs

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 avatar Mar 26 '24 23:03 jakubgs