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

build: Require C11 #5

Merged
merged 1 commit into from
Mar 5, 2023
Merged

Conversation

jtojnar
Copy link

@jtojnar jtojnar commented Mar 5, 2023

Since c95738b, the compiler will complain “ISO C99 doesn't support unnamed structs/unions”.

Let’s switch to C11 standard, which support that feature.

@mikedld
Copy link
Member

mikedld commented Mar 5, 2023

@jtojnar could you share some more details please? Which compiler/version are we talking about? Is this when building libutp itself (which uses C++, not C internally) or when building some other project that's using it (which one? does it use C or C++?)?

@jtojnar
Copy link
Author

jtojnar commented Mar 5, 2023

It is when building libutp standalone from fda9f4b, using GCC 12.2.0.

Here is the full log:

cmake flags: -DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=OFF -DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DCMAKE_INSTALL_LOCALEDIR=/nix/store/4dm9zk1m6v9hpz4yg10m2gm7qi68s36l-libutp-unstable-2023-02-13/share/locale -DCMAKE_INSTALL_LIBEXECDIR=/nix/store/4dm9zk1m6v9hpz4yg10m2gm7qi68s36l-libutp-unstable-2023-02-13/libexec -DCMAKE_INSTALL_LIBDIR=/nix/store/4dm9zk1m6v9hpz4yg10m2gm7qi68s36l-libutp-unstable-2023-02-13/lib -DCMAKE_INSTALL_DOCDIR=/nix/store/4dm9zk1m6v9hpz4yg10m2gm7qi68s36l-libutp-unstable-2023-02-13/share/doc/libutp -DCMAKE_INSTALL_INFODIR=/nix/store/4dm9zk1m6v9hpz4yg10m2gm7qi68s36l-libutp-unstable-2023-02-13/share/info -DCMAKE_INSTALL_MANDIR=/nix/store/4dm9zk1m6v9hpz4yg10m2gm7qi68s36l-libutp-unstable-2023-02-13/share/man -DCMAKE_INSTALL_OLDINCLUDEDIR=/nix/store/4dm9zk1m6v9hpz4yg10m2gm7qi68s36l-libutp-unstable-2023-02-13/include -DCMAKE_INSTALL_INCLUDEDIR=/nix/store/4dm9zk1m6v9hpz4yg10m2gm7qi68s36l-libutp-unstable-2023-02-13/include -DCMAKE_INSTALL_SBINDIR=/nix/store/4dm9zk1m6v9hpz4yg10m2gm7qi68s36l-libutp-unstable-2023-02-13/sbin -DCMAKE_INSTALL_BINDIR=/nix/store/4dm9zk1m6v9hpz4yg10m2gm7qi68s36l-libutp-unstable-2023-02-13/bin -DCMAKE_INSTALL_NAME_DIR=/nix/store/4dm9zk1m6v9hpz4yg10m2gm7qi68s36l-libutp-unstable-2023-02-13/lib -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -DCMAKE_OSX_SYSROOT= -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_STRIP=/nix/store/bfbp3ypd9nm3fapz634gvvs738blrl0y-gcc-wrapper-12.2.0/bin/strip -DCMAKE_RANLIB=/nix/store/bfbp3ypd9nm3fapz634gvvs738blrl0y-gcc-wrapper-12.2.0/bin/ranlib -DCMAKE_AR=/nix/store/bfbp3ypd9nm3fapz634gvvs738blrl0y-gcc-wrapper-12.2.0/bin/ar -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_INSTALL_PREFIX=/nix/store/4dm9zk1m6v9hpz4yg10m2gm7qi68s36l-libutp-unstable-2023-02-13  
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /nix/store/bfbp3ypd9nm3fapz634gvvs738blrl0y-gcc-wrapper-12.2.0/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /nix/store/bfbp3ypd9nm3fapz634gvvs738blrl0y-gcc-wrapper-12.2.0/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    BUILD_TESTING
    CMAKE_EXPORT_NO_PACKAGE_REGISTRY
    CMAKE_FIND_USE_PACKAGE_REGISTRY
    CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY
    CMAKE_POLICY_DEFAULT_CMP0025


-- Build files have been written to: /build/source/build
cmake: enabled parallel building
building
build flags: -j8 SHELL=/nix/store/5ynbf6wszmggr0abwifdagrixgnya5vy-bash-5.2-p15/bin/bash
[ 11%] Building CXX object CMakeFiles/libutp.dir/utp_callbacks.cpp.o
[ 22%] Building CXX object CMakeFiles/libutp.dir/utp_internal.cpp.o
[ 33%] Building CXX object CMakeFiles/libutp.dir/utp_api.cpp.o
[ 44%] Building CXX object CMakeFiles/libutp.dir/utp_hash.cpp.o
[ 55%] Building CXX object CMakeFiles/libutp.dir/utp_packedsockaddr.cpp.o
[ 66%] Building CXX object CMakeFiles/libutp.dir/utp_utils.cpp.o
[ 77%] Linking CXX static library libutp.a
[ 77%] Built target libutp
[ 88%] Building C object CMakeFiles/ucat.dir/ucat.c.o
In file included from /build/source/ucat.c:46:
/build/source/include/libutp/utp.h:113:10: error: ISO C99 doesn't support unnamed structs/unions [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wpedantic-Werror=pedantic8;;]
  113 |         };
      |          ^
/build/source/include/libutp/utp.h:118:10: error: ISO C99 doesn't support unnamed structs/unions [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wpedantic-Werror=pedantic8;;]
  118 |         };
      |          ^
cc1: all warnings being treated as errors
make[2]: *** [CMakeFiles/ucat.dir/build.make:76: CMakeFiles/ucat.dir/ucat.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:111: CMakeFiles/ucat.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

@mikedld
Copy link
Member

mikedld commented Mar 5, 2023

Could you also fixup the readme, based on bittorrent#100?

FYI I appreciate you opening this PR, but the main use-case for this repository and this non-main branch is to be built as a submodule in the main Transmission repo (which doesn't build/need ucat, just the library), not standalone. We don't intend to provide support for libutp here (or at least it certainly wasn't the original intention), so publishing a package using this repo and this branch, and built as static, is... somewhat odd IMHO, although of course always your choice e.g. if some other package(s) will make good use of it too.

Still, kind of nice to have the standalone build passing.

Since transmission@c95738b, the compiler will complain “ISO C99 doesn't support unnamed structs/unions”.

Let’s switch to C11 standard, which support that feature.
@jtojnar
Copy link
Author

jtojnar commented Mar 5, 2023

Done.

We are using the standalone libutp as a dependency for Transmission (and few other clients based on libtransmission). Currently updating the package to 4.0.

@mikedld mikedld merged commit 9cb9f9c into transmission:post-3.4-transmission Mar 5, 2023
@jtojnar jtojnar deleted the patch-1 branch March 5, 2023 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants