zlib-ng / minizip-ng

Fork of the popular zip manipulation library found in the zlib distribution.
Other
1.22k stars 428 forks source link

Support system copy of gtest #654

Closed thesamesam closed 1 year ago

thesamesam commented 1 year ago

Please consider reworking d03ca72a2520d7ba55e8763d14aa0d70b960ba84 to allow using a system copy of gtest. Many package managers prohibit network access during the build.

While it may be possible to pre-download a copy and shove into the build dir, it's still a waste of resources and awkward to maintain.

Thanks!

nmoinvaz commented 1 year ago

It supports that already. If you have a parent project and already include Gtest then it will detect it.

thesamesam commented 1 year ago

I don't think that helps when gtest is just installed on the system though and building minizip-ng by itself (i.e. no parent project). It least it doesn't for me, and other CMake packages pick it up fine.

I don't think the target test will ever pass as we're not doing find_package (or anything else) for it.

e.g.

>>> Unpacking source...
>>> Unpacking minizip-ng-3.0.7.tar.gz to /var/tmp/portage/sys-libs/minizip-ng-3.0.7/work
>>> Source unpacked in /var/tmp/portage/sys-libs/minizip-ng-3.0.7/work
>>> Preparing source in /var/tmp/portage/sys-libs/minizip-ng-3.0.7/work/minizip-ng-3.0.7 ...
 * Source directory (CMAKE_USE_DIR): "/var/tmp/portage/sys-libs/minizip-ng-3.0.7/work/minizip-ng-3.0.7"
 * Build directory  (BUILD_DIR):     "/var/tmp/portage/sys-libs/minizip-ng-3.0.7/work/minizip-ng-3.0.7_build"
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/sys-libs/minizip-ng-3.0.7/work/minizip-ng-3.0.7 ...
 * Source directory (CMAKE_USE_DIR): "/var/tmp/portage/sys-libs/minizip-ng-3.0.7/work/minizip-ng-3.0.7"
 * Build directory  (BUILD_DIR):     "/var/tmp/portage/sys-libs/minizip-ng-3.0.7/work/minizip-ng-3.0.7_build"
cmake -C /var/tmp/portage/sys-libs/minizip-ng-3.0.7/work/minizip-ng-3.0.7_build/gentoo_common_config.cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -DMZ_COMPAT=no -DMZ_BUILD_TESTS=yes -DMZ_BUILD_UNIT_TESTS=yes -DMZ_FETCH_LIBS=OFF -DMZ_FORCE_FETCH_LIBS=OFF -DMZ_ZLIB=ON -DMZ_BZIP2=ON -DMZ_LZMA=ON -DMZ_ZSTD=no -DMZ_LIBCOMP=OFF -DMZ_PKCRYPT=ON -DMZ_WZAES=ON -DMZ_OPENSSL=no -DMZ_LIBBSD=ON -DMZ_SIGNING=ON -DMZ_ICONV=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE=/var/tmp/portage/sys-libs/minizip-ng-3.0.7/work/minizip-ng-3.0.7_build/gentoo_toolchain.cmake /var/tmp/portage/sys-libs/minizip-ng-3.0.7/work/minizip-ng-3.0.7
loading initial cache file /var/tmp/portage/sys-libs/minizip-ng-3.0.7/work/minizip-ng-3.0.7_build/gentoo_common_config.cmake
-- Using CMake version 3.24.2
-- The C compiler identification is GNU 12.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/lib/ccache/bin/x86_64-pc-linux-gnu-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for inttypes.h
-- Looking for inttypes.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of off64_t
-- Check size of off64_t - failed
-- Looking for fseeko
-- Looking for fseeko - found
-- Using ZLIB 1.2.13
-- Using BZIP2 1.0.8
-- Checking for module 'liblzma'
--   Found liblzma, version 5.3.3alpha
-- Using LZMA 5.3.3alpha
-- WinZIP AES support requires OpenSSL
-- Signing support requires OpenSSL
-- Looking for getrandom
-- Looking for getrandom - found
-- Looking for arc4random_buf
-- Looking for arc4random_buf - found
-- Performing Test Iconv_IS_BUILT_IN
-- Performing Test Iconv_IS_BUILT_IN - Success
-- Using Iconv
-- Project configured as minizip-ng
-- The CXX compiler identification is GNU 12.2.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/lib/ccache/bin/x86_64-pc-linux-gnu-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
[1/9] Creating directories for 'googletest-populate'
[1/9] Performing download step (git clone) for 'googletest-populate'
Cloning into 'googletest-src'...
fatal: unable to access 'https://github.com/google/googletest.git/': Could not resolve host: github.com
Cloning into 'googletest-src'...
fatal: unable to access 'https://github.com/google/googletest.git/': Could not resolve host: github.com
Cloning into 'googletest-src'...
fatal: unable to access 'https://github.com/google/googletest.git/': Could not resolve host: github.com
-- Had to git clone more than once: 3 times.
CMake Error at googletest-subbuild/googletest-populate-prefix/tmp/googletest-populate-gitclone.cmake:39 (message):
  Failed to clone repository: 'https://github.com/google/googletest.git'

FAILED: googletest-populate-prefix/src/googletest-populate-stamp/googletest-populate-download /var/tmp/portage/sys-libs/minizip-ng-3.0.7/work/minizip-ng-3.0.7_build/_deps/googletest-subbuild/googletest-populate-prefix/src/googletest-populate-stamp/googletest-populate-download
cd /var/tmp/portage/sys-libs/minizip-ng-3.0.7/work/minizip-ng-3.0.7_build/_deps && /usr/bin/cmake -P /var/tmp/portage/sys-libs/minizip-ng-3.0.7/work/minizip-ng-3.0.7_build/_deps/googletest-subbuild/googletest-populate-prefix/tmp/googletest-populate-gitclone.cmake && /usr/bin/cmake -E touch /var/tmp/portage/sys-libs/minizip-ng-3.0.7/work/minizip-ng-3.0.7_build/_deps/googletest-subbuild/googletest-populate-prefix/src/googletest-populate-stamp/googletest-populate-download
ninja: build stopped: subcommand failed.

CMake Error at /usr/share/cmake/Modules/FetchContent.cmake:1604 (message):
  Build step for googletest failed: 1
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FetchContent.cmake:1744:EVAL:2 (__FetchContent_directPopulate)
  /usr/share/cmake/Modules/FetchContent.cmake:1744 (cmake_language)
  test/CMakeLists.txt:36 (FetchContent_Populate)

-- Configuring incomplete, errors occurred!
See also "/var/tmp/portage/sys-libs/minizip-ng-3.0.7/work/minizip-ng-3.0.7_build/CMakeFiles/CMakeOutput.log".
See also "/var/tmp/portage/sys-libs/minizip-ng-3.0.7/work/minizip-ng-3.0.7_build/CMakeFiles/CMakeError.log".
 * ERROR: sys-libs/minizip-ng-3.0.7::gentoo failed (configure phase):
 *   cmake failed
 *
 * Call stack:
 *     ebuild.sh, line  122:  Called src_configure
 *   environment, line 2351:  Called cmake_src_configure
 *   environment, line 1091:  Called die
 * The specific snippet of code:
 *       "${CMAKE_BINARY}" "${cmakeargs[@]}" "${CMAKE_USE_DIR}" || die "cmake failed";
 *
 * If you need support, post the output of `emerge --info '=sys-libs/minizip-ng-3.0.7::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=sys-libs/minizip-ng-3.0.7::gentoo'`.
 * The complete build log is located at '/var/log/portage/build/sys-libs/minizip-ng-3.0.7:20221017-033658.log'.
 * For convenience, a symlink to the build log is located at '/var/tmp/portage/sys-libs/minizip-ng-3.0.7/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/sys-libs/minizip-ng-3.0.7/temp/environment'.
 * Working directory: '/var/tmp/portage/sys-libs/minizip-ng-3.0.7/work/minizip-ng-3.0.7_build'
 * S: '/var/tmp/portage/sys-libs/minizip-ng-3.0.7/work/minizip-ng-3.0.7'
nmoinvaz commented 1 year ago

Good idea. I am open to PRs.

nmoinvaz commented 1 year ago

Thanks for the fix.

thesamesam commented 1 year ago

No worries!