#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)
Change History (31)
Changed 21 months ago by contextnerror
comment:1 Changed 21 months ago by contextnerror
comment:2 Changed 21 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 21 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.
To get around this (ie to provide std::filesystem
on older systems before 10.15) we have various options.
- 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.
- 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.
- 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.
- 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 21 months ago by kencu (Ken)
Summary: | qbittorrent @4.5.1: build failure, undefined symbols → qbittorrent @4.5.1: build failure, undefined symbols for std::filesystem on 10.14 |
---|
comment:5 Changed 21 months ago by kencu (Ken)
Keywords: | mojave added |
---|
comment:6 Changed 21 months ago by i0ntempest
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:7 Changed 21 months ago by i0ntempest
Thanks for the pointers, an attempt has been made to fix this, using macports-libcxx.
comment:8 Changed 21 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 21 months ago by contextnerror
Attachment: | qBittorrent-log.bz2 added |
---|
Second build failure log
comment:9 Changed 21 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.
comment:10 Changed 21 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 21 months ago by contextnerror
Attachment: | qBitorrent-qt5-log.bz2 added |
---|
comment:11 Changed 21 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 21 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 21 months ago by contextnerror
Attachment: | qbittorrent-qt5-filesystem-not-found.bz2 added |
---|
comment:13 Changed 21 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 21 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 21 months ago by contextnerror
Attachment: | qbittorrent-qt5-undefined-symbols.bz2 added |
---|
comment:15 Changed 21 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
?
comment:16 Changed 21 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.
Changed 21 months ago by contextnerror
Attachment: | macports-libcxx.txt added |
---|
Output of port content macports-libcxx, for version 11.1.0
comment:18 Changed 21 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 21 months ago by contextnerror
Failed pretty early on due to 'filesystem' file not found
again.
Changed 21 months ago by contextnerror
Attachment: | qbittorrent-qt5-filesystem-again.bz2 added |
---|
comment:20 Changed 21 months ago by i0ntempest
Made some changes to the PR, please get a new portfile and try again.
comment:21 Changed 21 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 21 months ago by contextnerror
Attachment: | qt5-toggle-visibility.bz2 added |
---|
comment:22 Changed 21 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 21 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.
Sorry, I forgot to compress that before I uploaded it.