microsoft / vcpkg

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

[fontconfig] nuget packaging failed #17557

Open cenit opened 3 years ago

cenit commented 3 years ago

Describe the bug Unable to package fontconfig as nupkg. Might be due to links from etc subfolder to share subfolder inside packages/fontconfig

Environment Log is for linux, but it happens also on windows

To Reproduce Steps to reproduce the behavior:

  1. define a nuget binary cache
  2. ./vcpkg install fontconfig
  3. See error

Expected behavior nuget package to be created

Failure logs

Starting package 1/1: fontconfig:x64-linux
Building package fontconfig[core]:x64-linux...
[DEBUG] popen(/mnt/src/vcpkg/downloads/tools/cmake-3.19.2-linux/cmake-3.19.2-Linux-x86_64/bin/cmake -DALL_FEATURES= -DCURRENT_PORT_DIR=/mnt/src/vcpkg/ports/fontconfig -D_HOST_TRIPLET=x64-linux -DFEATURES=core -DPORT=fontconfig -DVCPKG_USE_HEAD_VERSION=0 -D_VCPKG_DOWNLOAD_TOOL=BUILT_IN -D_VCPKG_EDITABLE=0 -D_VCPKG_NO_DOWNLOADS=0 -DCMD=BUILD -DDOWNLOADS=/mnt/src/vcpkg/downloads -DTARGET_TRIPLET=x64-linux -DTARGET_TRIPLET_FILE=/mnt/src/vcpkg/triplets/x64-linux.cmake -DVCPKG_BASE_VERSION=2021-01-13 -DVCPKG_CONCURRENCY=9 -DVCPKG_PLATFORM_TOOLSET=external -DGIT=/opt/git/git-2.28.0/bin/git -DVCPKG_ROOT_DIR=/mnt/src/vcpkg -DPACKAGES_DIR=/mnt/src/vcpkg/packages -DBUILDTREES_DIR=/mnt/src/vcpkg/buildtrees -D_VCPKG_INSTALLED_DIR=/mnt/src/vcpkg/installed -DDOWNLOADS=/mnt/src/vcpkg/downloads -DVCPKG_MANIFEST_INSTALL=OFF -P /mnt/src/vcpkg/scripts/ports.cmake 2>&1)
-- Using cached /mnt/src/vcpkg/downloads/fontconfig-fontconfig-844d8709a1f3ecab45015b24b72dd775c13b2421.tar.gz
-- Extracting source /mnt/src/vcpkg/downloads/fontconfig-fontconfig-844d8709a1f3ecab45015b24b72dd775c13b2421.tar.gz
-- Applying patch remove_tests.patch
-- Applying patch build.patch
-- Applying patch build2.patch
-- Applying patch disable-install-data.patch
-- Applying patch macos_arm_fccache.patch
-- Using source at /mnt/src/vcpkg/buildtrees/fontconfig/src/75c13b2421-4e035459fe.clean
-- Configuring x64-linux-dbg
-- Configuring x64-linux-rel
-- Generating configure for x64-linux
-- Finished generating configure for x64-linux
-- Configuring x64-linux-dbg
-- Configuring x64-linux-rel
-- Building x64-linux-dbg
-- Installing x64-linux-dbg
-- Building x64-linux-rel
-- Installing x64-linux-rel
-- Fixing pkgconfig file: /mnt/src/vcpkg/packages/fontconfig_x64-linux/lib/pkgconfig/fontconfig.pc
-- Fixing pkgconfig file: /mnt/src/vcpkg/packages/fontconfig_x64-linux/debug/lib/pkgconfig/fontconfig.pc
-- Installing: /mnt/src/vcpkg/packages/fontconfig_x64-linux/share/fontconfig/copyright
[DEBUG] cmd_execute_and_stream_data() returned 0 after 106059085 us
-- Performing post-build validation
-- Performing post-build validation done
[DEBUG] popen(/usr/bin/mono /mnt/src/vcpkg/downloads/tools/nuget-5.5.1-linux/nuget.exe pack /mnt/src/vcpkg/buildtrees/fontconfig/x64-linux.nuspec -OutputDirectory /mnt/src/vcpkg/buildtrees -NoDefaultExcludes -ForceEnglishOutput -NonInteractive 2>&1)
[DEBUG] cmd_execute_and_stream_data() returned 256 after  1399040 us
Attempting to build package from 'x64-linux.nuspec'.
Could not find file "/mnt/src/vcpkg/packages/fontconfig_x64-linux/etc/fonts/conf.d/10-hinting-slight.conf"
Packing NuGet failed. Use --debug for more information.
Building package fontconfig[core]:x64-linux... done
Installing package fontconfig[core]:x64-linux...
Installing package fontconfig[core]:x64-linux... done
Elapsed time for package fontconfig:x64-linux: 1.794 min

Total elapsed time: 1.855 min
cenit commented 3 years ago

the biggest hint might be

Could not find file "/mnt/src/vcpkg/packages/fontconfig_x64-linux/etc/fonts/conf.d/10-hinting-slight.conf"

NancyLi1013 commented 3 years ago

Might be related with this issue from upstream? https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/274

JackBoosY commented 3 years ago

cc @Neumann-A

Neumann-A commented 3 years ago

Looks to me like a vcpkg-tool issue instead of a port issue. Maybe the binary cache is not handling symlinks correctly?

ASxa86 commented 3 years ago

We ran into this issue ourselves and had to put a workaround within the portfile to hard copy and replace the symlinks that were being generated.

Neumann-A commented 3 years ago

add

 if(NOT VCPKG_TARGET_IS_WINDOWS)
    list(APPEND OPTIONS "as_ln_s=ln -sr")
 endif()

to the portfile before vcpkg_configure_make and it should/will work.

cenit commented 3 years ago

thanks!! and on windows? any idea, since you did a lot of debug of this problem?

Neumann-A commented 3 years ago

and on windows? any idea, since you did a lot of debug of this problem?

I don't now what happens on windows. If i run vcpkg export <port> --nuget on it it runs fine. I have seen some issues in other ports like boost as well which seems to be not getting exported into the binary cache while running vcpkg export <port> --nuget doesn't yield an error.

Neumann-A commented 3 years ago

Ah maybe bumping nuget to 5.9.1 can help?

cenit commented 3 years ago

Ah maybe bumping nuget to 5.9.1 can help?

I will try updating nuget. I experienced similar error on linux and windows for fontconfig when exporting to nuget, so I need to fix it on both OS

Neumann-A commented 3 years ago

I have currently the following error:

  1. set an api key for nuget.
  2. 2021-06-14T15:28:21.4657457Z Pushing boost-build_x64-windows-llvm-release.1.75.0-vcpkg233247ad8deb84242f16b63ba987d3644f5bd092.nupkg to 'https://nuget.pkg.github.com/Neumann-A'...
    2021-06-14T15:28:21.4659424Z 
    2021-06-14T15:28:21.4660064Z   PUT https://nuget.pkg.github.com/Neumann-A/
    2021-06-14T15:28:21.4660601Z 
    2021-06-14T15:28:21.4661405Z WARNING: Package "boost-build_x64-windows-llvm-release" is already associated with another repository.
    2021-06-14T15:28:21.4662099Z 
    2021-06-14T15:28:21.4662732Z   422 https://nuget.pkg.github.com/Neumann-A/ 428ms
    2021-06-14T15:28:21.4663265Z 
    2021-06-14T15:28:21.4663862Z Response status code does not indicate success: 422 (Unprocessable Entity).
    2021-06-14T15:28:21.4664364Z 
    2021-06-14T15:28:21.4664908Z Pushing NuGet to GitHub failed. Use --debug for more information.
m-kuhn commented 3 years ago

add

 if(NOT VCPKG_TARGET_IS_WINDOWS)
    list(APPEND OPTIONS "as_ln_s=ln -sr")
 endif()

to the portfile before vcpkg_configure_make and it should/will work.

For reference, this is not compatible with macos

ln: illegal option -- r
usage: ln [-Ffhinsv] source_file [target_file]
       ln [-Ffhinsv] source_file ... target_dir
       link source_file target_file