microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
23.27k stars 6.42k forks source link

[gettext] Build error (conflict with libxml2) #30579

Closed yaner-here closed 1 year ago

yaner-here commented 1 year ago

Host Environment

To Reproduce

Steps to reproduce the behavior:

vcpkg.exe install gettext:x64-windows

Failure logs

Building gettext[core,tools]:x64-windows...
-- Using cached gettext-0.21.1.tar.gz.
-- Cleaning sources at C:/lib/vcpkg/buildtrees/gettext/src/gettext-0-de39ca5451.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source C:/lib/vcpkg/downloads/gettext-0.21.1.tar.gz
-- Applying patch android.patch
-- Applying patch uwp.patch
-- Applying patch win-gethostname.patch
-- Applying patch 0003-Fix-win-unicode-paths.patch
-- Applying patch rel_path.patch
-- Using source at C:/lib/vcpkg/buildtrees/gettext/src/gettext-0-de39ca5451.clean
-- Found external ninja('1.11.0').
-- Getting CMake variables for x64-windows
-- Using cached msys-gzip-1.11-1-x86_64.pkg.tar.zst.
-- Using cached msys-bash-5.1.008-1-x86_64.pkg.tar.zst.
-- Using cached msys-autoconf-2.71-3-any.pkg.tar.zst.
-- Using cached msys-diffutils-3.8-2-x86_64.pkg.tar.zst.
-- Using cached msys-binutils-2.37-5-x86_64.pkg.tar.zst.
-- Using cached msys-libtool-2.4.7-3-x86_64.pkg.tar.zst.
-- Using cached msys-file-5.41-2-x86_64.pkg.tar.zst.
-- Using cached msys-zlib-1.2.11-1-x86_64.pkg.tar.xz.
-- Using cached msys-libbz2-1.0.8-3-x86_64.pkg.tar.zst.
-- Using cached msys-coreutils-8.32-2-x86_64.pkg.tar.zst.
-- Using cached msys-grep-3.0-2-x86_64.pkg.tar.xz.
-- Using cached msys-sed-4.8-2-x86_64.pkg.tar.zst.
-- Using cached msys-libpcre-8.45-1-x86_64.pkg.tar.zst.
-- Using cached msys-m4-1.4.19-2-x86_64.pkg.tar.zst.
-- Using cached msys-automake-wrapper-11-4-any.pkg.tar.zst.
-- Using cached msys-gawk-5.1.0-2-x86_64.pkg.tar.zst.
-- Using cached msys-mpfr-4.1.0-1-x86_64.pkg.tar.zst.
-- Using cached msys-gmp-6.2.1-1-x86_64.pkg.tar.zst.
-- Using cached msys-libreadline-8.1.001-1-x86_64.pkg.tar.zst.
-- Using cached msys-ncurses-6.2-2-x86_64.pkg.tar.zst.
-- Using cached msys-automake1.16-1.16.3-3-any.pkg.tar.zst.
-- Using cached msys-perl-5.32.1-2-x86_64.pkg.tar.zst.
-- Using cached msys-libcrypt-2.1-3-x86_64.pkg.tar.zst.
-- Using cached msys-pkg-config-0.29.2-4-x86_64.pkg.tar.zst.
-- Using cached msys-make-4.3-3-x86_64.pkg.tar.zst.
-- Using cached msys-findutils-4.8.0-1-x86_64.pkg.tar.zst.
-- Using cached msys-libintl-0.21-1-x86_64.pkg.tar.zst.
-- Using cached msys-libiconv-1.16-2-x86_64.pkg.tar.zst.
-- Using cached msys-gcc-libs-11.2.0-3-x86_64.pkg.tar.zst.
-- Using cached msys-msys2-runtime-3.2.0-8-x86_64.pkg.tar.zst.
-- Using cached msys-which-2.21-4-x86_64.pkg.tar.zst.
-- Using msys root at C:/lib/vcpkg/downloads/tools/msys2/ca907ea16f6f2ba5
-- Using cached msys-mingw-w64-i686-pkg-config-0.29.2-3-any.pkg.tar.zst.
-- Using cached msys-mingw-w64-i686-libwinpthread-git-9.0.0.6373.5be8fcd83-1-any.pkg.tar.zst.
-- Using msys root at C:/lib/vcpkg/downloads/tools/msys2/9a1ec3f33446b195
-- Configuring x64-windows-rel
-- Building x64-windows-rel
CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:134 (message):
    Command failed: C:/lib/vcpkg/downloads/tools/msys2/ca907ea16f6f2ba5/usr/bin/make.exe -j 13 --trace -f C:/lib/vcpkg/ports/gettext/Makefile all
    Working Directory: C:/lib/vcpkg/buildtrees/gettext/x64-windows-rel/
    See logs for more information:
      C:\lib\vcpkg\buildtrees\gettext\build-x64-windows-rel-out.log
      C:\lib\vcpkg\buildtrees\gettext\build-x64-windows-rel-err.log

Call Stack (most recent call first):
  scripts/cmake/vcpkg_build_make.cmake:151 (vcpkg_execute_build_process)
  scripts/cmake/vcpkg_install_make.cmake:2 (vcpkg_build_make)
  ports/gettext/portfile.cmake:69 (vcpkg_install_make)
  ports/gettext/portfile.cmake:99 (build_libintl_and_tools)
  scripts/ports.cmake:147 (include)

error: building gettext:x64-windows failed with: BUILD_FAILED
error: Please ensure you're using the latest port files with `git pull` and `vcpkg update`.
Then check for known issues at:
    https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+gettext
You can submit a new issue at:
    https://github.com/microsoft/vcpkg/issues/new?template=report-package-build-failure.md&title=[gettext]+Build+error
Include '[gettext] Build error' in your bug report title, the following version information in your bug description, and attach any relevant failure logs from above.
    vcpkg-tool version: 2023-02-16-12e657924d99511514c0287ca5ce46882d3657c7
    vcpkg-scripts version: c9f906558 2023-03-30 (14 hours ago)

Please use the prefilled template from C:\lib\vcpkg\installed\vcpkg\issue_body.md when reporting your issue.

Logs: config-x64-windows-rel-config.log build-x64-windows-rel-out.log build-x64-windows-rel-err.log

dg0yt commented 1 year ago

Can you also share config-x64-windows-rel-config.log? Do have libxml2 installed / does the problem disappear if you remove libxml2 before installing gettext[tools]?

yaner-here commented 1 year ago

@dg0yt I edited my issue to attach config-x64-windows-rel-config.log. And I do have libxml2 installed.

(base) PS C:\Users\Yaner> vcpkg list | findstr "xml"
libarchive[libxml2]:x64-windows                                       Libxml2 support
libxml2:x64-windows                               2.10.3#1            Libxml2 is the XML C parser and toolkit develope...
libxml2[iconv]:x64-windows                                            Add ICONV support
libxml2[lzma]:x64-windows                                             Use LZMA
libxml2[zlib]:x64-windows                                             Use ZLib
pugixml:x64-windows                               1.13.0              Light-weight, simple and fast XML parser for C++...

Because of my packages' dependency contraints, I decided to backup my original vcpkg folder and replace it with a blank one.

(base) PS C:\Users\Yaner> vcpkg remove libxml2:x64-windows
The following packages will be removed:
  * libarchive:x64-windows
    libxml2:x64-windows
  * opencv:x64-windows
  * opencv4:x64-windows
  * tesseract:x64-windows
  * vtk:x64-windows
(base) PS C:\Users\Yaner> vcpkg.exe list
No packages are installed. Did you mean `search`?

(base) PS C:\Users\Yaner> vcpkg.exe install gettext:x64-windows
......
-- Installing: C:/lib/vcpkg/packages/gettext_x64-windows/tools/gettext/bin/autopoint
-- Installing: C:/lib/vcpkg/packages/gettext_x64-windows/share/gettext/gettext/archive.dir.tar.gz
-- Performing post-build validation
Elapsed time to handle gettext:x64-windows: 12.97 min
Total install time: 13.03 min
......

It literally worked! But Why? It seems that they conflict with each other.

dg0yt commented 1 year ago

The build log showed that it is stumbling over linking lib xml2. But it shouldn't use the external lib.

I'm currently experimenting with the gettext port (build time! #30429) and caching it is configuration. I know that it could use external or internal libxml2. But in vcpkg, it shouldn't use external dependencies unless we can ensure that there are no boostrapping cycles. Maybe I can take a second look at the xml2 dependency. gettext has at least two types of components, with different bootstrapping requirements.

yaner-here commented 1 year ago

@dg0yt Thanks for your amazing work in maintaining vcpkg! Look forward to the issue being fixed soon.

dg0yt commented 1 year ago

You can leave this open until it is actually fixed.

dg0yt commented 1 year ago

Waiting for #29067, then #30429.