Bug 285403 - graphics/libavif: build fail
Summary: graphics/libavif: build fail
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Po-Chuan Hsieh
URL:
Keywords:
: 285405 (view as bug list)
Depends on:
Blocks:
 
Reported: 2025-03-14 13:30 UTC by Ivan Rozhuk
Modified: 2025-03-15 13:09 UTC (History)
4 users (show)

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


Attachments
patch (700 bytes, patch)
2025-03-14 14:16 UTC, Ivan Rozhuk
rozhuk.im: maintainer-approval?
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Rozhuk 2025-03-14 13:30:15 UTC
[ 74% 64/67] : && /usr/local/libexec/ccache/cc -O2 -pipe -O3 -pipe -funroll-loops -mretpoline -fno-delete-null-pointer-checks  -fstack-protector-strong -fno-strict-aliasing  -fdebug-prefix-map=/tmp/ports/usr/ports/graphics/libavif/work/libavif-1.2.0=. -O2 -pipe -O3 -pipe -funroll-loops -mretpoline -fno-delete-null-pointer-checks  -fstack-protector-strong -fno-strict-aliasing  -fdebug-prefix-map=/tmp/ports/usr/ports/graphics/libavif/work/libavif-1.2.0=. -DNDEBUG -fstack-protector-strong     -Xlinker --dependency-file=CMakeFiles/avifdec.dir/link.d CMakeFiles/avifdec.dir/apps/avifdec.c.o -o avifdec  -Wl,-rpath,/tmp/ports/usr/ports/graphics/libavif/work/.build:/usr/local/lib:  libavif_apps.a  libavif.so.16.2.0  /usr/local/lib/libpng.so  /usr/lib/libz.so  /usr/local/lib/libjpeg.so && :
FAILED: avifdec 
: && /usr/local/libexec/ccache/cc -O2 -pipe -O3 -pipe -funroll-loops -mretpoline -fno-delete-null-pointer-checks  -fstack-protector-strong -fno-strict-aliasing  -fdebug-prefix-map=/tmp/ports/usr/ports/graphics/libavif/work/libavif-1.2.0=. -O2 -pipe -O3 -pipe -funroll-loops -mretpoline -fno-delete-null-pointer-checks  -fstack-protector-strong -fno-strict-aliasing  -fdebug-prefix-map=/tmp/ports/usr/ports/graphics/libavif/work/libavif-1.2.0=. -DNDEBUG -fstack-protector-strong     -Xlinker --dependency-file=CMakeFiles/avifdec.dir/link.d CMakeFiles/avifdec.dir/apps/avifdec.c.o -o avifdec  -Wl,-rpath,/tmp/ports/usr/ports/graphics/libavif/work/.build:/usr/local/lib:  libavif_apps.a  libavif.so.16.2.0  /usr/local/lib/libpng.so  /usr/lib/libz.so  /usr/local/lib/libjpeg.so && :
ld: error: undefined symbol: round
>>> referenced by iccmaker.c
>>>               iccmaker.c.o:(avifGenerateRGBICC) in archive libavif_apps.a
>>> referenced by iccmaker.c
>>>               iccmaker.c.o:(avifGenerateRGBICC) in archive libavif_apps.a
>>> referenced by iccmaker.c
>>>               iccmaker.c.o:(avifGenerateRGBICC) in archive libavif_apps.a
>>> referenced 10 more times

ld: error: undefined symbol: roundf
>>> referenced by iccmaker.c
>>>               iccmaker.c.o:(avifGenerateRGBICC) in archive libavif_apps.a
>>> referenced by iccmaker.c
>>>               iccmaker.c.o:(avifGenerateGrayICC) in archive libavif_apps.a
cc: error: linker command failed with exit code 1 (use -v to see invocation)
[ 76% 64/67] : && /usr/local/libexec/ccache/cc -O2 -pipe -O3 -pipe -funroll-loops -mretpoline -fno-delete-null-pointer-checks  -fstack-protector-strong -fno-strict-aliasing  -fdebug-prefix-map=/tmp/ports/usr/ports/graphics/libavif/work/libavif-1.2.0=. -O2 -pipe -O3 -pipe -funroll-loops -mretpoline -fno-delete-null-pointer-checks  -fstack-protector-strong -fno-strict-aliasing  -fdebug-prefix-map=/tmp/ports/usr/ports/graphics/libavif/work/libavif-1.2.0=. -DNDEBUG -fstack-protector-strong     -Xlinker --dependency-file=CMakeFiles/avifenc.dir/link.d CMakeFiles/avifenc.dir/apps/avifenc.c.o -o avifenc  -Wl,-rpath,/tmp/ports/usr/ports/graphics/libavif/work/.build:/usr/local/lib:  libavif_apps.a  libavif.so.16.2.0  /usr/local/lib/libpng.so  /usr/lib/libz.so  /usr/local/lib/libjpeg.so && :
FAILED: avifenc 
: && /usr/local/libexec/ccache/cc -O2 -pipe -O3 -pipe -funroll-loops -mretpoline -fno-delete-null-pointer-checks  -fstack-protector-strong -fno-strict-aliasing  -fdebug-prefix-map=/tmp/ports/usr/ports/graphics/libavif/work/libavif-1.2.0=. -O2 -pipe -O3 -pipe -funroll-loops -mretpoline -fno-delete-null-pointer-checks  -fstack-protector-strong -fno-strict-aliasing  -fdebug-prefix-map=/tmp/ports/usr/ports/graphics/libavif/work/libavif-1.2.0=. -DNDEBUG -fstack-protector-strong     -Xlinker --dependency-file=CMakeFiles/avifenc.dir/link.d CMakeFiles/avifenc.dir/apps/avifenc.c.o -o avifenc  -Wl,-rpath,/tmp/ports/usr/ports/graphics/libavif/work/.build:/usr/local/lib:  libavif_apps.a  libavif.so.16.2.0  /usr/local/lib/libpng.so  /usr/lib/libz.so  /usr/local/lib/libjpeg.so && :
ld: error: undefined symbol: round
>>> referenced by iccmaker.c
>>>               iccmaker.c.o:(avifGenerateRGBICC) in archive libavif_apps.a
>>> referenced by iccmaker.c
>>>               iccmaker.c.o:(avifGenerateRGBICC) in archive libavif_apps.a
>>> referenced by iccmaker.c
>>>               iccmaker.c.o:(avifGenerateRGBICC) in archive libavif_apps.a
>>> referenced 10 more times

ld: error: undefined symbol: roundf
>>> referenced by iccmaker.c
>>>               iccmaker.c.o:(avifGenerateRGBICC) in archive libavif_apps.a
>>> referenced by iccmaker.c
>>>               iccmaker.c.o:(avifGenerateGrayICC) in archive libavif_apps.a
cc: error: linker command failed with exit code 1 (use -v to see invocation)
Comment 1 Ivan Rozhuk 2025-03-14 14:16:31 UTC
Created attachment 258665 [details]
patch
Comment 2 Vladimir Druzenko freebsd_committer freebsd_triage 2025-03-14 19:31:24 UTC
Build fine for me without -lm.
Comment 3 Vladimir Druzenko freebsd_committer freebsd_triage 2025-03-14 19:32:21 UTC
*** Bug 285405 has been marked as a duplicate of this bug. ***
Comment 4 Ivan Rozhuk 2025-03-14 19:41:33 UTC
(In reply to Vladimir Druzenko from comment #2)
Probably options depend.

# make showconfig
===> The following configuration options are available for libavif-1.2.0:
     MANPAGES=off: Install manpages (requires pandoc)
     PIXBUF=on: GDK-PixBuf library support
====> Options available for the group AV1
     AOM=on: AV1 encoding/decoding via libaom
     DAV1D=on: AV1 decoding via libdav1d
     GAV1=off: AV1 decoding via libgav1
     RAV1E=off: AV1 encoding via librav1e
     SVTAV1=on: AV1 encoding via SVT-AV1
====> Options available for the group COLOR
     LIBSHARPYUV=off: Colorspace conversion via libsharpyuv
     LIBYUV=off: Colorspace conversion via libyuv
===> Use 'make config' to modify these settings

FBSD 14/stable amd64 build less than 5 days ago.
Comment 5 Vladimir Druzenko freebsd_committer freebsd_triage 2025-03-14 20:19:53 UTC
(In reply to Ivan Rozhuk from comment #4)
From email list:
>> This error does not happen with OPTION LIBYUV enabled. This option has graphics/libyuv as dependency.
> Adding LIBYUV_CFLAGS_OFF=-Wl,-lm seems to work.
Comment 6 Trond Endrestøl 2025-03-14 20:21:19 UTC
(In reply to Ivan Rozhuk from comment #4)
===> The following configuration options are available for libavif-1.2.0:
     MANPAGES=off: Install manpages (requires pandoc)
     PIXBUF=on: GDK-PixBuf library support
====> Options available for the group AV1
     AOM=on: AV1 encoding/decoding via libaom
     DAV1D=on: AV1 decoding via libdav1d
     GAV1=off: AV1 decoding via libgav1
     RAV1E=off: AV1 encoding via librav1e
     SVTAV1=off: AV1 encoding via SVT-AV1
====> Options available for the group COLOR
     LIBSHARPYUV=off: Colorspace conversion via libsharpyuv
     LIBYUV=off: Colorspace conversion via libyuv

I noticed I have SVTAV1 off. I'll try again after enabling SVTAV1 and moving my patch out of the way.
Comment 7 Craig Leres freebsd_committer freebsd_triage 2025-03-14 20:59:50 UTC
(In reply to Vladimir Druzenko from comment #5)
https://lists.freebsd.org/archives/dev-commits-ports-all/2025-March/152618.html
Comment 8 Po-Chuan Hsieh freebsd_committer freebsd_triage 2025-03-15 10:59:21 UTC
It is confirmed that this port builds fine with default options. Let me test it and I'll commit the fix. Thanks.
Comment 9 commit-hook freebsd_committer freebsd_triage 2025-03-15 13:02:30 UTC
A commit in branch main references this bug:

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

commit 1e99b807283ac2743600d0db0832c97e8fcaa4db
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2025-03-15 13:01:11 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2025-03-15 13:01:11 +0000

    graphics/libavif: Fix build with non-default options

    libavif uses round/roundf which is in the math library.
    It builds fine with default options because libm is brought in via its dependencies.
    Therefore, we add it to LDFLAGS explicitly.

    PR:             285403, 285405
    Reported by:    many

 graphics/libavif/Makefile | 1 +
 1 file changed, 1 insertion(+)