Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libmamba 2.0.6 fails to build on Fedora rawhide on i686 #3797

Open
3 tasks done
opoplawski opened this issue Feb 5, 2025 · 3 comments
Open
3 tasks done

libmamba 2.0.6 fails to build on Fedora rawhide on i686 #3797

opoplawski opened this issue Feb 5, 2025 · 3 comments

Comments

@opoplawski
Copy link
Contributor

Troubleshooting docs

  • My problem is not solved in the Troubleshooting docs

Anaconda default channels

  • I do NOT use the Anaconda default channels (pkgs/* etc.)

How did you install Mamba?

Other (please describe)

Search tried in issue tracker

useless cast

Latest version of Mamba

  • My problem is not solved with the latest version

Tried in Conda?

Not applicable

Describe your issue

Trying to build libmamba 2.0.6 on Fedora Rawhide i686 with gcc 15 I'm getting:

cd /builddir/build/BUILD/libmamba-2.0.6-build/mamba-2.0.6/redhat-linux-build/libmamba/ext/solv-cpp && /usr/bin/g++  -I/builddir/build/BUILD/libmamba-2.0.6-build/mamba-2.0.6/libmamba/ext/solv-cpp/include -isystem /usr/share -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m32 -march=i686 -mtune=generic -msse2 -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables -fstack-clash-protection -O2 -g -DNDEBUG -fPIC -Wall -Wextra -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual -Wpedantic -Wconversion -Wsign-conversion -Wnull-dereference -Wdouble-promotion -Wformat=2 -Wunreachable-code -Wuninitialized -Werror -Wmisleading-indentation -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wuseless-cast -MD -MT libmamba/ext/solv-cpp/CMakeFiles/solv-cpp.dir/src/solvable.cpp.o -MF CMakeFiles/solv-cpp.dir/src/solvable.cpp.o.d -o CMakeFiles/solv-cpp.dir/src/solvable.cpp.o -c /builddir/build/BUILD/libmamba-2.0.6-build/mamba-2.0.6/libmamba/ext/solv-cpp/src/solvable.cpp

/builddir/build/BUILD/libmamba-2.0.6-build/mamba-2.0.6/libmamba/ext/solv-cpp/src/solvable.cpp: In function ‘auto solv::{anonymous}::solvable_add_pool_str(Pool*, std::string_view)’:
/builddir/build/BUILD/libmamba-2.0.6-build/mamba-2.0.6/libmamba/ext/solv-cpp/src/solvable.cpp:89:17: error: useless cast to type ‘unsigned int’ [-Werror=useless-cast]
   89 |                 static_cast<unsigned int>(value.size()),
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/libmamba-2.0.6-build/mamba-2.0.6/libmamba/ext/solv-cpp/src/solvable.cpp: In member function ‘std::size_t solv::ObjSolvableViewConst::size() const’:
/builddir/build/BUILD/libmamba-2.0.6-build/mamba-2.0.6/libmamba/ext/solv-cpp/src/solvable.cpp:306:37: error: conversion from ‘long long unsigned int’ to ‘std::size_t’ {aka ‘unsigned int’} may change value [-Werror=conversion]
  306 |         return ::solvable_lookup_num(const_cast<::Solvable*>(raw()), SOLVABLE_DOWNLOADSIZE, 0);
      |                ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/libmamba-2.0.6-build/mamba-2.0.6/libmamba/ext/solv-cpp/src/solvable.cpp: In member function ‘std::size_t solv::ObjSolvableViewConst::timestamp() const’:
/builddir/build/BUILD/libmamba-2.0.6-build/mamba-2.0.6/libmamba/ext/solv-cpp/src/solvable.cpp:316:37: error: conversion from ‘long long unsigned int’ to ‘std::size_t’ {aka ‘unsigned int’} may change value [-Werror=conversion]
  316 |         return ::solvable_lookup_num(const_cast<::Solvable*>(raw()), SOLVABLE_BUILDTIME, 0);
      |                ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/libmamba-2.0.6-build/mamba-2.0.6/libmamba/ext/solv-cpp/src/repo.cpp: In function ‘std::size_t solv::{anonymous}::repo_lookup_num(const Repo*, Id)’:
/builddir/build/BUILD/libmamba-2.0.6-build/mamba-2.0.6/libmamba/ext/solv-cpp/src/repo.cpp:227:37: error: conversion from ‘long long unsigned int’ to ‘std::size_t’ {aka ‘unsigned int’} may change value [-Werror=conversion]
  227 |             return ::repo_lookup_num(const_cast<::Repo*>(repo), SOLVID_META, key, 0);
      |                    ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/libmamba-2.0.6-build/mamba-2.0.6/libmamba/ext/solv-cpp/src/pool.cpp: In member function ‘std::optional<int> solv::ObjPoolView::find_string(std::string_view) const’:
/builddir/build/BUILD/libmamba-2.0.6-build/mamba-2.0.6/libmamba/ext/solv-cpp/src/pool.cpp:74:13: error: useless cast to type ‘unsigned int’ [-Werror=useless-cast]
   74 |             static_cast<unsigned int>(str.size()),
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/libmamba-2.0.6-build/mamba-2.0.6/libmamba/ext/solv-cpp/src/pool.cpp: In member function ‘solv::StringId solv::ObjPoolView::add_string(std::string_view)’:
/builddir/build/BUILD/libmamba-2.0.6-build/mamba-2.0.6/libmamba/ext/solv-cpp/src/pool.cpp:87:13: error: useless cast to type ‘unsigned int’ [-Werror=useless-cast]
   87 |             static_cast<unsigned int>(str.size()),
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
gmake[2]: *** [libmamba/ext/solv-cpp/CMakeFiles/solv-cpp.dir/build.make:124: libmamba/ext/solv-cpp/CMakeFiles/solv-cpp.dir/src/solvable.cpp.o] Error 1

mamba info / micromamba info

Logs

environment.yml

~/.condarc

@LecrisUT
Copy link

LecrisUT commented Feb 5, 2025

Just to chime in since I remember a related issue on the Fedora mail-list where gcc(-15?) does not comply correctly with the C++ standard. The issue then was that <version> is meant to be a C++20 feature replacing <ciso646>, but the deprecation message is issued even as the project sets C++17 compatibility flags.

Overall the issue is with

mamba/CMakeLists.txt

Lines 22 to 26 in 27010d1

if(MSVC)
option(MAMBA_WARNING_AS_ERROR "Treat compiler warnings as errors" OFF)
else()
option(MAMBA_WARNING_AS_ERROR "Treat compiler warnings as errors" ON)
endif()

Which I would insist not to make it default ON, ever! Instead this should only be set in the upstream development.


But somehow related to the options parsing

mamba/CMakeLists.txt

Lines 68 to 70 in 27010d1

if(BUILD_MAMBA)
set(BUILD_SHARED ON)
endif()

Resetting a cache variable to a local variable is strongly discouraged. Particularly for packagers who would then have to review every such settings. Instead please use cmake_dependent_options

@JohanMabille
Copy link
Member

Which I would insist not to make it default ON, ever! Instead this should only be set in the upstream development.

I agree, this should be off by default.

Resetting a cache variable to a local variable is strongly discouraged. Particularly for packagers who would then have to review every such settings. Instead please use cmake_dependent_options

Correct me if I'm wrong, but cmake_dependent_options forces the option value if the condition is not met; here, we need to keep the BUILD_SHARED option available, whatever the value of BULD_MAMBA.

@LecrisUT
Copy link

Correct me if I'm wrong, but cmake_dependent_options forces the option value if the condition is not met; here, we need to keep the BUILD_SHARED option available, whatever the value of BULD_MAMBA.

You are right, but you are already doing that with the use of set. However, the issue with using set is that it is a burden to navigate and find how the options are modified, on top of not being visible in the CMakeCache.txt. Using cmake_dependent_options makes it more navigable because it's in one spot where it is defined.

If you want to make it configurable though, just calculate an appropriate default and feed it into options. You use cmake_dependent_options to explicitly signal that a combination of options is not supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants