Skip to content

Commit 3003e8f

Browse files
authored
Create build-yc-agent-windows.md
build agent in windows
1 parent f4c13b9 commit 3003e8f

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

docs/build-yc-agent-windows.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Build yCrash agent in Windows
2+
3+
Please follow the below instructions to compile and build yCrash agent in Windows.
4+
5+
1. Download and install MSYS2. It is a collection of tools and libraries providing you with an easy-to-use environment for building, installing and running native Windows software. Ue the below link to download installer
6+
7+
[https://github.com/msys2/msys2-installer/releases/download/2021-07-25/msys2-x86_64-20210725.exe](https://github.com/msys2/msys2-installer/releases/download/2021-07-25/msys2-x86_64-20210725.exe)
8+
9+
2. Once the installer is downloaded, run it in your Windows machine. It required 64-bit Windows 7 or newer.
10+
3. Enter the path where you want to install the MSYS2 and click on the Next button
11+
12+
<img src="/docs/images/installation-folder.png" width="600" height="300" />
13+
14+
4. On the next screen press Next button
15+
16+
<img src="/docs/images/start-menu-shortcut.png" width="600" height="300" />
17+
18+
5. In the last step, when the installation is finished, select **Run MSYS2 now** and click on the Finish button.
19+
6. Run the below command to update the package database and base packages when the MSYS2 window is opened again.
20+
21+
```
22+
pacman -Syu
23+
```
24+
<img src="/docs/images/update-db-package.png" width="600" height="300" />
25+
26+
7. Close the window and search for MSYS2 MSYS in the start menu and open MSYS2 again.
27+
28+
<img src="/docs/images/windows-start.png" width="600" height="400" />
29+
30+
8. Now update the rest of the base packages using command
31+
32+
```
33+
pacman -Su
34+
```
35+
<img src="/docs/images/update-package.png" width="600" height="300" />
36+
37+
9. Install mingw-w64 GCC to compile the yCrash agent.
38+
39+
```
40+
pacman -S --needed base-devel mingw-w64-x86_64-toolchain
41+
```
42+
<img src="/docs/images/compile.png" width="600" height="500" />
43+
44+
10. Close the window and reopen it similar to step #7
45+
11. Once the MSYS2 window is open, run the below command to install mingw-w64-go packages.
46+
47+
```
48+
pacman -S mingw-w64-x86_64-go
49+
```
50+
12. Close the MSYS2 window once the installation is completed.
51+
13. Set MSYS2 installation path in the Windows environment variable
52+
53+
```
54+
C:\msys64\mingw64\bin
55+
```
56+
57+
14. Open Windows command prompt and run the below command to check gcc version
58+
59+
```
60+
gcc --version
61+
```
62+
63+
15. Now let's set the GOPATH environment variable. I assume you have installed MYSY2 in the C:/msys64 folder. Create a new folder Go. Execute the below command to set the GOPATH environment variable.
64+
65+
```
66+
set GOPATH=C:\msys64\mingw64\Go
67+
```
68+
<img src="/docs/images/set-gopath.png" width="600" height="200" />
69+
70+
16. Next set GOROOT environment variable. I assume you have installed Go in the C:\Program Files\Go folder. Execute the below command to set the GOROOT environment variable.
71+
72+
```
73+
set GOROOT=C:\Program Files\Go
74+
```
75+
<img src="/docs/images/set-goroot.png" width="600" height="200" />
76+
77+
17. Now you are ready to compile and build yCrash agent on Windows using the below command
78+
79+
```
80+
go build
81+
```
82+
83+
On completion of build you will see ```yc.exe``` file under ```ycrash-agent/yc``` folder. You can find different yCrash agent arguments in the [official documentation](https://docs.ycrash.io/ycrash-agent/all-agent-arguments.html#all-arguments).
84+
85+
86+
87+

0 commit comments

Comments
 (0)