On 2026/10/22 07:39, Thomas Dettbarn wrote:
> Good morning!
> 
> Please find the updated port attached to this email.
> 
> In it, I did two things:
> 
> 1. I patched away the extra -O3 Flags.
> 
> 2. I patched in a missing infix operator to their fallback uint128 class.

Thanks - it didn't help but I remember where I've seen this before now, in 
mariadb.
There is an upstream commit in the fmtlib repo, I'll just pick that one.

> 
> Regarding 2: Congratulations @stu! It looks as if you were able to
> trigger an obscure old bug, brought on by code rod! :) Everyone
> else was compiling fmt using uint128_t, but on machines/compilers
> where it was not available, they used their own class uint128. And
> within it, they forgot to overload the ~ operator they needed.
> 
> ItBuildsOnMyMachine(tm), but I was not able to trigger the problem
> on my amd64. @stu Could you try running it on i386 again, please?
> It is a problem which is worth being reported&fixed upstream!
> 
> 
> Thomas
> 
> 
> 
> On 10/21/26 09:44, Stuart Henderson wrote:
> > build fails on i386 (looks like it's in a bundled copy of fmt),
> > also it ignores ports infrastructure and uses -O3 which it
> > shouldn't do:
> > 
> > FAILED: _deps/fmt-build/CMakeFiles/fmt.dir/src/format.cc.o
> > /pobj/yosys-0.70/bin/c++  -I/pobj/yosys-0.70/yosys-0.70/libs/fmt/include 
> > -O2 -pipe -O3 -std=gnu++20 -fPIC -Wall -Wextra -Werror=unused-variable 
> > -Werror=unused-parameter -Werror=unused-function -MD -MT 
> > _deps/fmt-build/CMakeFiles/fmt.dir/src/format.cc.o -MF 
> > _deps/fmt-build/CMakeFiles/fmt.dir/src/format.cc.o.d -o 
> > _deps/fmt-build/CMakeFiles/fmt.dir/src/format.cc.o -c 
> > /pobj/yosys-0.70/yosys-0.70/libs/fmt/src/format.cc
> > In file included from /pobj/yosys-0.70/yosys-0.70/libs/fmt/src/format.cc:8:
> > In file included from 
> > /pobj/yosys-0.70/yosys-0.70/libs/fmt/include/fmt/format-inl.h:28:
> > /pobj/yosys-0.70/yosys-0.70/libs/fmt/include/fmt/format.h:3108:14: error: 
> > invalid argument type 'uint128' to unary expression
> > 3108 |       f.f &= ~(inc - 1);
> >       |              ^~~~~~~~~~

> diff --git a/cad/yosys/Makefile b/cad/yosys/Makefile
> index 01cb046c8c5..4ef82722727 100644
> --- a/cad/yosys/Makefile
> +++ b/cad/yosys/Makefile
> @@ -2,6 +2,7 @@ COMMENT=      Yosys Open SYnthesis Suite
>  CATEGORIES=  cad
>  V=           0.70
>  DISTNAME=    yosys-${V}
> +REVISION=    1
>  
>  GH_ACCOUNT=  YosysHQ
>  GH_PROJECT=  yosys
> @@ -33,7 +34,8 @@ LIB_DEPENDS=        devel/libffi
>  BUILD_DEPENDS=       devel/bison \
>               devel/gtest
>  
> -CONFIGURE_ARGS= -DYOSYS_WITHOUT_SLANG=On
> +CONFIGURE_ARGS= -DYOSYS_WITHOUT_SLANG=ON \
> +             -DYOSYS_USE_BUNDLED_LIBS=ON
>  CXX_FLAGS += -DFMT_DEPRECATED_HEAVY_CORE
>  
>  do-test:
> diff --git a/cad/yosys/patches/patch-CMakeLists_txt 
> b/cad/yosys/patches/patch-CMakeLists_txt
> index c864c21b093..8e6c26dede2 100644
> --- a/cad/yosys/patches/patch-CMakeLists_txt
> +++ b/cad/yosys/patches/patch-CMakeLists_txt
> @@ -1,7 +1,29 @@
>  Relax the requirment for the latest flex version.
> +Remove the magic compiler flags.
> +Index: CMakeLists.txt
>  --- CMakeLists.txt.orig
>  +++ CMakeLists.txt
> -@@ -174,7 +174,7 @@ if (APPLE)
> +@@ -98,13 +98,13 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
> + check_pie_supported() # opportunistically enable PIE
> + 
> + if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
> +-    set(CMAKE_CXX_FLAGS_DEBUG "-Og -ggdb")
> +-    set(CMAKE_CXX_FLAGS_RELEASE "-O3")
> +-    set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -ggdb")
> +-    set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os")
> +-    set(CMAKE_CXX_FLAGS_SANITIZE "-O1 -fno-omit-frame-pointer 
> -fno-optimize-sibling-calls")
> ++    set(CMAKE_CXX_FLAGS_DEBUG "")
> ++    set(CMAKE_CXX_FLAGS_RELEASE "")
> ++    set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "")
> ++    set(CMAKE_CXX_FLAGS_MINSIZEREL "")
> ++    set(CMAKE_CXX_FLAGS_SANITIZE "")
> +     if ("${SANITIZE}" MATCHES "memory")
> +-            set(CMAKE_CXX_FLAGS_SANITIZE "${CMAKE_CXX_FLAGS_SANITIZE} 
> -fsanitize-memory-track-origins")
> ++            set(CMAKE_CXX_FLAGS_SANITIZE "")
> +     endif()
> +     set(no_abc_options
> +             
> "$<$<AND:$<NOT:$<BOOL:$<TARGET_PROPERTY:YOSYS_IS_ABC>>>,$<CONFIG:Sanitize>>:-fsanitize=${SANITIZE}>"
> +@@ -181,7 +181,7 @@ if (APPLE AND (NOT DEFINED YOSYS_ENABLE_HOMEBREW OR YO
>       use_homebrew()
>   endif()
>   
> diff --git a/cad/yosys/patches/patch-libs_fmt_include_fmt_format_h 
> b/cad/yosys/patches/patch-libs_fmt_include_fmt_format_h
> new file mode 100644
> index 00000000000..039cbd66330
> --- /dev/null
> +++ b/cad/yosys/patches/patch-libs_fmt_include_fmt_format_h
> @@ -0,0 +1,14 @@
> +added the missing ~ operator for uint128.
> +Index: libs/fmt/include/fmt/format.h
> +--- libs/fmt/include/fmt/format.h.orig
> ++++ libs/fmt/include/fmt/format.h
> +@@ -353,6 +353,9 @@ class uint128 {
> +     if (shift > 64) return uint128(lo_, 0) << (shift - 64);
> +     return {hi_ << shift | (lo_ >> (64 - shift)), (lo_ << shift)};
> +   }
> ++  friend auto operator ~ (uint128& n) -> uint128 {
> ++    return uint128( ~n.hi_, ~n.lo_ );
> ++  }
> +   FMT_CONSTEXPR auto operator>>=(int shift) -> uint128& {
> +     return *this = *this >> shift;
> +   }

Reply via email to