Cygwin编译LibreDWG

本文详细描述了如何在Windows环境下使用Cygwin编译LibreDWG时遇到的符号问题和宏重定义问题,包括git配置和configure参数调整的解决方案。
摘要由CSDN通过智能技术生成

使用Cygwin编译LibreDWG

配置说明

按照这个说明把该安装的都安装了,内容步骤不会有啥问题,步骤过程中可能出现问题

参考:Group: LibreDWG/BuildingWithCygwin
< Group:LibreDWG

问题注意

1 window和linux符号问题

如果按照常规的git或是下载源码可能会出现这个问题,不太熟悉linux,看帖子发现好像确实是这个问题,如果通过改文件中符号的,可以解决,但是每个文件都要改一遍。
可以按照如下的操作方式来处理:可参考的编译问题在这里插入图片描述
翻帖子发现,可以通过git来控制,具体的配置方式可以通过配置git选项来:

git config --global core.autocrlf false
git config --global core.safecrlf true
git config --global core.eol lf

2 congfigrue 参数选项配置

按照前述步骤处理后,autogen.sh 和configure两个步骤将会很顺利,但是在make过程中会出现宏重定义的问题,报两个文件一个是config.h和common.h,这两个可以通过在configure过程中控制两个参数来处理。
make过程中错误信息如下:

In file included from bits.h:36,
                 from dwg.c:40:
config.h:414: error: "__XSI_VISIBLE" redefined [-Werror]
  414 | #define __XSI_VISIBLE 700
      |
In file included from /usr/include/sys/config.h:5,
                 from /usr/include/_ansi.h:11,
                 from /usr/include/stdio.h:29,
                 from dwg.c:23:
/usr/include/sys/features.h:332: note: this is the location of the previous definition
  332 | #define __XSI_VISIBLE           0
      |
In file included from bits.h:50,
                 from dwg.c:40:
common.h:349: error: "__nonnull_all" redefined [-Werror]
  349 | #  define __nonnull_all __attribute__ ((__nonnull__))

这个错误可以通过配置下面这两个参数来处理

./configure --host=x86_64
./configure --host=x86_64 --disable-werror

github上的issue,–disable-werror需要配置这个选项
在这里插入图片描述

最终终端配置过程:

$ ./configure --host=x86_64 --disable-werror
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for x86_64-strip... no
checking for strip... strip
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking git version... 0.13.3.31_417df
checking so version-info... 0:13:0
checking build system type... x86_64-pc-cygwin
checking host system type... x86_64-pc-none
checking for x86_64-pkg-config... no
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking whether make supports the include directive... yes (GNU style)
checking for x86_64-gcc... no
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 the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/x86_64-pc-cygwin/bin/ld.exe
checking if the linker (/usr/x86_64-pc-cygwin/bin/ld.exe) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... no
checking for x86_64-dumpbin... no
checking for x86_64-link... no
checking for dumpbin... no
checking for link... link -dump
checking the name lister (nm) interface... BSD nm
checking the maximum length of command line arguments... 8192
checking how to convert x86_64-pc-cygwin file names to x86_64-pc-none format... func_convert_file_noop
checking how to convert x86_64-pc-cygwin file names to toolchain format... func_convert_file_noop
checking for /usr/x86_64-pc-cygwin/bin/ld.exe option to reload object files... -r
checking for x86_64-file... no
checking for file... file
checking for x86_64-objdump... no
checking for objdump... objdump
checking how to recognize dependent libraries... unknown
checking for x86_64-dlltool... no
checking for dlltool... dlltool
checking how to associate runtime and link libraries... printf %s\n
checking for x86_64-ar... no
checking for ar... ar
checking for archiver @FILE support... @
checking for x86_64-strip... strip
checking for x86_64-ranlib... no
checking for ranlib... ranlib
checking command to parse nm 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 x86_64-mt... no
checking for mt... no
checking if : is a manifest tool... no
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -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 (/usr/x86_64-pc-cygwin/bin/ld.exe) supports shared libraries... yes
checking whether -lc should be explicitly linked in... yes
checking dynamic linker characteristics... no
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... no
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking for bash... /bin/sh
checking for inline... inline
checking for C/C++ restrict keyword... __restrict__
checking for ld... /usr/x86_64-pc-cygwin/bin/ld.exe
checking if the linker (/usr/x86_64-pc-cygwin/bin/ld.exe) is GNU ld... yes
checking for shared library run path origin... done
./configure: line 14098: gl_HOST_CPU_C_ABI_32BIT: command not found
checking how to run the C preprocessor... gcc -E
checking for egrep -e... (cached) /usr/bin/grep -E
checking for ELF binary format... no
checking for the common suffixes of directories in the library search path... ./configure: line 14473: test: !=: unary operator expected
./configure: line 14479: test: !=: unary operator expected
./configure: line 14504: test: =: unary operator expected
./configure: line 14508: test: =: unary operator expected
lib,lib,lib
checking for iconv... ./configure: line 15094: test: too many arguments
no, consider installing GNU libiconv
checking for PS_open_file in -lps... no
checking for pcre2_config_8 in -lpcre2-8... no
configure: WARNING: libpcre2 for dwggrep not found
checking for pcre2_config_16 in -lpcre2-16... no
checking for newXMLEntity in -lxml2... no
checking for egrep... (cached) /usr/bin/grep -E
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for stddef.h... yes
checking for unistd.h... (cached) yes
checking for malloc.h... yes
checking for wchar.h... yes
checking for ctype.h... yes
checking for wctype.h... yes
checking for float.h... yes
checking for limits.h... yes
checking for sys/param.h... yes
checking for direct.h... no
checking for libgen.h... yes
checking for iconv.h... no
checking for sys/time.h... yes
checking for getopt.h... yes
checking for alloca.h... yes
checking for valgrind/valgrind.h... no
checking for endian.h... yes
checking for byteswap.h... yes
checking for mimalloc-override.h... no
checking whether byte ordering is bigendian... no
checking for _Bool... yes
checking for stdbool.h that conforms to C99 or later... yes
checking for strcasecmp header file... <strings.h>
checking if le16toh is available in endian.h... yes
checking if le32toh is available in endian.h... yes
checking if le64toh is available in endian.h... yes
checking if htole32 is available in endian.h... yes
checking if htole64 is available in endian.h... yes
checking if htobe16 is available in endian.h... yes
checking if htobe32 is available in endian.h... yes
checking if htobe64 is available in endian.h... yes
checking if be64toh is available in endian.h... yes
configure: WARNING: Couldn't find pcre2.h. No regex support in dwggrep
checking if pointers to integers require aligned access... no
checking for size_t... yes
checking for int16_t... yes
checking for uint16_t... yes
checking for int32_t... yes
checking for uint32_t... yes
checking for int64_t... yes
checking for uint64_t... yes
checking size of size_t... 8
checking size of wchar_t... 2
checking whether C compiler accepts -Werror=unknown-warning-option... no
checking whether C compiler accepts -Wsuggest-attribute=format... yes
checking whether C compiler accepts -mretpoline -DRETPOLINE... no
checking whether C compiler accepts -mindirect-branch=thunk-extern -mfunction-return=thunk-extern -mindirect-branch-register -DRETPOLINE... yes
checking whether C compiler accepts -fno-strict-aliasing... yes
checking whether C compiler accepts -fwrapv... yes
checking whether C compiler accepts -fno-common... yes
checking whether C compiler accepts -fvisibility=hidden... yes
checking whether C compiler accepts -fno-strict-aliasing... (cached) yes
checking whether C compiler accepts -fno-delete-null-pointer-checks... yes
checking whether C compiler accepts -Wall... yes
checking whether C compiler accepts -Wextra... yes
checking whether C compiler accepts -Wundef... yes
checking whether C compiler accepts -Wwrite-strings... yes
checking whether C compiler accepts -Wpointer-arith... yes
checking whether C compiler accepts -Wmissing-declarations... yes
checking whether C compiler accepts -Wredundant-decls... yes
checking whether C compiler accepts -Wno-unused-variable... yes
checking whether C compiler accepts -Wno-unused-parameter... yes
checking whether C compiler accepts -Wno-unused-but-set-variable... yes
checking whether C compiler accepts -Wmissing-field-initializers... yes
checking whether C compiler accepts -Wcast-align... yes
checking whether C compiler accepts -Wformat=2... yes
checking whether C compiler accepts -Wformat-nonliteral... no
checking whether C compiler accepts -Wformat-security... no
checking whether C compiler accepts -Wformat-y2k... no
checking whether C compiler accepts -Wsign-compare... yes
checking whether C compiler accepts -Wstrict-aliasing... yes
checking whether C compiler accepts -Wshadow... yes
checking whether C compiler accepts -Winline... yes
checking whether C compiler accepts -Wpacked... yes
checking whether C compiler accepts -Wmissing-format-attribute... yes
checking whether C compiler accepts -Wmissing-noreturn... yes
checking whether C compiler accepts -Winit-self... yes
checking whether C compiler accepts -Wredundant-decls... (cached) yes
checking whether C compiler accepts -Wmissing-include-dirs... yes
checking whether C compiler accepts -Warray-bounds... yes
checking whether C compiler accepts -Wreturn-type... yes
checking whether C compiler accepts -Wswitch-enum... (cached) no
checking whether C compiler accepts -Wswitch-default... yes
checking whether C compiler accepts -Wduplicated-cond... yes
checking whether C compiler accepts -Wduplicated-branches... yes
checking whether C compiler accepts -Wlogical-op... yes
checking whether C compiler accepts -Wrestrict... yes
checking whether C compiler accepts -Wnull-dereference... yes
checking whether C compiler accepts -Wdouble-promotion... yes
checking whether C compiler accepts -Wchar-subscripts... yes
checking whether C compiler accepts -Wformat=2 -Wformat-nonliteral... yes
checking whether C compiler accepts -Wformat=2 -Wformat-security... yes
checking whether C compiler accepts -Wformat=2 -Wformat-y2k... yes
checking whether C compiler accepts -Wnested-externs... yes
checking whether C compiler accepts -Wmissing-prototypes... yes
checking whether C compiler accepts -Wstrict-prototypes... yes
checking whether C compiler accepts -Wdeclaration-after-statement... yes
checking whether C compiler accepts -Wimplicit-function-declaration... yes
checking whether C compiler accepts -Wold-style-definition... yes
checking whether C compiler accepts -Wjump-misses-init... yes
checking whether C compiler accepts -Wno-error=unused-variable... yes
checking whether C compiler accepts -Wno-error=unused-parameter... yes
checking whether C compiler accepts -Wno-error=unused-but-set-variable... yes
checking whether C compiler accepts -Werror=unknown-warning-option... (cached) no
checking whether the linker accepts -Wl,--as-needed... yes
checking whether the linker accepts -Wl,--as-needed... yes
checking whether the linker accepts -Wl,-z,relro... no
checking whether the linker accepts -Wl,-z,now... no
checking whether the linker accepts -Wl,-z,noexecstack... no
checking whether the linker accepts -Wl,--no-as-needed... yes
checking whether the linker accepts -Wl,--fatal-warnings... yes
checking whether the linker accepts -Wl,-fatal_warnings... no
checking whether the linker accepts -Wl,--no-as-needed... yes
checking for __attribute__((visibility("default")))... yes
checking whether C compiler accepts -Werror... yes
checking for __attribute__((gnu_format))... yes
checking for __attribute__((ms_format))... yes
checking for __attribute__((format))... yes
checking for __attribute__((malloc))... yes
checking for __attribute__((returns_nonnull))... yes
checking for __attribute__((noreturn))... yes
checking for __attribute__((aligned))... yes
checking for printf() modifier to use with size_t... "z"
checking for GNU libc compatible malloc... (cached) yes
checking for GNU libc compatible realloc... (cached) yes
checking whether lstat correctly handles trailing slash... yes
checking whether stat accepts an empty string... no
checking for working alloca.h... yes
checking for alloca... yes
checking for strtod... yes
checking for strdup... yes
checking for getopt_long... yes
checking for basename... yes
checking for strcasestr... yes
checking for scandir... yes
checking for floor... yes
checking for sqrt... yes
checking for gettimeofday... yes
checking for floor in -lm... yes
checking for sincos... yes
checking for memchr... yes
checking for memmove... yes
checking for strcasecmp... yes
checking for strchr... yes
checking for strstr... yes
checking for strrchr... yes
checking for strtol... yes
checking for strtoll... yes
checking for strtoul... yes
checking for strtoull... yes
checking for strnlen... yes
checking for memmem... yes
checking for gmtime_r... yes
checking for wcslen... yes
checking for wcsnlen... yes
checking for wcscpy... yes
checking for wcscmp... yes
checking for wcsstr... yes
checking for sscanf_s... no
configure: WARNING: No secure sscanf_s found. dwgfuzz -add will produce false positives.
checking for --enable-debug... no (default)
checking whether C compiler accepts -Werror... (cached) yes
checking whether to add -D_FORTIFY_SOURCE=3 to CPPFLAGS... yes
checking for C restrict usability... restrict
yes
checking for --disable-write... no (default)
checking for --enable-trace... no (default)
checking for --with-dxf-precision... max (default)
checking for --with-geojson-precision... max (default)
checking for --disable-werror... yes
checking for setenv... yes
checking for --disable-dxf... no (default)
checking for --disable-json... no (default)
checking for --disable-bindings... no (default)
checking for --disable-docs... no (default)
checking for --enable-check-less... no (default)
checking for --with-mimalloc... no mimalloc headers found
checking for --enable-gcov... no (default)
checking for gperf... no
checking for latest clang-format... echo
checking for latest clang-tidy... echo
checking for --disable-python... check (default)
checking for swig... /usr/bin/swig
checking SWIG version... 4.2.0
checking for SWIG library... /usr/share/swig/4.2.0
checking for python... /usr/bin/python
checking for python version... 3.9
checking for python platform... cygwin
checking for GNU default python prefix... ${prefix}
checking for GNU default python exec_prefix... ${exec_prefix}
checking for python script directory (pythondir)... ${PYTHON_PREFIX}/lib/python3.9/site-packages
checking for python extension module directory (pyexecdir)... ${PYTHON_EXEC_PREFIX}/lib/python3.9/site-packages
checking for python3.9... (cached) /usr/bin/python
checking for a version of Python >= '2.1.0'... yes
checking for the sysconfig Python package... yes
checking for Python include path... -I/usr/include/python3.9
checking for Python library path... -L/usr/lib -lpython3.9
checking for Python site-packages path... /usr/local/lib/python3.9/site-packages
checking for Python platform specific site-packages path... /usr/local/lib/python3.9/site-packages
checking python extra libraries... -lcrypt -lintl -ldl
checking python extra linking flags...
checking consistency of all components of python development environment... yes
checking for patch... no
checking for the libxml2 Python package... yes
checking for perl... /usr/bin/perl
checking PERL version... v5.36.3
checking for --with-perl-install=... site (default)
checking for cppcheck... no
checking for picat... no
checking for parallel... no
checking for timeout... timeout
checking TIMEOUT version... 9.0
checking for makeinfo... ${SHELL} '/cygdrive/d/Coder/TGeo_LCM/3rdParty/libredwg/build-aux/missing' makeinfo
checking MAKEINFO version...
checking for ./../ODA-spec... no
checking for doxygen... no
checking for jq... no
checking for shellcheck... no
checking for shfmt... no
checking for rpmlint... no
checking for geojsonhint... no
checking for gjv... no
checking for jing... no
checking for valgrind... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating src/codepages/Makefile
config.status: creating doc/Makefile
config.status: creating programs/Makefile
config.status: creating examples/Makefile
config.status: creating test/Makefile
config.status: creating test/unit-testing/Makefile
config.status: creating libredwg.pc
config.status: creating vcpkg.json
config.status: creating bindings/Makefile
config.status: creating bindings/python/Makefile
config.status: creating bindings/perl/Makefile.PL
config.status: creating test/xmlsuite/Makefile
config.status: creating programs/dwgfilter
config.status: creating programs/alive.test
config.status: creating programs/dxf.test
config.status: creating programs/json.test
config.status: creating programs/svg.test
config.status: creating examples/dwgadd_test.sh
config.status: creating logs-all.sh
config.status: creating log
config.status: creating dwg
config.status: creating dxf
config.status: creating json
config.status: creating geojson
config.status: creating svg
config.status: creating rw
config.status: creating dynapi_test_all.sh
config.status: creating unit_testing_all.sh
config.status: creating src/config.h
config.status: executing depfiles commands
config.status: executing libtool commands

  • 9
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值