[Bug 270421] graphics/librsvg2-rust: 2.56.0 Fails to compile because of LLVM version mismatch

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 23 Mar 2023 18:50:02 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270421

            Bug ID: 270421
           Summary: graphics/librsvg2-rust: 2.56.0 Fails to compile
                    because of LLVM version mismatch
           Product: Ports & Packages
           Version: Latest
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: desktop@FreeBSD.org
          Reporter: freebsd@lunaa.pink
             Flags: maintainer-feedback?(desktop@FreeBSD.org)
          Assignee: desktop@FreeBSD.org

When trying to compile librsvg2-rust it fails with this error:

```
CPPFLAGS="" CFLAGS="-march=native -O3 -pipe -funroll-loops -march=znver2 
-fstack-protector-strong -fno-strict-aliasing "
LDFLAGS="-fstack-protector-strong " CC="cc" PKG_CONFIG="pkgconf" GI_HOST_OS=""
DLLTOOL="false"  /usr/local/bin/g-ir-scanner  --add-include-path=.
--symbol-prefix=rsvg --symbol-prefix=librsvg --warn-all --namespace=Rsvg
--nsversion=2.0 --libtool="/bin/sh ./libtool" --pkg=pango --pkg=libxml-2.0
--include=GLib-2.0 --include=GObject-2.0 --include=Gio-2.0 --include=cairo-1.0
--include=GdkPixbuf-2.0 --pkg-export=librsvg-2.0   --library=librsvg-2.la
--c-include="librsvg/rsvg.h" --cflags-begin -I./include -I. -I./include
-DRSVG_COMPILATION --cflags-end  include/librsvg/rsvg.h
include/librsvg/rsvg-cairo.h include/librsvg/rsvg-features.h
include/librsvg/rsvg-version.h librsvg-2.la --output Rsvg-2.0.gir
g-ir-scanner: link: /bin/sh ./libtool --mode=link --tag=CC cc -o
/wrkdirs/usr/ports/graphics/librsvg2-rust/work/librsvg-2.56.0/tmp-introspectn2ree5hw/Rsvg-2.0
-export-dynamic -march=native -O3 -pipe -funroll-loops -march=znver2
-fstack-protector-strong -fno-strict-aliasing
/wrkdirs/usr/ports/graphics/librsvg2-rust/work/librsvg-2.56.0/tmp-introspectn2ree5hw/Rsvg-2.0.o
-L. librsvg-2.la -L/usr/local/lib -lgio-2.0 -Wl,--export-dynamic -lgmodule-2.0
-pthread -lglib-2.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lintl -lharfbuzz
-lxml2 -fstack-protector-strong
libtool: link: cc -o
/wrkdirs/usr/ports/graphics/librsvg2-rust/work/librsvg-2.56.0/tmp-introspectn2ree5hw/.libs/Rsvg-2.0
-march=native -O3 -pipe -funroll-loops -march=znver2 -fstack-protector-strong
-fno-strict-aliasing
/wrkdirs/usr/ports/graphics/librsvg2-rust/work/librsvg-2.56.0/tmp-introspectn2ree5hw/Rsvg-2.0.o
-Wl,--export-dynamic -fstack-protector-strong -Wl,--export-dynamic  -L.
./.libs/librsvg-2.so -L/usr/local/lib -lgmodule-2.0 -lpng16 -lcairo-gobject
-lgdk_pixbuf-2.0 -lgio-2.0 -lxml2 -lpangocairo-1.0 -lcairo -lpangoft2-1.0
-lpango-1.0 -lgobject-2.0 -lglib-2.0 -lintl -lharfbuzz -lfontconfig -lfreetype
-lm -pthread -Wl,-rpath -Wl,/usr/local/lib
ld: error: undefined symbol: rsvg_error_get_type
>>> referenced by Rsvg-2.0.c
>>>               /wrkdirs/usr/ports/graphics/librsvg2-rust/work/librsvg-2.56.0/tmp-introspectn2ree5hw/Rsvg-2.0.o:(GI_GET_TYPE_FUNCS_)

ld: error: undefined symbol: rsvg_handle_get_type
>>> referenced by Rsvg-2.0.c
>>>               /wrkdirs/usr/ports/graphics/librsvg2-rust/work/librsvg-2.56.0/tmp-introspectn2ree5hw/Rsvg-2.0.o:(GI_GET_TYPE_FUNCS_)

ld: error: undefined symbol: rsvg_handle_flags_get_type
>>> referenced by Rsvg-2.0.c
>>>               /wrkdirs/usr/ports/graphics/librsvg2-rust/work/librsvg-2.56.0/tmp-introspectn2ree5hw/Rsvg-2.0.o:(GI_GET_TYPE_FUNCS_)

ld: error: undefined symbol: rsvg_error_quark
>>> referenced by Rsvg-2.0.c
>>>               /wrkdirs/usr/ports/graphics/librsvg2-rust/work/librsvg-2.56.0/tmp-introspectn2ree5hw/Rsvg-2.0.o:(GI_ERROR_QUARK_FUNCS_)
cc: error: linker command failed with exit code 1 (use -v to see invocation)
linking of temporary binary failed: Command '['/bin/sh', './libtool',
'--mode=link', '--tag=CC', 'cc', '-o',
'/wrkdirs/usr/ports/graphics/librsvg2-rust/work/librsvg-2.56.0/tmp-introspectn2ree5hw/Rsvg-2.0',
'-export-dynamic', '-march=native', '-O3', '-pipe', '-funroll-loops',
'-march=znver2', '-fstack-protector-strong', '-fno-strict-aliasing',
'/wrkdirs/usr/ports/graphics/librsvg2-rust/work/librsvg-2.56.0/tmp-introspectn2ree5hw/Rsvg-2.0.o',
'-L.', 'librsvg-2.la', '-L/usr/local/lib', '-lgio-2.0', '-Wl,--export-dynamic',
'-lgmodule-2.0', '-pthread', '-lglib-2.0', '-lpango-1.0', '-lgobject-2.0',
'-lglib-2.0', '-lintl', '-lharfbuzz', '-lxml2', '-fstack-protector-strong']'
returned non-zero exit status 1.
gmake[3]: ***
[/usr/local/share/gobject-introspection-1.0/Makefile.introspection:156:
Rsvg-2.0.gir] Error 1
gmake[3]: Leaving directory
'/wrkdirs/usr/ports/graphics/librsvg2-rust/work/librsvg-2.56.0'
gmake[2]: *** [Makefile:1075: all-recursive] Error 1
gmake[2]: Leaving directory
'/wrkdirs/usr/ports/graphics/librsvg2-rust/work/librsvg-2.56.0'
gmake[1]: *** [Makefile:710: all] Error 2
gmake[1]: Leaving directory
'/wrkdirs/usr/ports/graphics/librsvg2-rust/work/librsvg-2.56.0'
*** Error code 1
```

Further up another error occurs:

```
libtool: link: ranlib .libs/librsvg_c_api.a
libtool: link: ( cd ".libs" && rm -f "librsvg_c_api.la" && ln -s
"../librsvg_c_api.la" "librsvg_c_api.la" )
/bin/sh ./libtool  --tag=CC   --mode=link cc  -march=native -O3 -pipe
-funroll-loops -march=znver2  -fstack-protector-strong -fno-strict-aliasing  
-version-info 50:0:48 -export-dynamic -no-undefined -export-symbols-regex
"^rsvg_.*"   -fstack-protector-strong  -o librsvg-2.la -rpath /usr/local/lib  
librsvg_c_api.la -L/usr/local/lib -lpng16 -lcairo-gobject -lgdk_pixbuf-2.0
-lgio-2.0 -lxml2 -lpangocairo-1.0 -lcairo -lpangoft2-1.0 -lpango-1.0
-lgobject-2.0 -lglib-2.0 -lintl -lharfbuzz -lfontconfig -lfreetype  -lm  
libtool: link: /usr/bin/nm -B   ./.libs/librsvg_c_api.a | /usr/bin/sed -n -e
's/^.*[     ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[         ][     
]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p' | /usr/bin/sed '/ __gnu_lto/d' |
/usr/bin/sed 's/.* //' | sort | uniq > .libs/librsvg-2.exp
/usr/bin/nm: error:
./.libs/librsvg_c_api.a(rsvg-44ebdb0941189021.rsvg.623880d2-cgu.0.rcgu.o):
Unknown attribute kind (82) (Producer: 'LLVM15.0.6-rust-1.68.0-stable' Reader:
'LLVM 13.0.0')

/usr/bin/nm: error:
./.libs/librsvg_c_api.a(pangocairo-8fa3a9f2ef17cb23.pangocairo.00c80890-cgu.0.rcgu.o):
Unknown attribute kind (82) (Producer: 'LLVM15.0.6-rust-1.68.0-stable' Reader:
'LLVM 13.0.0')

LLVM ERROR: Type mismatch in constant table!
PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and include the
crash backtrace.
Stack dump:
0.      Program arguments: /usr/bin/nm -B ./.libs/librsvg_c_api.a
 #0 0x00000000007e3879 (/usr/bin/nm+0x7e3879)
 #1 0x00000000007e4443 (/usr/bin/nm+0x7e4443)
 #2 0x0000000824ea07a0 (/lib/libthr.so.3+0x1a7a0)
 #3 0x0000000824e9fdac (/lib/libthr.so.3+0x19dac)
 #4 0x00007fffffffe2d3 ([vdso]+0x2d3)
 #5 0x000000082871914a thr_kill (/lib/libc.so.7+0x14414a)
 #6 0x000000082868a424 _raise (/lib/libc.so.7+0xb5424)
 #7 0x0000000828743ae9 abort (/lib/libc.so.7+0x16eae9)
 #8 0x00000000007d3a73 (/usr/bin/nm+0x7d3a73)
 #9 0x00000000007d3937 (/usr/bin/nm+0x7d3937)
#10 0x00000000006f85c6 (/usr/bin/nm+0x6f85c6)
#11 0x00000000006759f1 (/usr/bin/nm+0x6759f1)
#12 0x0000000000680a76 (/usr/bin/nm+0x680a76)
#13 0x0000000000669d2a (/usr/bin/nm+0x669d2a)
#14 0x0000000000665cac (/usr/bin/nm+0x665cac)
#15 0x000000000078eeaf (/usr/bin/nm+0x78eeaf)
#16 0x000000000063f0b1 (/usr/bin/nm+0x63f0b1)
#17 0x000000000063d172 (/usr/bin/nm+0x63d172)
#18 0x000000000054c17c (/usr/bin/nm+0x54c17c)
Abort trap (core dumped)
libtool: link: /usr/bin/egrep -e "^rsvg_.*" ".libs/librsvg-2.exp" >
".libs/librsvg-2.expT"
libtool: link: mv -f ".libs/librsvg-2.expT" ".libs/librsvg-2.exp"
libtool: link: echo "{ global:" > .libs/librsvg-2.so.2.48.0-ver
```

Disabling lto with LTO_UNSAFE= is a temporary workaround.

-- 
You are receiving this mail because:
You are the assignee for the bug.