如何在Solaris上构建Git



我从下载了Git源代码

https://github.com/git/git

现在尝试在Solaris 10g上构建。

我不确定我需要在Makefile中更改什么,如果有的话,因为没有"配置"文件。当我运行时,使我得到:

cc: illegal option -Wall
make: *** [credential-store.o] Error 1

我确实安装了gcc,但我不知道如何告诉Makefile使用它

更新:

根据下面的答案更新了Makefile,但我仍然无法编译:

make
CC credential-store.o
cc1: error: unrecognized command line option "-fprofile-correction"
make: *** [credential-store.o] Error 1

将Makefile的396行修改为

CC = gcc

关于-fprofile-correction问题,您可以通过从Makefile的第1558行删除有问题的选项来解决它。也就是说,改变

CFLAGS += -fprofile-use=$(PROFILE_DIR) -fprofile-correction -DNO_NORETURN=1

进入

CFLAGS += -fprofile-use=$(PROFILE_DIR) -DNO_NORETURN=1

看看OpenCSW。你可以得到一个工作的git包和如何构建它的来源。

2年后,git的当前版本是2.9.3,但谷歌将我发送到这里供参考。

我最初的编译错误是:

LINK git-credential-store
ld: fatal: library -liconv: not found
ld: fatal: file processing errors. No output written to git-credential-store
collect2: ld returned 1 exit status
make: *** [Makefile:2018: git-credential-store] Error 1
$

它使用(在路径中,gnu-make领先于Solaris-make):编译

make configure      # creates the configure script
./configure --with-iconv=/usr/local --with-openssl=/usr/local --with-zlib=/usr/local --with-python=/usr/sfw/bin
make ICONV_LINK='-L/usr/local/lib -lintl' CC=gcc

编译GNU软件需要gmake或同等版本。由于其他项目,我最近对/usr/sfw/中的大部分内容进行了重建,并将其编译到/usr/local中,包括最新的gnu-make。找到了iconv&gettext是相互关联的,需要在知道彼此存在的情况下对它们进行编译,因此对每个gettext进行了两次编译。

INSTALL文件和./configure --help对我来说没有足够的参考资料,但它们让我走了90%的路。

直到我找到这个参考资料,我才找到成功编译所需的ICONV_LINK='-L/usr/local/lib -lintl'。第一次,我准确地遵循了它,进行了所有的编辑,直到我把它缩小到我上面发布的内容:http://git.661346.n2.nabble.com/Compiling-git-on-Solaris-Recipe-included-td7541556.html

主机&编译器:

$ uname -a
SunOS mysunbox 5.10 Generic_147147-26 sun4u sparc SUNW,Sun-Blade-1500 Solaris
$
$ gcc -v
Reading specs from /usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/specs
Configured with: /sfw10/builds/build/sfw10-patch/usr/src/cmd/gcc/gcc-3.4.3/configure --prefix=/usr/sfw --with-as=/usr/ccs/bin/as --without-gnu-as --with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++ --enable-shared
Thread model: posix
gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath)
$

希望这能帮助到别人!(未来可能还有2年)

最新更新