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

libutp build issues #4748

Closed
jpalus opened this issue Feb 8, 2023 · 5 comments
Closed

libutp build issues #4748

jpalus opened this issue Feb 8, 2023 · 5 comments

Comments

@jpalus
Copy link

jpalus commented Feb 8, 2023

What is the issue?

When updating to transmission 4.0.0 I've hit a few issues with libutp:

  • trying to build embedded libutp with gcc 12.2.0 fails with:
/home/users/builder/rpm/BUILD/transmission-4.0.0/build/third-party/utp/src/utp/utp_internal.cpp:3394:21: error: this statement may fall through [-Werror=implicit-fallthrough=]
  • if I disable libutp with -DENABLE_UTP=OFF I get:
CMake Error at libtransmission/CMakeLists.txt:267 (target_link_libraries):
  Target "transmission" links to:

    libutp::libutp

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.
/home/users/builder/rpm/BUILD/transmission-4.0.0/libtransmission/peer-io.cc: In lambda function:
/home/users/builder/rpm/BUILD/transmission-4.0.0/libtransmission/peer-io.cc:733:40: error: 'struct utp_callback_arguments' has no member named 'u1'
/home/users/builder/rpm/BUILD/transmission-4.0.0/libtransmission/peer-io.cc: In lambda function:
/home/users/builder/rpm/BUILD/transmission-4.0.0/libtransmission/peer-io.cc:746:63: error: 'struct utp_callback_arguments' has no member named 'u1'
/home/users/builder/rpm/BUILD/transmission-4.0.0/libtransmission/peer-io.cc: In lambda function:
/home/users/builder/rpm/BUILD/transmission-4.0.0/libtransmission/peer-io.cc:758:47: error: 'struct utp_callback_arguments' has no member named 'u1'
make[2]: *** [libtransmission/CMakeFiles/transmission.dir/build.make:429: libtransmission/CMakeFiles/transmission.dir/peer-io.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/home/users/builder/rpm/BUILD/transmission-4.0.0/libtransmission/tr-utp.cc: In function 'uint64 {anonymous}::utp_callback(utp_callback_arguments*)':
/home/users/builder/rpm/BUILD/transmission-4.0.0/libtransmission/tr-utp.cc:137:58: error: 'struct utp_callback_arguments' has no member named 'u1'
/home/users/builder/rpm/BUILD/transmission-4.0.0/libtransmission/tr-utp.cc:137:76: error: 'struct utp_callback_arguments' has no member named 'u2'

So it seems currently using system libutp is not possible (USE_SYSTEM_UTP), libutp is not optional (ENABLE_UTP) and build files for embedded libutp need tweaking so LIBUTP_ENABLE_WERROR does not get set to ON while keeping LIBUTP_STANDALONE_BUILD to ON since it's required for install target.

Which application of Transmission?

None

Which version of Transmission?

4.0.0

@ckerr
Copy link
Member

ckerr commented Feb 8, 2023

tl;dr in terms of unblocking you I'd say go into third-party/libutp/CMakeLists.txt and just turn off the Werror option

-  option(LIBUTP_ENABLE_WERROR "${PROJECT_NAME}: Treat warnings as errors" ${LIBUTP_STANDALONE_BUILD})
+  option(LIBUTP_ENABLE_WERROR "${PROJECT_NAME}: Treat warnings as errors" OFF)

I see three possible workitems for Transmission here:

  1. Your guess that the system libutp is incompatible is almost certainly correct. libutp has some semver-major changes but the upstream project doesn't do releases AFAIK and Transmission can't just run pkg-config to see what version is preinstalled. It's likely not detecting the version correctly; Transmission should probably sniff utp.h better and give a cleaner error message.

  2. I don't understand why your build is enabling -Werror; it looks like somehow LIBUTP_STANDALONE_BUILD is set to ON which it shouldn't be unless you're building libutp in its own cmake directory. But anyway that CMakeLists.txt file comes from The Transmission project and I'm not sure why we ever enable -Werror when building for Transmission. (@mikedld might know?)

  3. Maybe the WITH_UTP option to compile without UTP isn't needed anymore. It was added IIRC a decade ago when one distro had reservations about libutp but I think the library has proven itself safe since then. Also, the overwhelming majority of BitTorrent clients use UTP and so users who don't have it would be at a disadvantage.

For bookkeeping's sake I'm going to open separate tickets for those three issues, and I want to focus here in this ticket on getting it to build for you. @jpalus does disabling LIBUTP_STANDALONE_BUILD ubnlock you?

@jpalus
Copy link
Author

jpalus commented Feb 8, 2023

it looks like somehow LIBUTP_STANDALONE_BUILD is set to ON which it shouldn't be unless you're building libutp in its own cmake directory.
does disabling LIBUTP_STANDALONE_BUILD ubnlock you?

Actually that was my very first attempt to drop the logic for setting LIBUTP_STANDALONE_BUILD to ON which results in yet another failure:

make[3]: *** No rule to make target 'install'.  Stop.
make[2]: *** [CMakeFiles/utp.dir/build.make:107: third-party/utp/src/utp-stamp/utp-install] Error 2

I guess that's because LIBUTP_STANDALONE_BUILD is used for LIBUTP_ENABLE_INSTALL as well:
https://github.com/transmission/libutp/blob/bf695bdfb047cdca9710ea9cffc4018669cf9548/CMakeLists.txt#L9

and the latter guards:
https://github.com/transmission/libutp/blob/bf695bdfb047cdca9710ea9cffc4018669cf9548/CMakeLists.txt#L92-L103

@ckerr
Copy link
Member

ckerr commented Feb 8, 2023

OK. @mikedld wrote those and I'd rather give him a chance to weigh in instead of me second-guessing why that code is there.

In terms of just making this build for you, maybe remove the actual -Werror from add_compile_options() at https://github.com/transmission/libutp/blob/bf695bdfb047cdca9710ea9cffc4018669cf9548/CMakeLists.txt#L36 ?

@jpalus
Copy link
Author

jpalus commented Feb 8, 2023

Just to be clear I was able to compile transmission 4.0.0 successfully after patching embedded libutp cmake file and forcing LIBUTP_ENABLE_WERROR to OFF.

@ckerr
Copy link
Member

ckerr commented Feb 8, 2023

Awesome, I'm glad you got unblocked!

Since I've filed separate tickets for those workitems above (4750, 4751, 4752) I'm going to close this issue as completed. In particular 4752 would be the one for anyone else who hits this issue.

@ckerr ckerr closed this as completed Feb 8, 2023
pld-gitsync pushed a commit to pld-linux/transmission that referenced this issue Feb 8, 2023
- disable werror within shipped libutp and prevent use of (future)
  system libutp (transmission requires its own customized libutp)
  see transmission/transmission#4748
- ENABLE_WEB disabled since it does not do what it seems to do
  see transmission/transmission#4755
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants