Bug 260315 - emulators/qemu: fails to build upgrade to 6.1.0 when fuse ports are installed
Summary: emulators/qemu: fails to build upgrade to 6.1.0 when fuse ports are installed
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Muhammad Moinur Rahman
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-12-10 12:32 UTC by Martin Birgmeier
Modified: 2021-12-11 15:52 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (bofh)


Attachments
logfile from running "make" in "/usr/ports/emulators/qemu" (3.04 KB, text/plain)
2021-12-10 12:32 UTC, Martin Birgmeier
no flags Details
patch to fix emulators/qemu when both fusefs-libs and fusefs-libs3 are installed (536 bytes, patch)
2021-12-11 15:20 UTC, Martin Birgmeier
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Birgmeier 2021-12-10 12:32:42 UTC
Created attachment 230018 [details]
logfile from running "make" in "/usr/ports/emulators/qemu"

Scenario:
- FreeBSD 12.2 latest patchset
- Ports up-to-date
- Updating ports using portmaster
- The following fuse-related ports are installed:

[0]# installed-ports | grep fuse
fusefs-exfat-1.3.0_1
fusefs-libs-2.9.9_2
fusefs-libs3-3.10.5
fusefs-ntfs-2017.3.23
fusefs-sshfs-3.7.2
[0]# 

- Running "portmaster -a"

Result:
- emulators/qemu fails to build

Scenario (continued):
- "cd /usr/ports/emulators/qemu ; make 2>&1 | tee /tmp/make.log"

Result:
- The build fails with the attached logfile.
- There seems to be a clash with include files taken from both the qemu build and /usr/local/include/fuse or /usr/local/include/fuse3

Expected result:
- The build should work even when fusefs ports are installed.

Note:
- Comparing the fuse definitions inside qemu and those in /usr/local/include/fuse3, especially fuse_common.h, reveal quite significant differences.

-- Martin
Comment 1 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2021-12-10 16:40:51 UTC
qemu doesn't build with fusefs-libs3 as the internal fuse uses a lower version. Although it builds find with fusefs-libs.
Comment 2 Martin Birgmeier 2021-12-10 16:47:33 UTC
fusefs-libs3 is required by fusefs-sshfs.

Regardless of whether fusefs-libs or fusefs-libs3 are installed, if qemu comes with its own implementation the build should make sure that it uses only that and does not erroneously pick up the external version.

-- Martin
Comment 3 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2021-12-10 17:27:35 UTC
(In reply to Martin Birgmeier from comment #2)
Noops. It's not like that. All the ports are supposed to prefer system/ports libraries first and then use their internal versions in case those are not found. Plus there are external libraries qemu depends on so I cannot remove the whole external library detection. I just checked the configure script and there is no way way to do it easily at this moment as nowadays qemu uses a mix of configure/meson/gmake. There are two wayarounds here:
1. Uninstall fusefs-libs3 or the port that requires fusefs-libs3, install qemu and reinstall fusefs-libs3 or the port that requires fusefs-libs3.
2. Use a ports builder like poudriere/synth which builds the ports tree in an isolated environment and use binary packages in your host. This is a much better option as you don't have to wait to build a port as the tree is built at night or whenever you prefer your offtime.
Comment 4 commit-hook freebsd_committer freebsd_triage 2021-12-10 20:40:04 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=e6f5aeddaf1655f5fb55cc50541c10f814dc14d1

commit e6f5aeddaf1655f5fb55cc50541c10f814dc14d1
Author:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
AuthorDate: 2021-12-10 20:36:20 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2021-12-10 20:39:32 +0000

    emulators/qemu: Use system dtc from ports

    - elf2dmp depends on CURL [1]
    - Fix build when fusefs-libs3 is installed [2]

    PR:     260315 [2]
    Reported by: kostikbel@gmail.com [1] d8zNeCFG@aon.at [2]

 emulators/qemu/Makefile                            | 11 +--
 .../qemu/files/patch-block_export_fuse.c (new)     | 51 +++++++++++
 emulators/qemu/files/patch-configure               |  6 +-
 emulators/qemu/files/patch-meson.build (new)       | 20 +++++
 emulators/qemu/pkg-message                         | 99 ++--------------------
 emulators/qemu/pkg-plist                           |  2 +-
 6 files changed, 88 insertions(+), 101 deletions(-)
Comment 5 Martin Birgmeier 2021-12-11 07:40:42 UTC
Thank you!

-- Martin
Comment 6 Martin Birgmeier 2021-12-11 15:20:00 UTC
Created attachment 230042 [details]
patch to fix emulators/qemu when both fusefs-libs and fusefs-libs3 are installed

Please find attached a patch which fixes the issue (the commit in comment #4 is actually unrelated; the fix consists of making sure that /usr/local/include/fuse3 comes before /usr/local/include when compiling - this is necessary because sysutils/fusefs-libs installs both /usr/local/include/fuse.h and /usr/local/include/fuse/fuse.h, whereas sysutils/fusefs-libs3 installs only /usr/local/include/fuse3/fuse.h).

-- Martin
Comment 7 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2021-12-11 15:52:00 UTC
(In reply to Martin Birgmeier from comment #6)
I think this is not required. Even if you have sysutils/fusefs-libs qemu is not supposed to pick it up as it uses FUSE_USE_VERSION 25/26(I actually forgot) whereas qemu requires 31. So even if you have both installed sysutils/fusefs-libs3 should be picked up. My patch is indeed irrelevant but somehow sysutils/fusefs-libs3 is making qemu believe that it's running a system with FALLC* capabilities which is not true as FALLOC is supposed to be LINUX only. And the qemu code is written in such an if..else block that there is no way to use the qemu defined MACROS check for the FALLOC_*.
In case you have time you can check it by removing sysutils/fusefs-libs3 and trying to install qemu from ports. It should pickup the internal one rather than sysutils/fusefs-libs.