#65346 closed defect (fixed)

rust PG: can't link librsvg 2.54 on Snow Leopard

Reported by: evanmiller (Evan Miller) Owned by: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Priority: Normal Milestone:
Component: ports Version: 2.7.2
Keywords: snowleopard Cc: mascguy (Christopher Nielsen)
Port: rust librsvg

Description

I just built Rust on 10.6 (!) and am trying to use it to build the librsvg(-devel) port. However I get an assertion error during linking:

:info:build libtool: link: /opt/local/bin/clang-mp-11 -dynamiclib  -o .libs/librsvg-2.2.dylib   -Wl,-force_load,./.libs/librsvg_c_api.a  -framework Foundation -lobjc -L/opt/local/lib /opt/local/lib/libpng16.dylib /opt/local/lib/libcairo-gobject.dylib -lgdk_pixbuf-2.0 -lgio-2.0 /opt/local/lib/libxml2.dylib -lpangocairo-1.0 /opt/local/lib/libcairo.dylib -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 /opt/local/lib/libintl.dylib /opt/local/lib/libharfbuzz.dylib /opt/local/lib/libfontconfig.dylib /opt/local/lib/libfreetype.dylib  -arch x86_64 -Wl,-syslibroot -Wl,/ -arch x86_64   -framework Foundation -pthread -framework ApplicationServices -install_name  /opt/local/lib/librsvg-2.2.dylib -compatibility_version 51 -current_version 51.0 -Wl,-single_module -Wl,-exported_symbols_list,.libs/librsvg-2-symbols.expsym
:info:build Assertion failed: (name != NULL), function Fixup, file src/ld/ld.hpp, line 394.
:info:build 0  0x100001fa0  __assert_rtn + 79
:info:build 1  0x10007564e  ld::Fixup::Fixup(unsigned int, ld::Fixup::Cluster, ld::Fixup::Kind, bool, char const*) + 70
:info:build 2  0x10009015c  mach_o::relocatable::Parser<x86_64>::FixupInAtom::FixupInAtom(mach_o::relocatable::Parser<x86_64>::SourceLocation const&, ld::Fixup::Cluster, ld::Fixup::Kind, bool, char const*) + 30
:info:build 3  0x10009baff  mach_o::relocatable::Parser<x86_64>::addFixup(mach_o::relocatable::Parser<x86_64>::SourceLocation const&, ld::Fixup::Cluster, ld::Fixup::Kind, bool, char const*) + 31
:info:build 4  0x10008882d  mach_o::relocatable::Section<x86_64>::addRelocFixup(mach_o::relocatable::Parser<x86_64>&, macho_relocation_info<Pointer64<LittleEndian> > const*) + 1977
:info:build 5  0x1000a4b2d  mach_o::relocatable::Section<x86_64>::makeFixups(mach_o::relocatable::Parser<x86_64>&, mach_o::relocatable::Parser<x86_64>::CFI_CU_InfoArrays const&) + 75
:info:build 6  0x1000b8a0f  mach_o::relocatable::Parser<x86_64>::parse(mach_o::relocatable::ParserOptions const&) + 1251
:info:build 7  0x1000b8e5f  mach_o::relocatable::Parser<x86_64>::parse(unsigned char const*, unsigned long long, char const*, long, unsigned int, mach_o::relocatable::ParserOptions const&) + 66
:info:build 8  0x100089643  mach_o::relocatable::parse(unsigned char const*, unsigned long long, char const*, long, unsigned int, mach_o::relocatable::ParserOptions const&) + 319
:info:build 9  0x10006ff07  archive::File<x86_64>::makeObjectFileForMember(archive::File<x86_64>::Entry const*) const + 407
:info:build 10  0x100070122  archive::File<x86_64>::forEachAtom(ld::File::AtomHandler&) const + 150
:info:build 11  0x10000db95  ld::tool::InputFiles::forEachInitialAtom(ld::File::AtomHandler&) const + 45
:info:build 12  0x100064e0a  ld::tool::Resolver::buildAtomList() + 38
:info:build 13  0x100066561  ld::tool::Resolver::resolve() + 89
:info:build 14  0x10000b896  main + 220
:info:build clang: error: linker command failed with exit code 1 (use -v to see invocation)
:info:build make[2]: *** [librsvg-2.la] Error 1
:info:build make[2]: Leaving directory `/opt/local/var/macports/build/_Users_emiller_macports.local_graphics_librsvg-devel/librsvg-devel/work/librsvg-2.54.3'

Any ideas? Full log attached.

Attachments (1)

main.log (1.8 MB) - added by evanmiller (Evan Miller) 23 months ago.

Download all attachments as: .zip

Change History (9)

Changed 23 months ago by evanmiller (Evan Miller)

Attachment: main.log added

comment:1 Changed 23 months ago by kencu (Ken)

what linker are you using? 127?

you might need to manually select a newer one, like latest (I only ever use latest).

comment:2 Changed 23 months ago by evanmiller (Evan Miller)

In the log I see

extract compiler_wrapper:  -> Comp Flags: Will embed ' -lobjc -fuse-ld=/opt/local/bin/ld-274' in ld wrapper script

Any tips on changing that?

comment:3 Changed 23 months ago by evanmiller (Evan Miller)

Looks like this flag is added by the Rust PG:

    if { [string match "macports-clang*" [option configure.compiler]] && [option os.major] < 11 } {
        # by default, ld64 uses ld64-127 when 9 <= ${os.major} < 11
        # Rust fails to build when architecture is x86_64 and ld64 uses ld64-127
        depends_build-delete            port:ld64-274
        depends_build-append            port:ld64-274
        depends_skip_archcheck-delete   ld64-274
        depends_skip_archcheck-append   ld64-274
        configure.ldflags-delete        -fuse-ld=${prefix}/bin/ld-274
        configure.ldflags-append        -fuse-ld=${prefix}/bin/ld-274
    }

https://github.com/macports/macports-ports/blob/2e0af51496db5fac79e2ec731d719ecadce5110d/_resources/port1.0/group/rust-1.0.tcl#L747-L756

I think this block needs to be moved so that it only affects builds of Rust and not other ports.

comment:4 Changed 23 months ago by evanmiller (Evan Miller)

Summary: rust @1.61: can't build librsvg 2.54 on Snow Leopardrust PG: can't link librsvg 2.54 on Snow Leopard

comment:5 Changed 23 months ago by kencu (Ken)

Right.

Marcus did that to force 274 even if 127 was defaulted.

Maybe stick a -v in the ldflags there temporarily to see what the error actually is ?

comment:6 Changed 23 months ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

librsvg uses libtool, which does not recognize -fuse-ld (at least not yet).
It is relatively easy to get libtool to recognize -fuse-ld.

A trickier problem is that the Objective-C runtime crate seems to require 10.7 or newer.
The Objective-C runtime crate can be deactivated (along with macos::system_locale, which uses it) since it is only one of several possibilities.
However, it is not pleasant to maintain.
As far as I know, the Rust macro system does not support OS versions.

There is an inelegant pull request that attempts to solve the problem.
However, as I said, it may not be fun to maintain.

comment:7 Changed 23 months ago by kencu (Ken)

you can get past the libtool/ld issue by installing ld64 +ld64_latest I believe, which all users of 10.6 should do anyway, even if we can not yet seem to get the buildbot to install it from bare metal. (once we sort out gcc10-bootstrap -> clang11-bootstrap that is meant to be simpler, by the way).

Last edited 23 months ago by kencu (Ken) (previous) (diff)

comment:8 Changed 23 months ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Resolution: fixed
Status: assignedclosed

In 7a76d596ec40876b4a8aa8d84d5f9135fef779a7/macports-ports (master):

librsvg: allow build on Mac OS X Snow Leopard

Fixes #65346

Note: See TracTickets for help on using tickets.