在 Windows 7 上编译 proj-4.9.3

Compiling proj-4.9.3 on windows 7

本文关键字:proj-4 编译 Windows      更新时间:2023-10-16

我在编译 proj-4.9.3 时遇到了一些麻烦mingw530_32:

首先喜欢这个网站:http://www.gaia-gis.it/spatialite-2.4.0-4/mingw_how_to.html#libproj
我运行:

./configure --without-mutex
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... no
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking C_WFLAGS for maximum warnings... -Wall -Wdeclaration-after-statement
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking whether ln -s works... no, using cp -pR
checking whether make sets $(MAKE)... (cached) yes
checking build system type... i686-pc-mingw32
checking host system type... i686-pc-mingw32
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... C:/Qt/Tools/mingw530_32/i686-w64-mingw32/bin/ld.exe
checking if the linker (C:/Qt/Tools/mingw530_32/i686-w64-mingw32/bin/ld.exe) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /c/Qt/Tools/mingw530_32/bin/nm -B
checking the name lister (/c/Qt/Tools/mingw530_32/bin/nm -B) interface... BSD nm
checking the maximum length of command line arguments... 8192
checking how to convert i686-pc-mingw32 file names to i686-pc-mingw32 format... func_convert_file_msys_to_w32
checking how to convert i686-pc-mingw32 file names to toolchain format... func_convert_file_msys_to_w32
checking for C:/Qt/Tools/mingw530_32/i686-w64-mingw32/bin/ld.exe option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... file_magic ^x86 archive import|^x86 DLL
checking for dlltool... dlltool
checking how to associate runtime and link libraries... func_cygming_dll_for_implib
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /c/Qt/Tools/mingw530_32/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... no
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -DDLL_EXPORT -DPIC
checking if gcc PIC flag -DDLL_EXPORT -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (C:/Qt/Tools/mingw530_32/i686-w64-mingw32/bin/ld.exe) supports shared libraries... yes
checking whether -lc should be explicitly linked in... yes
checking dynamic linker characteristics... Win32 ld.exe
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for exp in -lm... yes
checking for ANSI C header files... (cached) yes
checking for localeconv... yes
checking jni.h usability... no
checking jni.h presence... no
checking for jni.h... no
checking whether to enable Java/JNI support... disabled
checking for mutexes... disabled by user
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating cmake/Makefile
config.status: creating src/Makefile
config.status: creating man/Makefile
config.status: creating man/man1/Makefile
config.status: creating man/man3/Makefile
config.status: creating nad/Makefile
config.status: creating jniwrap/Makefile
config.status: creating jniwrap/org/Makefile
config.status: creating jniwrap/org/proj4/Makefile
config.status: creating nad/install
config.status: creating proj.pc
config.status: creating src/proj_config.h
config.status: src/proj_config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands

好像没问题,
然后:

 $ make
Making all in src
make[1]: Entering directory 'D:/01_soft/proj-4.9.3/src'
C:/Qt/Tools/mingw530_32/bin/make  all-am
make[2]: Entering directory 'D:/01_soft/proj-4.9.3/src'
C:/Program Files (x86)/Git/usr/bin/sh.exe ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.  -DPROJ_LIB="/usr/local/share/proj" -DMUTEX_stub   -Wall -Wdeclaration-after-statement -g -O2 -MT PJ_aeqd.lo -MD -MP -MF .deps/PJ_aeqd.Tpo -c -o PJ_aeqd.lo PJ_aeqd.c
/usr/bin/sh: -c: line 0: syntax error near unexpected token `('
/usr/bin/sh: -c: line 0: `C:/Program Files (x86)/Git/usr/bin/sh.exe ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.  -DPROJ_LIB="/usr/local/share/proj" -DMUTEX_stub   -Wall -Wdeclaration-after-statement -g -O2 -MT PJ_aeqd.lo -MD -MP -MF .deps/PJ_aeqd.Tpo -c -o PJ_aeqd.lo PJ_aeqd.c'
Makefile:822: recipe for target 'PJ_aeqd.lo' failed
make[2]: *** [PJ_aeqd.lo] Error 1
make[2]: Leaving directory 'D:/01_soft/proj-4.9.3/src'
Makefile:464: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory 'D:/01_soft/proj-4.9.3/src'
Makefile:439: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

这很奇怪,因为当我手动运行时:

../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.  -DPROJ_LIB="/usr/local/share/proj" -DMUTEX_stub   -Wall -Wdeclaration-after-statement -g -O2 -MT PJ_aeqd.lo -MD -MP -MF .deps/PJ_aeqd.Tpo -c -o PJ_aeqd.lo PJ_aeqd.c

它正在工作。所以我试图将 MakeFile 更改为在没有启动器的情况下直接运行它(C:/Program Files (x86(/Git/usr/bin/sh.exe(,但没有成功。我迷路了...我重新安装了MINGW32但结果相同。我在谷歌上搜索了这个错误,但没有成功。有人可以帮助我吗?

看起来你的"Git for Windows"安装与你的MinGW环境发生了冲突。所以我建议至少在 MinGW 环境中删除 Git 安装的 PATH 变量条目。