Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#60220 closed defect (fixed)

librsvg @2.48.0_0 +x11: ld: symbol(s) not found for architecture x86_64

Reported by: JDLH (Jim DeLaHunt) Owned by: dbevans (David B. Evans)
Priority: Normal Milestone:
Component: ports Version: 2.6.2
Keywords: elcapitan sierra highsierra Cc: MartinBuchmann (Martin Buchmann), someuser12, thetrial (alabay), dbl001 (dbl), scrallen, michaelthomassullivan, dliessi (Davide Liessi), soyersoyer (soyer)
Port: librsvg

Description

I had librsvg @2.46.0_0 +x11 installed and all was good. Today macports offered an upgrade to librsvg @2.48.0_0 +x11. This fails both port upgrade librsvg and uninstall followed by port install librsvg +x11, with a proximate error:

:info:build libtool: link: /usr/bin/clang -dynamiclib  -o .libs/librsvg-2.2.dylib  librsvg/.libs/2_la-librsvg-features.o librsvg/.libs/2_la-rsvg-base.o librsvg/.libs/2_la-rsvg-handle.o librsvg/.libs/2_la-rsvg-pixbuf.o   -Wl,-force_load,./.libs/librsvg_c_api.a  -L/opt/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 -lfontconfig -lfreetype  -arch x86_64 -Os -arch x86_64 -Wl,-headerpad_max_install_names -arch x86_64 -Wl,-framework -Wl,CoreFoundation   -install_name  /opt/local/lib/librsvg-2.2.dylib -compatibility_version 50 -current_version 50.0 -Wl,-single_module -Wl,-exported_symbols_list,.libs/librsvg-2-symbols.expsym
:info:build ld: warning: text-based stub file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd and library file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation are out of sync. Falling back to library file for linking.
:info:build Undefined symbols for architecture x86_64:
:info:build   "_class_addMethod", referenced from:
:info:build       objc::declare::ClassDecl::root::h023efa98eb61f0b7 in librsvg_c_api.a(objc-15a15e498bf7fadd.objc.egk0pcua-cgu.1.rcgu.o)
:info:build   "_class_addProtocol", referenced from:
:info:build       objc::declare::ClassDecl::add_protocol::h35640417fe0ae7ea in librsvg_c_api.a(objc-15a15e498bf7fadd.objc.egk0pcua-cgu.1.rcgu.o)
...[snip]...
:info:build       _$LT$objc_foundation..string..NSString$u20$as$u20$core..fmt..Debug$GT$::fmt::ha9eacc7792f22b28 in librsvg_c_api.a(objc_foundation-3a461825192df7b7.objc_foundation.70fayurc-cgu.1.rcgu.o)
:info:build       ...
ld: symbol(s) not found for architecture x86_64

Log file /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_librsvg/librsvg/main.log attached.

port install librsvg (without +x11) also failed with a similar error message, but with different details in the debugging log. I think it installed different variants of the ports on which it depended.

This port was recently modified with changeset:64bcddb60dddde212c38be268c22a2c35cbf37fe/macports-ports . This updated the port from upstream version 2.46 to 2.48, and changed rust cross-compilation in a way that I don't know enough to understand.

Attachments (1)

main_port_install_librsvg.log (501.9 KB) - added by JDLH (Jim DeLaHunt) 4 years ago.
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_librsvg/librsvg/main.log

Download all attachments as: .zip

Change History (32)

Changed 4 years ago by JDLH (Jim DeLaHunt)

/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_librsvg/librsvg/main.log

comment:1 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: dbevans removed
Keywords: sierra highsierra added
Owner: set to dbevans
Status: newassigned

Here's confirmation of that build failure from our 10.12 buildbot worker, so it fails at least on 10.12 and 10.13. It succeeded on our 10.14 and 10.15 workers.

comment:2 Changed 4 years ago by kencu (Ken)

for a quick fix, just tweak the system test in the portfile to allow the older, non-rust version.

comment:3 Changed 4 years ago by dyne2meter

fails on 10.11 also

comment:4 Changed 4 years ago by MartinBuchmann (Martin Buchmann)

Cc: MartinBuchmann added

comment:5 Changed 4 years ago by JDLH (Jim DeLaHunt)

The quick fix in comment:3 appears to have worked for me. Thanks!

In the Portfile (path: $(port file librsvg)), I edited lines 58 and 108. Both lines have expressions of the form: … && ${os.major} < 15

I changed the expressions to: … && ${os.major} < 1599

Then did sudo port install librsvg (I had uninstalled earlier, as part of diagnosis. port update might work also.)

I appear to have been able to upgrade other ports, both those dependent on librsvg and those independent of it.

comment:6 Changed 4 years ago by kencu (Ken)

I think perhaps we might just do that force to the older version for most systems.

If someday the newer version is needed, we'll just have to get some kind soul to build it on a newer system with an older deployment target (hopefully) and then install it as a binary on older systems.

no other choice, really, other than fixing rust which is just a bear to hack on....

comment:7 Changed 4 years ago by angelog0 (Angelo Graziosi)

Because this failure, I cannot upgrade other packages. All the following fails:

sudo port clean --all librsvg

sudo port upgrade outdated and not iTerm2 and not poppler and not librsvg
--->  Computing dependencies for librsvg
[...]
--->  Building librsvg
Error: Failed to build librsvg: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_graphics_librsvg/librsvg/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets to report a bug.
sudo port clean --all librsvg

sudo port upgrade ImageMagick libomp libsdl2
--->  Computing dependencies for librsvg
[...]
Error: Follow https://guide.macports.org/#project.tickets to report a bug.

In short, I had to exclude ImageMagick from the upgrade... Maybe there are also other packages to be excluded...

BTW, can you explain the workaround (would be useful as patch file).

Here is macOS 10.13.6.

comment:8 Changed 4 years ago by JDLH (Jim DeLaHunt)

@Angelo: yes, it's frustrating that this problem prevents other ports from updating.

You ask, "can you explain the workaround (would be useful as patch file)". Take a look at comment:5 in this ticket. There are instructions for specific lines in the portfile to edit, and a specific edit to make. It's not a patch file, but it is intended to let you make the patch yourself.

If there's something unclear about comment:5, please let me know and I'll try to be clearer. Ciao!

comment:9 in reply to:  8 Changed 4 years ago by angelog0 (Angelo Graziosi)

Replying to JDLH:

Take a look at comment:5 in this ticket.

I didn't see it...

Anyway, I applied the changes and it installed an older version of librsvd, oldest than the current installed, and it asked to rebuild other packages...

sudo port outdated
[...]
librsvg                        2.46.4_0 < 2.48.0_0

sudo port upgrade librsvg
[...]
--->  Attempting to fetch librsvg-2.40.20.tar.xz from https://distfiles.macports.org/librsvg
--->  Verifying checksums for librsvg
--->  Extracting librsvg
--->  Applying patches to librsvg
--->  Configuring librsvg
--->  Building librsvg
--->  Staging librsvg into destroot
--->  Installing librsvg @2.40.20_3
[...]
--->  Scanning binaries for linking errors
--->  Found 3 broken files, matching files to ports
--->  Found 2 broken ports, determining rebuild order
You can always run 'port rev-upgrade' again to fix errors.
The following ports will be rebuilt:
 ImageMagick @6.9.10-97+rsvg+x11
 emacs-mac-app @7.8+imagemagick+rsvg
[...]

Why not to stick with current installed 2.46.4_0... I would prefer an official fix. Thanks.

comment:10 Changed 4 years ago by JDLH (Jim DeLaHunt)

@Angelo: I'm glad you have your workaround. Great!

The workaround does push librsvg back to version 2.40.20. That is good enough for the ports I use. I am guessing that this version was chosen because it takes librsvg back to before it started using rust the way the current version of librsvg uses rust.

Now as for an official fix, I agree, I would also like to see one also. I get the impression from @kencu in comment:6 that the source of this bug may lie in how the librsvg port uses rust, which is, it appears, difficult to diagnose and fix. I don't know enough to help. So, I will be patient.

comment:11 Changed 4 years ago by someuser12

Cc: someuser12 added

comment:12 Changed 4 years ago by kencu (Ken)

Not so much a bug. Just time marches on, and rust doesn't currently build on some older systems that it used to build on. Next year, the bar will move along further, no doubt.

If the rust maintainer can't fix it to work on older systems (and probably can't, cause it is so hard to hack on) then a version of rust for older systems could be pegged at the last version that did build, and then my guess is that librsvg would probably still be able to be updated. The rust maintainer might do that; many do.

Other package managers for Mac would just say "get lost" as they only support the current three systems.

But all that takes time, and you have things to do, so just do what I suggested above, use the older librsvg (works fine) and move on for today.

If you want to get into helping with this, we would certainly appreciate the assistance! Read about making your own local repository <https://guide.macports.org/chunked/development.local-repositories.html> to get started. It's pretty easy -- dive in! More the merrier (more or less -- there will be plenty of body slams as you learn the ropes, but you have to think of that as part of the fun of participating).

comment:13 Changed 4 years ago by bal-agates

I applied the quick fix from JDLH and it worked great. Thanks! My install of ImageMagick is apparently not dependent on librsvg. My only dependence was for ffmpeg and after getting librsvg built ffmpeg built without issues.

For reference my build was on macOS 10.13.6. Previously I had librsvg installed with a slightly new version 2.44.14_0 than in the fix. I haven't research what the differences are or if I would benefit from modifying the port file more to use the slightly new version. I suspect I will not use the features in ffmpeg that use librsvg.

comment:14 in reply to:  13 Changed 4 years ago by kencu (Ken)

Replying to bal-agates:

I haven't research what the differences are or if I would benefit from modifying the port file more to use the slightly new version. I suspect I will not use the features in ffmpeg that use librsvg.

You have installed the last version of librsvg that your last rust could build, because you used to be able to build librsvg with rust.

Now that you can't build ANY rust version, you fall back to the last version that built without rust.

comment:15 Changed 4 years ago by thetrial (alabay)

Cc: thetrial added

comment:16 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: dbl001 added
Keywords: elcapitan added

Has duplicate #60223.

comment:17 in reply to:  2 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to kencu:

for a quick fix, just tweak the system test in the portfile to allow the older, non-rust version.

If the maintainer selects this as the official fix, then please note that the epoch would also need to be increased.

comment:18 Changed 4 years ago by scrallen

Cc: scrallen added

comment:19 Changed 4 years ago by Gcenx

I can confirm this issue, downgraded to the previous version and it built without issue.

Side Note;
I also had to downgrade cargo also but that's another story

comment:20 Changed 4 years ago by michaelthomassullivan

Cc: michaelthomassullivan added

comment:21 Changed 4 years ago by dliessi (Davide Liessi)

Cc: dliessi added

comment:22 in reply to:  5 Changed 4 years ago by supplanter (Jim)

Awesome! Thanks for the suggestion.

comment:23 Changed 4 years ago by soyersoyer (soyer)

comment:24 in reply to:  23 Changed 4 years ago by dliessi (Davide Liessi)

I updated the port to 2.48.1 and added configure.ldflags-append "-lobjc -framework Security" as suggested in https://gitlab.gnome.org/GNOME/librsvg/-/issues/545#note_686141. The build finished without errors (I haven't tested it, though).

(By the way, with this change -framework Security gets added twice in the command line executed during the port build: any idea why?)

Should the change be applied unconditionally or only on 10.13 and earlier?

comment:25 Changed 4 years ago by soyersoyer (soyer)

The build finished without errors with configure.ldflags-append "-lobjc" too on 10.13.

comment:26 Changed 4 years ago by soyersoyer (soyer)

Cc: soyersoyer added

comment:27 in reply to:  25 ; Changed 4 years ago by dliessi (Davide Liessi)

Replying to soyersoyer:

The build finished without errors with configure.ldflags-append "-lobjc" too on 10.13.

I forgot to say that I'm on 10.13 too.

Ok, so we need only that flag. I'll build again and hopefully test the binary as well.

comment:28 in reply to:  27 Changed 4 years ago by dliessi (Davide Liessi)

I confirm that configure.ldflags-append -lobjc is enough to let the build complete on 10.13 and that the library seems to work correctly. I'll prepare a pull request.

comment:29 Changed 4 years ago by JDLH (Jim DeLaHunt)

Thank you, Davide, for preparing a pull request.

For the benefit of any others using this workaround before the portfile gets fixed, here's the specific way I applied the workaround. It was successful for me on macOS 10.13.6 High Sierra.

In the Portfile (path: $(port file librsvg)), I added two lines after line 95. Lines 93-95 have the configure.args parameter. One added line is a comment, the other is the workaround. After the edit, my new lines 93-97 look like this:

configure.args      --enable-vala=yes \
                    --disable-silent-rules \
                    --disable-Bsymbolic
# @@@ workaround to bug https://trac.macports.org/ticket/60220
configure.ldflags-append "-lobjc"

It may well be that the configure.ldflags-append line could be almost anywhere in the portfile (outside of a block in {} braces), but I don't know portfile syntax well enough to be sure of that.

comment:30 Changed 4 years ago by dliessi (Davide Liessi)

Resolution: fixed
Status: assignedclosed

In 5a26e3b33f814d33c1284c67ca77b7658aca1f12/macports-ports (master):

librsvg: add missing ldflag

Fixes #60220

comment:31 Changed 4 years ago by supplanter (Jim)

I had previously encountered this problem, 3 days ago, on 28 March 2020, via the steps below, but it wasn't until today that I actually fixed the issue:

[Sat 28 Mar root@machost]:~> port selfupdate
[Sat 28 Mar root@machost]:~> port upgrade outdated
                             [encountered problem with librsvg, followed suggestion with comment:5 in this ticket]
[Sat 28 Mar root@machost]:~> port upgrade outdated
                             [everything appeared to upgrade okay]
[Tue 31 Mar user@machost]:~> youtube-dl ...
                             [everything downloaded, but at merge-time, youtube-dl complained that ffmpeg complained that librsvg was the wrong version]
[Tue 31 Mar root@machost]:~> port selfupdate
[Tue 31 Mar root@machost]:~> port -f uninstall librsvg
[Tue 31 Mar root@machost]:~> port clean --dist librsvg
[Tue 31 Mar root@machost]:~> port install librsvg
                             [+x11 comes from /opt/local/etc/macports/variants.conf]
[Tue 31 Mar user@machost]:~> youtube-dl ...
                             [all is well]
Last edited 4 years ago by supplanter (Jim) (previous) (diff)
Note: See TracTickets for help on using tickets.