Coder Social home page Coder Social logo

Comments (15)

hackernoodle avatar hackernoodle commented on September 26, 2024 1

might be that a simple sed -i '/utils_test/d' CMakeLists.txt makes the most sense in the context of the RPM spec, not sure but it's what I'll go with for now.

from dwarfs.

nh2 avatar nh2 commented on September 26, 2024 1

I've got an idea. Here's the code from googletest that the linker complains about:

Thanks for this, these explanations made it much easier to package the current version of dwarfs in nixpkgs.

from dwarfs.

hackernoodle avatar hackernoodle commented on September 26, 2024

the specfile:

Name:           dwarfs
Version:        0.8.0
Release:        1%{?dist}
Summary:        A fast high compression read-only file system

License:        GPLv3
URL:            https://github.com/mhx/%{name}
Source0:        https://github.com/mhx/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.xz

Requires: boost-chrono
Requires: boost-iostreams
Requires: boost-program-options
Requires: bzip2-libs
Requires: double-conversion
Requires: fmt
Requires: gflags
Requires: glog
Requires: jemalloc
Requires: libacl
Requires: libarchive
Requires: libattr
Requires: libbrotli
Requires: libstdc++
Requires: libunwind
Requires: libxml2
Requires: libzstd
Requires: lz4-libs
Requires: openssl-libs
Requires: xxhash-libs
Requires: xz-libs
Requires: zlib

BuildRequires: binutils-devel
BuildRequires: bison
BuildRequires: boost-chrono
BuildRequires: boost-context
BuildRequires: boost-devel
BuildRequires: boost-filesystem
BuildRequires: boost-iostreams
BuildRequires: boost-program-options
BuildRequires: boost-regex
BuildRequires: boost-system
BuildRequires: boost-thread
BuildRequires: brotli-devel
BuildRequires: ccache
BuildRequires: clang
BuildRequires: cmake
BuildRequires: date-devel
BuildRequires: double-conversion-devel
BuildRequires: elfutils-devel
BuildRequires: file-devel
BuildRequires: flac-devel
BuildRequires: flex
BuildRequires: fmt-devel
BuildRequires: fuse3
BuildRequires: fuse3-devel
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: git
BuildRequires: glog-devel
BuildRequires: gmock-devel
BuildRequires: google-benchmark-devel
BuildRequires: gtest-devel 
BuildRequires: jemalloc-devel
BuildRequires: libacl-devel
BuildRequires: libarchive-devel
BuildRequires: libdwarf-devel
BuildRequires: libevent-devel
BuildRequires: libunwind-devel
BuildRequires: lz4-devel
BuildRequires: make
BuildRequires: ninja-build
BuildRequires: openssl-devel
BuildRequires: pkgconf
BuildRequires: rubygem-ronn-ng
BuildRequires: utf8cpp-devel
BuildRequires: xxhash-devel
BuildRequires: xz-devel

%description
DwarFS is a read-only file system with a focus on achieving very high compression ratios in particular for very redundant data.

%prep
%autosetup

%build
%cmake -DBUILD_SHARED_LIBS=OFF \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DWITH_TESTS=ON \
-DPREFER_SYSTEM_GTEST=ON \
-DPREFER_SYSTEM_LIBFMT=ON \
-DPREFER_SYSTEM_XXHASH=ON \
-DPREFER_SYSTEM_ZSTD=ON \
-DWITH_MAN_OPTION=OFF
%cmake_build

%check
%ctest

%install
%cmake_install

%files
%license LICENSE
%{_bindir}/dwarfsbench
%{_bindir}/dwarfsck
%{_bindir}/dwarfsextract
%{_bindir}/mkdwarfs
%{_sbindir}/dwarfs
%{_sbindir}/mount.dwarfs
%doc %{_mandir}/man1/dwarfs.1.gz
%doc %{_mandir}/man1/dwarfsck.1.gz
%doc %{_mandir}/man1/dwarfsextract.1.gz
%doc %{_mandir}/man1/mkdwarfs.1.gz
%doc %{_mandir}/man5/dwarfs-format.5.gz

%changelog
* Fri Jan 12 2024 silentnoodle - 0.7.4-1
- rewritten spec

from dwarfs.

mhx avatar mhx commented on September 26, 2024

You're not using PREFER_SYSTEM_GTEST by any chance? Looks like it has a problem finding the right symbols in the gtest library.

from dwarfs.

hackernoodle avatar hackernoodle commented on September 26, 2024

I am using PREFER_SYSTEM_GTEST yes

from dwarfs.

mhx avatar mhx commented on September 26, 2024

Did you try without? Maybe the system version is too old or otherwise broken.

from dwarfs.

hackernoodle avatar hackernoodle commented on September 26, 2024

It works without. The version of system gtest is 1.14.0 and it worked for dwarfs 0.7.5 and 0.7.4

from dwarfs.

mhx avatar mhx commented on September 26, 2024

I've got an idea. Here's the code from googletest that the linker complains about:

#ifdef __cpp_lib_char8_t
void PrintU8StringTo(const ::std::u8string& s, ostream* os) {
  PrintCharsAsStringTo(s.data(), s.size(), os);
}
#endif

I reckon the system-installed version of googletest is built using an older C++ standard and the compiler isn't defining __cpp_lib_char8_t.

This worked with 0.7.5 / 0.7.4 simply because there's a lot more tests in 0.8.0. :)

from dwarfs.

mhx avatar mhx commented on September 26, 2024

BTW, Google itself recommends that projects include gtest rather than using a system-installed version. Since this is only a build-time dependency, it doesn't matter at all for the build artifacts, which don't even link against gtest.

You can get into all sorts of issues when linking code produced with different -std= flags if you're not extremely careful.

from dwarfs.

hackernoodle avatar hackernoodle commented on September 26, 2024

It's not a hard requirement but it would be preferable to be able to run the build offline, do you have any recommendations?

from dwarfs.

mhx avatar mhx commented on September 26, 2024

I actually do, because I occasionally work offline as well and have added a thing to the CMakeLists.txt for that:

if(DEFINED ENV{DWARFS_LOCAL_REPO_PATH})
  set(LIBFMT_GIT_REPO $ENV{DWARFS_LOCAL_REPO_PATH}/fmt)
  set(GOOGLETEST_GIT_REPO $ENV{DWARFS_LOCAL_REPO_PATH}/googletest)
else()
  set(LIBFMT_GIT_REPO https://github.com/fmtlib/fmt.git)
  set(GOOGLETEST_GIT_REPO https://github.com/google/googletest.git)
endif()

So you could set DWARFS_LOCAL_REPO_PATH to a local directory with clones of the fmt and googletest repos. It works fine for my development needs, but I'd be reluctant to add it to a packaging definition.

I could ship a copy of gtest in the dwarfs tarball, but then again, it's rather big already.

I reckon the system-installed version of googletest is built using an older C++ standard and the compiler isn't defining __cpp_lib_char8_t.

I just had a look at the gtest CMakeLists.txt, and it doesn't explicitly define a C++ standard, which means it'll use the compiler's default, which is currently C++17 (or even older, depending on the compiler version). C++17 indeed doesn't define __cpp_lib_char8_t, so that why it doesn't work with the system-installed gtest.

As a last resort, you could patch utils_test out of the CMakeLists.txt, I believe that's the only test dealing with UTF8-strings.

from dwarfs.

hackernoodle avatar hackernoodle commented on September 26, 2024

I could add the googletest tarball as an additional source, but would fmt also need to not be the system installed version for DWARFS_LOCAL_REPO_PATH to ve usable?

from dwarfs.

mhx avatar mhx commented on September 26, 2024

If you set PREFER_SYSTEM_LIBFMT, you don't need fmt to be present. Keep in mind that you'd need to tarball the git repo of gtest for this to work.

from dwarfs.

mhx avatar mhx commented on September 26, 2024

might be that a simple sed -i '/utils_test/d' CMakeLists.txt makes the most sense in the context of the RPM spec, not sure but it's what I'll go with for now.

Definitely makes sense. These tests are primarily to make sure the code doesn't break when it's being worked on. If you're still running the remainder of the tests that's going to be good enough.

from dwarfs.

mhx avatar mhx commented on September 26, 2024

I'll close this as there isn't really much that can trivially be done here. The best option is really not to use the system installed gtest.

from dwarfs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.