如何在windows上构建git
How to build git on windows?
我正试图从这个存储库构建Git:Git for windows,据说这是Git的最后一个版本,有特定于windows的更改。我在Windows上的MinGw32环境中工作。
我遇到了以下问题:当我试图构建git时,我得到了:
compat/mingw.h:134:25: fatal error: openssl/ssl.h:
No such file or directory #include <openssl/ssl.h>
为什么?我已经在同一环境中使用make
->make install
序列从源代码构建了一个openssl
特别地,ssl.h
被安装到/usr/local/ssl/include/openssl/ssl.h
和/local/ssl/include/openssl/ssl.h
中。
我该如何解决这个问题?
使用MinGW-w64安装MSYS2。
打开Mingw64外壳,添加以下包:
$ pacman -Sy mingw64/mingw-w64-x86_64-openssl
mingw64/mingw-w64-x86_64-pcre2
mingw64/mingw-w64-x86_64-zlib
克隆并构建Git(如果你还没有Git,你可以下载.zip)
$ git clone https://github.com/git-for-windows/git.git
$ cd git
$ make
截至项目网站的当前答案https://gitforwindows.org/#contribute,是下载";Git for Windows SDK";从那个页面。
当你执行安装程序时,它会克隆SDK,并打开一个";Git for Windows SDK";提示-据我所知,非常接近MINGW64提示。
然后:
sdk cd git
sdk build
你已经设置好了,你有一个本地构建的git.exe!SDK默认安装到C:git-sdk-64
,git项目在C:git-sdk-64usrsrcgit
中创建。
自2015年以来,您可以通过新的ci(连续集成)文件夹及其ci/run-windows-build.sh
脚本(2017年3月)找到更完整的Windows构建示例。
它用于.travis.yml
,这意味着您可以将实际构建委托给远程构建环境:travis-ci.org/git/git/builds。
这样,您就不必担心您自己的本地工作站具有或缺少依赖关系。
请先尝试安装openssl,然后尝试构建它。此外,请按照此步骤了解您的问题(尽管它是指定linux的)。
如今,它与Cygwin的配合效果最好。你需要安装它所需要的所有软件包,否则它将导致构建失败。
先决条件:
MSYS2
添加到路径:C:msys64usrbin
pacman -S --needed base-devel mingw-w64-x86_64-gcc mingw-w64-x86_64-gdb mingw-w64-x86_64-curl mingw-w64-x86_64-pcre2
添加到路径:C:msys64mingw64bin
构建:(如果构建用于调试,则忽略此项)
cmd.exe
set MSYSTEM=MINGW64
make
set MSYSTEM=MINGW64
和包装mingw-w64-x86_64-curl
mingw-w64-x86_64-pcre2
对我来说是缺失的
用于调试的构建:https://github.com/git-for-windows/git/wiki/Debugging-Git
创建文件git/config.mak
(git
是从中克隆的repohttps://github.com/git-for-windows/git.git)
DEVELOPER=1
ifndef NDEBUG
CFLAGS := $(filter-out -O2,$(CFLAGS))
ASLR_OPTION := -Wl,--dynamicbase
BASIC_LDFLAGS := $(filter-out $(ASLR_OPTION),$(BASIC_LDFLAGS))
endif
构建
set MSYSTEM=MINGW64
make
使用vscode调试:
{
"name": "(gdb) C git",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}\git.exe",
"args": [
"rev-parse",
"HEAD",
],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
}
- C++为构建时间获取QDateTime的可靠方法
- 无法在 CLion 中构建 C++ 项目
- 函数向量_指针有不同的原型,我可以构建一个吗
- 如何使用ndk-build.cmd构建Android.so文件
- libssh 的函数在构建 libssh 时无法在 Qt 和 cmake 错误中找到
- 在已经使用Git的情况下减少编译时间
- 使用Qt C++计算类似Git的SHA1哈希
- 使用cmake从源代码构建MySQL连接器/C++失败(与以前的声明冲突)
- VSCode-有一个红色下划线,但程序构建和运行正确,并且出现配音错误
- 构建可组合有向图(扫描仪生成器的汤普森构造算法)
- 无法使用Qt Creator在Windows中构建yaml-cpp
- 如何在c++中从git建立外部库
- 在构建时执行execute_process以在构建时获取git提交哈希
- 如何在构建Qt应用程序时运行git命令
- 我如何构建一个从git克隆的单独的增强库
- 如何将 git 版本信息添加到 cython 构建的 .so 文件中?
- Qt Creator 不会构建一个最小的项目 [-c 行 0: git]
- 如何在windows上构建git
- 钩子git命令到visual studio预构建步骤
- 使用git和CMake的c++:如何构建带有特定参数的子模块