[ZBX-23778] Building zabbix_agent2 for windows Created: 2023 Dec 04 Updated: 2023 Dec 06 Resolved: 2023 Dec 06 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Agent (G) |
Affects Version/s: | 6.4.8 |
Fix Version/s: | None |
Type: | Incident report | Priority: | Trivial |
Reporter: | Filippo Gaspari | Assignee: | Edgar Akhmetshin |
Resolution: | Won't fix | Votes: | 0 |
Labels: | None | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Attachments: |
![]() |
Description |
Can't do agent 2 build for windows because of a missed reference:{} Steps to reproduce:
Result: set CGO_CFLAGS= -O2 -g -DHAVE_STDINT_H=1 -DZBX_BUILD_AGENT2=1 -DHAVE_THREAD_LOCAL=1 -IC:\Temp\Zabbix\source\build\mingw\..\..\build\win32\include\common -IC:\Temp\Zabbix\source\build\mingw\..\..\build\mingw -IC:\Temp\Zabbix\source\build\mingw\..\..\include -IC:\Temp\Zabbix\source\build\mingw\..\..\include\common -DHAVE_OPENSSL=1 -DHAVE_OPENSSL_WITH_PSK=1 -IC:\Temp\Zabbix\build\openssl\include -DPCRE2_STATIC -IC:\Temp\Zabbix\build\pcre2\include -DHAVE_PCRE2_H=1 set CGO_LDFLAGS= -LC:\Temp\Zabbix\build\openssl\lib -LC:\Temp\Zabbix\build\pcre2\lib set GOARCH=amd64 set CGO_ENABLED=1 for /F "usebackq tokens=1,2 delims==" %%i in (`wmic os get LocalDateTime /VALUE 2^>NUL`) do if '.%%i.'=='.LocalDateTime.' set ldt=%%j set BUILD_DATE=%ldt:~0,4%-%ldt:~4,2%-%ldt:~6,2% set BUILD_TIME=%ldt:~8,2%:%ldt:~10,2%:%ldt:~12,2% set GOLDFLAGS=-X zabbix.com/pkg/version.compileOs=windows -X zabbix.com/pkg/version.compileArch=amd64 -X main.confDefault=zabbix_agent2.win.conf -X main.applicationName=zabbix_agent2 -X zabbix.com/pkg/version.compileDate=%BUILD_DATE% set GOLDFLAGS=%GOLDFLAGS% -X zabbix.com/pkg/version.compileTime=%BUILD_TIME% cd C:\Temp\Zabbix\source\build\mingw\..\..\src\go go build -tags "openssl pcre2" -ldflags="%GOLDFLAGS%" -o C:\Temp\Zabbix\source\build\mingw\..\..\bin\win64\zabbix_agent2.exe zabbix.com/cmd/zabbix_agent2 # zabbix.com/cmd/zabbix_agent2 C:\Program Files\Go\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1 {color:#de350b}C:/Temp/Zabbix/mingw/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\\Temp\\Zabbix\\build\\openssl\\lib/libcrypto.a(libdefault-lib-rand_win.obj):rand_win.c:(.text+0x38): undefined reference to `BCryptGenRandom'{color} collect2.exe: error: ld returned 1 exit status mingw32-make: *** [Makefile:278: C:\Temp\Zabbix\source\build\mingw\..\..\bin\win64\zabbix_agent2.exe] Error 1 |
Comments |
Comment by Filippo Gaspari [ 2023 Dec 04 ] |
|
Comment by Alexey Pustovalov [ 2023 Dec 04 ] |
I can not confirm the problem. Could you check the procedure for Docker: https://github.com/zabbix/zabbix-docker/actions/runs/7047604201/job/19183230279 |
Comment by Filippo Gaspari [ 2023 Dec 04 ] |
Could you better explain what to check in the docker procedure? |
Comment by Edgar Akhmetshin [ 2023 Dec 05 ] |
The link given to you shows that Agent 2 can be built on Windows with Github Actions without issues for all recent versions: Full building procedure can be found here: |
Comment by Filippo Gaspari [ 2023 Dec 05 ] |
Hi, thank you for your response. I have checked the dockefile for the environment setup for the agent build and I confirm that everything works.I have, however, two questions:
Thank you. |
Comment by Alexey Pustovalov [ 2023 Dec 06 ] |
1. It is provided with all debug symbols. So it is bigger in final application. |
Comment by Edgar Akhmetshin [ 2023 Dec 06 ] |
1 - yes, build process is different, you can optimise final result on your own. Also Go binaries are large because they are statically linked (except for library bindings using cgo). Example how to build you already have. Please be advised, we had to move your ticket as it was created in the public tracker. We shall continue troubleshooting within your support account, but please be more careful next time, as you might accidentally share sensitive data in the public section. For future reference here is the link to your support account: https://support.zabbix.com/servicedesk/customer/portals |