Opened 4 years ago

Closed 19 months ago

#61082 closed defect (fixed)

rust @ 1.45.2 -x11 +no_x11 +quartz - build failure with macosx_deployment_target 10.11

Reported by: fredowski Owned by: g5pw (Aljaž Srebrnič)
Priority: Normal Milestone:
Component: ports Version: 2.6.3
Keywords: Cc: herbygillot (Herby Gillot), macdeport, mascguy (Christopher Nielsen)
Port: rust

Description

I try to build rust 1.45.2 on MacOS 10.13.6 (xcode 10.1) with macosx_deployment_target 10.11 set in macports.conf. The build then fails with

          Undefined symbols for architecture x86_64:
            "___isOSVersionAtLeast", referenced from:
                llvm::sys::fs::copy_file(llvm::Twine const&, llvm::Twine const&) in librustc_llvm-d89f2e99b72ea4cc.rlib(Path.cpp.o)
          ld: symbol(s) not found for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

This seems to be the identical problem that occured in upstream

https://github.com/rust-lang/rust/pull/62592#issuecomment-510670657

which ended in this patch in upstream

https://github.com/rust-lang/llvm-project/pull/21

As far as I figured it out this patch is also in the sources in macports but the bug is still there.

The build works when I disable the macosx_deployment_target setting in macports.conf

Change History (14)

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

do we really have that patch in our sources?

seems we must not have it, if we're seeing this error.

comment:2 Changed 4 years ago by fredowski

I looked into the code at "path.inc" after the build stopped and I think I found the patched version. Now I do a test build with the line "--llvm-root" in the Portfile removed. I suspect the code is there but we are not using it.

https://github.com/macports/macports-ports/blob/master/lang/rust/Portfile#L95

comment:3 Changed 4 years ago by mf2k (Frank Schima)

In the future, please add the port maintainer(s) to Cc (port info --maintainers rust), if any.

comment:4 Changed 4 years ago by mf2k (Frank Schima)

Cc: herbygillot added
Owner: set to g5pw
Status: newassigned

comment:5 in reply to:  2 Changed 4 years ago by kencu (Ken)

Replying to fredowski:

I looked into the code at "path.inc" after the build stopped and I think I found the patched version. Now I do a test build with the line "--llvm-root" in the Portfile removed. I suspect the code is there but we are not using it.

https://github.com/macports/macports-ports/blob/master/lang/rust/Portfile#L95

Looks like rust uses our installed version of llvm-9.0, and we certainly do not patch our llvm to disable this call.

That patch is a hack, TBH -- we won't be doing that in our installed llvm version.

So, not sure what to say here. Either you patch your own installed llvm-9.0 with that patch to disable that symbol, or we install a custom llvm-9.0 with that patch for rust to use (yuk), or you build in a 10.11 VM, or ... you don't set a lower depolyment target.

Am I missing any other options?

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

It looks like rust maintains it's own llvm fork, and there are more patches in it than just this one that we are missing.

Perhaps we might have to actually use that llvm fork to support rust.

comment:7 Changed 4 years ago by fredowski

I removed the llvm-9.0 dependency and the patch. Rust can then be installed with macosx_deployment_target 10.11 active in macports.conf. However the regression "port test rust" fails with 2 out of 10223 failed tests:

:info:test ------------------------------------------
:info:test failures:
:info:test     [ui] ui/macros/restricted-shadowing-legacy.rs
:info:test     [ui] ui/wait-forked-but-failed-child.rs
:info:test test result: FAILED. 10223 passed; 2 failed; 68 ignored; 0 measured; 0 filtered out

comment:8 Changed 4 years ago by fredowski

I created a pull request

https://github.com/macports/macports-ports/pull/8259

to fix this problem by using the rust maintained internal llvm version which belongs to the rust release. The above mentioned two failing tests also fail in the unpatched previous version. So I guess this is not related to this change.

comment:9 Changed 3 years ago by macdeport

Cc: macdeport added

comment:10 Changed 3 years ago by herbygillot (Herby Gillot)

In 4c5878867bdeb08e5d8c394a76598343cefd081a/macports-ports (master):

rust: update to 1.50.0

  • Use Rust's LLVM instead of MacPorts. This increases build time, but Rust will now build and run in exactly the way it's meant to.

Fixes: #62395
See: #60943
See: #61082

Co-authored-by: Fabian Deifuß <deifussfabian@…>

comment:11 Changed 3 years ago by herbygillot (Herby Gillot)

Rust is now building using its own custom version of LLVM in MacPorts. I guess we can close this issue?

comment:12 in reply to:  11 ; Changed 3 years ago by macdeport

Replying to herbygillot:

Rust is now building using its own custom version of LLVM in MacPorts. I guess we can close this issue?

Sure. Thank you.

comment:13 Changed 19 months ago by mascguy (Christopher Nielsen)

Cc: mascguy added

comment:14 in reply to:  12 Changed 19 months ago by mascguy (Christopher Nielsen)

Resolution: fixed
Status: assignedclosed

Replying to macdeport:

Replying to herbygillot:

Rust is now building using its own custom version of LLVM in MacPorts. I guess we can close this issue?

Sure. Thank you.

Great, closing issue.

Note: See TracTickets for help on using tickets.