Opened 14 months ago

Closed 14 months ago

Last modified 14 months ago

#66956 closed defect (fixed)

qbittorrent @4.5.1: build failure, undefined symbols for std::filesystem on 10.14

Reported by: contextnerror Owned by: i0ntempest
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: mojave Cc:
Port: qBittorrent

Description

qBittorrent fails to build on Mojave. Says something about undefined symbols for architecture x86_64.
macOS 10.14.6 18G9323 x86_64
Command Line Tools 10.3.0.0.1.1562985497
Log file is attached.

Attachments (8)

main.log (1.2 MB) - added by contextnerror 14 months ago.
qBittorrent-log.bz2 (18.2 KB) - added by contextnerror 14 months ago.
Second build failure log
qBitorrent-qt5-log.bz2 (16.9 KB) - added by contextnerror 14 months ago.
qbittorrent-qt5-filesystem-not-found.bz2 (9.8 KB) - added by contextnerror 14 months ago.
qbittorrent-qt5-undefined-symbols.bz2 (17.0 KB) - added by contextnerror 14 months ago.
macports-libcxx.txt (8.2 KB) - added by contextnerror 14 months ago.
Output of port content macports-libcxx, for version 11.1.0
qbittorrent-qt5-filesystem-again.bz2 (9.9 KB) - added by contextnerror 14 months ago.
qt5-toggle-visibility.bz2 (13.0 KB) - added by contextnerror 14 months ago.

Download all attachments as: .zip

Change History (31)

Changed 14 months ago by contextnerror

Attachment: main.log added

comment:1 Changed 14 months ago by contextnerror

Sorry, I forgot to compress that before I uploaded it.

comment:2 Changed 14 months ago by i0ntempest

I'm already aware but couldn't figure it out. It's related to C++ standards and the filesystem library. Need help from someone who knows C++.

comment:3 Changed 14 months ago by kencu (Ken)

It's using std::filesystem but not finding the symbols for it in the system libc++.dylib to link against:

:info:build   "std::__1::__fs::filesystem::__status(std::__1::__fs::filesystem::path const&, std::__1::error_code*)", referenced from:
:info:build       Utils::Fs::isRegularFile(Path const&) in libqbt_base.a(fs.cpp.o)

because std::filesystem was not compiled into the system libc++.dylib until macOS 10.15.

https://github.com/llvm/llvm-project/blob/997dc7e00f49663b60a78e18df1dfecdf62a4172/libcxx/include/__availability#L220

To get around this (ie to provide std::filesystem on older systems before 10.15) we have various options.

  1. We can use the macports-libcxx port, which provides a newer libc++ to link against. This is very easy to do (it's an option in legacysupport) and often works, but there can sometimes be a hiccup mixing the newer libc++.dylib and the system libc++.dylib, so you have to do a bit of testing to make sure things work as expected.
  2. You might be able to tell the software not to use std::filesystem somehow -- force off the detection code, if there is any, turn it off with a configure argument, etc.
  3. Or we can find another way to provide the filesystem objects to the build -- older clang versions did have libfilesystem in a separate library that we could somehow make available to current clang versions to use.
  4. Finally, there are a few options where std::filesystem is replaced with some other port, like this port:
ghc-filesystem @1.5.12 (devel)
    An implementation of C++17 std::filesystem.

which despite the name has nothing to do with ghc haskell (in this case, ghc are the author's initials). This port is said to reproduce std::filesystem quite accurately, and perhaps we might find a way to use this successfully on the other systems, ideally without too much actual patching. I haven't tried to do that as yet.

comment:4 Changed 14 months ago by kencu (Ken)

Summary: qbittorrent @4.5.1: build failure, undefined symbolsqbittorrent @4.5.1: build failure, undefined symbols for std::filesystem on 10.14

comment:5 Changed 14 months ago by kencu (Ken)

Keywords: mojave added

comment:6 Changed 14 months ago by i0ntempest

Resolution: fixed
Status: assignedclosed

In 3fe755327bbec563fcb40ded3dcd950d4c06fb1b/macports-ports (master):

qBittorrent: 4.5.2, enable legacysupport

Closes: #66956

comment:7 Changed 14 months ago by i0ntempest

Thanks for the pointers, an attempt has been made to fix this, using macports-libcxx.

comment:8 Changed 14 months ago by contextnerror

Build is still failing at the moment, but I don't know if the issue is related. Should this be its own ticket?

Changed 14 months ago by contextnerror

Attachment: qBittorrent-log.bz2 added

Second build failure log

comment:9 Changed 14 months ago by i0ntempest

That's another error: error: no member named 'toggleVisibility' in 'MainWindow'

Seen it before and I think it's qt-related. Try qbittorrent-qt5 port.

Last edited 14 months ago by i0ntempest (previous) (diff)

comment:10 Changed 14 months ago by contextnerror

Unlike the standard port, the qt5 version is still giving the original std::filesystem error. Not sure why that is.

Changed 14 months ago by contextnerror

Attachment: qBitorrent-qt5-log.bz2 added

comment:11 Changed 14 months ago by i0ntempest

Your log shows 4.5.1 which is before I added the fix to the qt5 port. Please do a selfupdate and try again.

comment:12 Changed 14 months ago by contextnerror

Yeah, that one was my mistake. Now it's giving errors about not being able to find "filesystem" instead:

:info:build In file included from app/cmdoptions.cpp:31:
:info:build In file included from app/cmdoptions.h:39:
:info:build ./base/path.h:32:10: fatal error: 'filesystem' file not found
:info:build #include <filesystem>
:info:build          ^~~~~~~~~~~~`

Changed 14 months ago by contextnerror

comment:13 Changed 14 months ago by i0ntempest

Try changing the compiler blacklist at line 39 to: compiler.blacklist-append *gcc-3.* *gcc-4.* *gcc-5.* *gcc-6.* *gcc-7.* {clang < 1100} and building again. You can get to the portfile using port edit qbittorrent-qt5.

comment:14 Changed 14 months ago by contextnerror

Doing that seems to have brought me full circle, since it's failing due to undefined symbols again. But I think it's gotten further than before.

Changed 14 months ago by contextnerror

comment:15 Changed 14 months ago by i0ntempest

Looks like legacysupport magic doesn't work for the qt5 port because it's using qmake (EDIT: yes it worked - stupid mistake by me), and I'll need to manually add the variables in to point it to the new libcxx. I don't have libcxx port since I'm running the newest OS, can you please post the output of port content libcxx?

Last edited 14 months ago by i0ntempest (previous) (diff)

comment:16 Changed 14 months ago by contextnerror

Port libcxx contains: /opt/local/share/doc/libcxx/README.txt

Said text file has the following message:

libcxx is an empty port on this OS version because the functionality is already provided by the OS.

I'm assuming this isn't the info you wanted.

comment:17 Changed 14 months ago by i0ntempest

What about macports-libcxx?

Changed 14 months ago by contextnerror

Attachment: macports-libcxx.txt added

Output of port content macports-libcxx, for version 11.1.0

comment:18 Changed 14 months ago by i0ntempest

Please try the portfile here: https://github.com/macports/macports-ports/pull/17845 and see if you get a successful build.

comment:19 Changed 14 months ago by contextnerror

Failed pretty early on due to 'filesystem' file not found again.

Changed 14 months ago by contextnerror

comment:20 Changed 14 months ago by i0ntempest

Made some changes to the PR, please get a new portfile and try again.

comment:21 Changed 14 months ago by contextnerror

I got the error: no member named 'toggleVisibility' in 'MainWindow' error again. So I guess using the qt5 port didn't help with that after all.

Changed 14 months ago by contextnerror

Attachment: qt5-toggle-visibility.bz2 added

comment:22 Changed 14 months ago by i0ntempest

Well, in that case the newest qt supported on your OS just isn't enough to build it. This affects 4.3.2 on macOS 10.12 as well. See https://github.com/qbittorrent/qBittorrent/discussions/17326 for the question I posted that never got an answer.

comment:23 Changed 14 months ago by contextnerror

It does look like you're right, based on comment:51:ticket:62441. I've voted up your question on github, but I won't be holding my breath for an answer.

I do appreciate all the time you've put in trying to get this to work, though.

Note: See TracTickets for help on using tickets.