Opened 4 months ago

Closed 7 weeks ago

Last modified 7 weeks ago

#69138 closed defect (fixed)

rust @1.75.0 : Does not build on macOS 10.11.6 - missing _getentropy and _clock_gettime

Reported by: snowflake (Dave Evans) Owned by: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Priority: Normal Milestone:
Component: ports Version: 2.8.99
Keywords: Cc: mascguy (Christopher Nielsen), mqudsi (Mahmoud Al-Qudsi), joostdekeijzer (joost de keijzer), Dave-Allured (Dave Allured), sambthompson (Sam Thompson)
Port: rust

Description

Here's the error:

:info:build           Undefined symbols for architecture x86_64:
:info:build             "_getentropy", referenced from:
:info:build                 std::sys::unix::rand::imp::fill_bytes::h1e6f730ecd7d963f in std-35a9205a1c5a5
e53.std.d632d37dc9be385b-cgu.13.rcgu.o
:info:build             "_clock_gettime", referenced from:
:info:build                 std::sys::unix::time::Timespec::now::h767a5632f4dda4a4 (.llvm.219440299164370
3167) in std-35a9205a1c5a5e53.std.d632d37dc9be385b-cgu.11.rcgu.o
:info:build           ld: symbol(s) not found for architecture x86_64
:info:build           clang: error: linker command failed with exit code 1 (use -v to see invocation)
:info:build  

I will also upload the last 100 lines of the log which show linker warnings. There are a lot of them but I don't think it is affecting the build.

Attachments (2)

rust.log (33.4 KB) - added by snowflake (Dave Evans) 4 months ago.
Last 100 lines of the log.
main.log (688.6 KB) - added by sambthompson (Sam Thompson) 7 weeks ago.
install attempt on 10.11.6 after application of PR 79

Download all attachments as: .zip

Change History (22)

Changed 4 months ago by snowflake (Dave Evans)

Attachment: rust.log added

Last 100 lines of the log.

comment:1 Changed 4 months ago by rmottola (Riccardo)

I have the same issue on 10.7 Several linker items, but also the same symbols missing. I bet it affects more systems, but currently 10.5 and 10.6 bail out on rust due to compile errors, so they don't get to linking.

Do we have an entropy fallback in LegacySupport?

:info:build           ld: warning: cannot export hidden symbol ___udivti3 from /opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.osx.a(udivti3.c.o)
:info:build           ld: warning: cannot export hidden symbol ___umoddi3 from /opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.osx.a(umoddi3.c.o)
:info:build           ld: warning: cannot export hidden symbol ___umodsi3 from /opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.osx.a(umodsi3.c.o)
:info:build           ld: warning: cannot export hidden symbol ___umodti3 from /opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.osx.a(umodti3.c.o)
:info:build           Undefined symbols for architecture x86_64:
:info:build             "_getentropy", referenced from:
:info:build                 std::sys::unix::rand::imp::fill_bytes::h1e6f730ecd7d963f in std-35a9205a1c5a5e53.std.d632d37dc9be385b-cgu.13.rcgu.o
:info:build             "_clock_gettime", referenced from:
:info:build                 __ZN3std3sys4unix4time8Timespec3now17h767a5632f4dda4a4E.llvm.6669113470407685218 in std-35a9205a1c5a5e53.std.d632d37dc9be385b-cgu.11.rcgu.o

comment:2 Changed 4 months ago by mascguy (Christopher Nielsen)

Cc: mascguy added

comment:3 Changed 4 months ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

It would seem we need to add more symbols in legacy-support so that rust-bootstrap finds them.
I am running experiments now.
Unfortunately, these ports take quite a while to build.

comment:4 Changed 4 months ago by mqudsi (Mahmoud Al-Qudsi)

FYI this was caused by upstream deprecating support for anything before macOS (née OS X) 10.12.

This commit is responsible for this particular issue: https://github.com/rust-lang/rust/commit/090e9de5708388a21d66adbec91c871a48ac355e

A compatibility shim for getentropy(3)/_getentropy() would be the ideal way to go, but a patch reverting that commit would also work.

comment:5 Changed 4 months ago by mqudsi (Mahmoud Al-Qudsi)

Cc: mqudsi added

comment:6 Changed 3 months ago by rmottola (Riccardo)

I have this issue also on 10.6 32bit now...

I wonder if there is a decent way to have getentropy: that is a shim that does something equivalent?

comment:8 Changed 3 months ago by kencu (Ken)

Getting stuff to use the additional symbols in legacysupport takes a variable amount of work.

One way that might be needed here is to relink the binary against the libSystem.dylib from LegacySupport that re-exports the additional symbols that legacysupport provides, in addition to all the standard stuff in the system's libsystem.

All this has been done already, of course -- but things change, new versions of stuff comes out, blah blah, and things need to be looked at again to see that they still work right.

comment:9 in reply to:  4 Changed 3 months ago by rmottola (Riccardo)

Replying to mqudsi:

FYI this was caused by upstream deprecating support for anything before macOS (née OS X) 10.12.

This commit is responsible for this particular issue: https://github.com/rust-lang/rust/commit/090e9de5708388a21d66adbec91c871a48ac355e

A compatibility shim for getentropy(3)/_getentropy() would be the ideal way to go, but a patch reverting that commit would also work.

oh, that is nasty... it hampers so many good systems... I tried applying the patch you mentioned reverse and compilation fails futher:

          Undefined symbols for architecture i386:
            "_clock_gettime", referenced from:
                std::sys::unix::time::Timespec::now::h30810a3321b633c8 (.llvm.16531347933994784664) in std-0d102736d5b7d56a.std.5eedb8253ab94e49-cgu.12.rcgu.o
          ld: symbol(s) not found for architecture i386

Do we have that in legacy support?

comment:10 in reply to:  7 Changed 3 months ago by rmottola (Riccardo)

Replying to kencu:

How about we add it to legacysupport?

Oh, wait ...

https://github.com/macports/macports-legacy-support/blob/3631c1f36ff8f9e7f284ce4e15be7ea659e8cc1a/src/getentropy.c#L65

oh indeed and at a glance it really looks taken from the code rust removed...

But there is no update to legacysupport yet? how is macports-legacy-support working?

comment:11 Changed 2 months ago by joostdekeijzer (joost de keijzer)

Cc: joostdekeijzer added

comment:12 Changed 2 months ago by Dave-Allured (Dave Allured)

Cc: Dave-Allured added

comment:13 Changed 8 weeks ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

There is a pull request that attempts to fix this problem.

comment:14 Changed 7 weeks ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Resolution: fixed
Status: assignedclosed

In 61263ec78abd167db3a6e41063bb29e60ddcd32c/macports-legacy-support (master):

support more symbols when deployment target < system

Add getentropy & clock_gettime to library so that
MACOSX_DEPLOYMENT_TARGET is respected.

Fixes #69138

comment:15 Changed 7 weeks ago by sambthompson (Sam Thompson)

I might be doing something wrong, but this fix isn't working for me on 10.11.6. I have ensured the PR#79 changes that have landed in legacy-support-devel via PR 23300 are active on my MacPorts environment (by checking include header changes are in place in /opt/local/include and forcing a build from source with -s, just to be sure).

Log from port upgrade -t rust attached.

Changed 7 weeks ago by sambthompson (Sam Thompson)

Attachment: main.log added

install attempt on 10.11.6 after application of PR 79

comment:16 Changed 7 weeks ago by sambthompson (Sam Thompson)

Cc: sambthompson added

comment:17 in reply to:  15 ; Changed 7 weeks ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Replying to sambthompson:

I might be doing something wrong, but this fix isn't working for me on 10.11.6. I have ensured the PR#79 changes that have landed in legacy-support-devel via PR 23300 are active on my MacPorts environment (by checking include header changes are in place in /opt/local/include and forcing a build from source with -s, just to be sure).

Log from port upgrade -t rust attached.

Some of the fixes have not quite made it into released versions of the ports.
To be 100% "fixed," a few things have to happen.
For systems < 10.8, a bug has to be fixed in the legacy-support port.
Either install legacy-support-devel or wait until the next version of legacy-support.
Wait until rust is updated.

Sorry for the delay, but Rust is a bit tricky to maintain for systems < 10.12.

Last edited 7 weeks ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez) (previous) (diff)

comment:18 in reply to:  17 Changed 7 weeks ago by sambthompson (Sam Thompson)

Replying to MarcusCalhoun-Lopez:

Sorry for the delay, but Rust is a bit tricky to maintain for systems < 10.12.

Not at all! Sorry, I didn't understand there was also a change required on the rust side; I was only using the latest legacy-support-devel. Will try again once the update PRs have gone through.

I really appreciate that MacPorts continues to support these legacy OS versions, despite the effort involved.

Last edited 7 weeks ago by sambthompson (Sam Thompson) (previous) (diff)

comment:19 Changed 7 weeks ago by Christopher Nielsen <mascguy@…>

In 3371b439e58e5dfb6a3742f321e69b7489285290/macports-ports (master):

legacy-support: update to v1.2.2

  • dirfuncs_compat: Add comment regarding retention
  • sysconf(_SC_PHYS_PAGES): Always use wrapper on i386
  • sys/socket.h: Fix CMSG_DATA definition in <10.6
  • Add test for os/lock.h
  • Add more library symbols for Rust support

See: https://github.com/macports/macports-ports/pull/23232
See: #69138

comment:20 Changed 7 weeks ago by sambthompson (Sam Thompson)

Confirmed Rust 1.77.1 now builds on 10.11.6. Many, many thanks to Marcus and other testers for this; looks like this rust upgrade needed a lot of work, not just on legacy-support.

Note: See TracTickets for help on using tickets.