Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 921564

Summary: sys-fs/bcachefs-tools-1.4.0 - libbcachefs.c:474:11: error: use of undeclared identifier 'opts' (17.0/musl/clang profile)
Product: Gentoo Linux Reporter: ernsteiswuerfel <erhard_f>
Component: Current packagesAssignee: Matt Jolly <kangie>
Status: RESOLVED FIXED    
Severity: normal CC: csfore, erhard_f, gebauer.andy
Priority: Normal Keywords: PullRequest, REGRESSION
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://github.com/gentoo/gentoo/pull/34983
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 408963    
Attachments: build.log
emerge --info
fix build on musl/clang

Description ernsteiswuerfel archtester 2024-01-07 14:26:11 UTC
Created attachment 881595 [details]
build.log

1.3.5_p20231216 built ok but 1.4.0 fails with:

[...]
clang-16  -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -Os -march=znver2 -pipe -std=gnu11   -MMD -Wall -fPIC -Wno-pointer-sign -Wno-deprecated-declarations -fno-strict-aliasing -fno-delete-null-pointer-checks -I. -Iinclude -Iraid -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LGPL_SOURCE -DRCU_MEMBARRIER -DZSTD_STATIC_LINKING_ONLY -DFUSE_USE_VERSION=35 -DNO_BCACHEFS_CHARDEV -DNO_BCACHEFS_FS -DNO_BCACHEFS_SYSFS -DVERSION_STRING='"1.4.0"'  -Wno-unused-but-set-variable -Wno-missing-braces -Wno-zero-length-array -Wno-shift-overflow -Wno-enum-conversion -Wno-gnu-variable-sized-type-not-at-end -I/usr/include/blkid -I/usr/include/uuid  -c -o libbcachefs.o libbcachefs.c
libbcachefs.c:472:3: error: expected expression
                struct bch_opts opts = bch2_opts_empty();
                ^
libbcachefs.c:474:11: error: use of undeclared identifier 'opts'
                opt_set(opts, noexcl,   true);
                        ^
libbcachefs.c:474:11: error: use of undeclared identifier 'opts'
libbcachefs.c:475:11: error: use of undeclared identifier 'opts'
                opt_set(opts, nochanges, true);
                        ^
libbcachefs.c:475:11: error: use of undeclared identifier 'opts'
libbcachefs.c:478:36: error: use of undeclared identifier 'opts'
                int ret = bch2_read_super(path, &opts, &sb);
                                                 ^
6 errors generated.
make: *** [Makefile:172: libbcachefs.o] Error 1
Comment 1 ernsteiswuerfel archtester 2024-01-07 14:26:43 UTC
Created attachment 881596 [details]
emerge --info
Comment 2 ernsteiswuerfel archtester 2024-01-07 14:32:03 UTC
Interestingly building v1.4.0 from git just works fine.
Comment 3 Andy 2024-01-10 05:54:54 UTC
I can confirm the same happens with Clang on ~arm64
Comment 4 Andy 2024-01-14 10:17:48 UTC
Error does not happen on gcc-13.2.1_p20231216
Comment 5 Christopher Fore 2024-01-24 03:12:29 UTC
Created attachment 883014 [details, diff]
fix build on musl/clang

This should work, I looked upstream and noticed the change.
Comment 6 Larry the Git Cow gentoo-dev 2024-01-24 07:31:57 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1b57acdd9fe27f7d3f8b41665a52be59146d9e8e

commit 1b57acdd9fe27f7d3f8b41665a52be59146d9e8e
Author:     Christopher Fore <csfore@posteo.net>
AuthorDate: 2024-01-24 04:24:19 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-01-24 07:30:27 +0000

    sys-fs/bcachefs-tools: fix musl+clang build failure on 1.4.0
    
    - fix-clang-musl.patch
       Applies fix from upstream to rearrange the variable order
    
    All tests pass on glibc and musl.
    
    Closes: https://bugs.gentoo.org/921564
    Signed-off-by: Christopher Fore <csfore@posteo.net>
    Closes: https://github.com/gentoo/gentoo/pull/34983
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-fs/bcachefs-tools/bcachefs-tools-1.4.0.ebuild  |  4 ++++
 .../bcachefs-tools-1.4.0-fix-clang-musl.patch      | 24 ++++++++++++++++++++++
 2 files changed, 28 insertions(+)
Comment 7 ernsteiswuerfel archtester 2024-01-24 13:19:30 UTC
(In reply to Christopher Fore from comment #5)
> Created attachment 883014 [details, diff] [details, diff]
> fix build on musl/clang
> 
> This should work, I looked upstream and noticed the change.
Thanks for the fix!

Then at least current 1.4.0 works with musl/clang. Current git master fails on musl because of a system call not implementend in musl. See: https://github.com/koverstreet/bcachefs-tools/issues/213
Comment 8 Christopher Fore 2024-01-24 13:33:46 UTC
Thanks! A 1.4.1 bump was merged last night and with that a mask for it since it had the Musl syscall in this PR:

https://github.com/gentoo/gentoo/pull/34969