Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong arch for ffi and nokogiri native extensions on macOS 12 ARM #846

Closed
joshcooper opened this issue May 8, 2024 · 2 comments
Closed
Labels
bug Something isn't working triaged Jira issue has been created for this

Comments

@joshcooper
Copy link
Contributor

joshcooper commented May 8, 2024

Describe the Bug

The nokogiri and ffi gems are shipped in the runtime. When cross-compiling on macOS 12 Intel for ARM, the resulting native extensions have the wrong arch x86_64. They should be arm64. Since ffi is unusable, the facter mountpoints fact is empty.

Expected Behavior

All binaries (including .dylib and .bundle) should be compiled for arm64 and facter mountpoints should be populated.

Steps to Reproduce

# curl -sLO https://downloads.puppet.com/mac/puppet8/12/arm64/puppet-agent-8.6.0-1.osx12.dmg
# hdiutil attach -quiet puppet-agent-8.6.0-1.osx12.dmg 
# installer -pkg /Volumes/puppet-agent-8.6.0-1.osx12/puppet-agent-8.6.0-1-installer.pkg -target /
installer: Package name is puppet-agent
installer: Installing at base path /
installer: The install was successful.
# /opt/puppetlabs/puppet/bin/facter os
{
  architecture => "arm64",
  family => "Darwin",
  hardware => "arm64",
  macosx => {
    build => "21F79",
    product => "macOS",
    version => {
      full => "12.4",
      major => "12",
      minor => "4",
      patch => "0"
    }
  },
  name => "Darwin",
  release => {
    full => "21.5.0",
    major => "21",
    minor => "5"
  }
}
# /opt/puppetlabs/puppet/bin/facter mountpoints -d
[2024-05-07 21:44:13.086863 ] INFO Facter - executed with command line: mountpoints -d 
[2024-05-07 21:44:13.086942 ] DEBUG Facter - Facter version: 4.7.0 
[2024-05-07 21:44:13.091116 ] DEBUG Facter::FactManager - Resolving facts sequentially 
[2024-05-07 21:44:13.091216 ] DEBUG Facter::FactLoader - Loading all internal facts 
[2024-05-07 21:44:13.091665 ] DEBUG Facter::FactLoader - Loading custom facts 
[2024-05-07 21:44:13.092705 ] DEBUG Facter::FactLoader - Loading external facts 
[2024-05-07 21:44:13.094064 ] DEBUG Facter::QueryParser - List of resolvable facts: [#<Facter::SearchedFact:0x000000010535d850 @name="mountpoints", @fact_class=Facts::Macosx::Mountpoints, @user_query="mountpoints", @type=:core, @file=nil>] 
[2024-05-07 21:44:13.102325 ] DEBUG Facter::Resolvers::Macosx::Mountpoints - Could not read mounts: dlopen(/opt/puppetlabs/puppet/lib/ruby/gems/3.2.0/gems/ffi-1.15.5/lib/ffi_c.bundle, 0x0009): tried: '/opt/puppetlabs/puppet/lib/ruby/gems/3.2.0/gems/ffi-1.15.5/lib/ffi_c.bundle' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')) - /opt/puppetlabs/puppet/lib/ruby/gems/3.2.0/gems/ffi-1.15.5/lib/ffi_c.bundle 
[2024-05-07 21:44:13.102413 ] DEBUG Facter::FactManager - fact "mountpoints" has resolved to: {} 

The following have the wrong arch:

# find /opt/puppetlabs/puppet/lib -type f -name *.bundle -exec file {} \; | grep -v arm64
/opt/puppetlabs/puppet/lib/ruby/gems/3.2.0/gems/nokogiri-1.14.2/lib/nokogiri/nokogiri.bundle: Mach-O 64-bit bundle x86_64
/opt/puppetlabs/puppet/lib/ruby/gems/3.2.0/gems/ffi-1.15.5/lib/ffi_c.bundle: Mach-O 64-bit bundle x86_64

Environment

  • Version: puppet-agent 8.6.0 only
  • Platform: macOS 12 ARM only

macOS Intel and 13 and 14 ARM are unaffected, because we don't cross compile.

puppet-agent 8.5.0 and 7.30.0 don't have this issue:

# curl -sLO https://downloads.puppet.com/mac/puppet8/12/arm64/puppet-agent-8.5.0-1.osx12.dmg
# hdiutil attach -quiet puppet-agent-8.5.0-1.osx12.dmg 
# find /opt/puppetlabs/puppet/lib -type f -name *.bundle -exec file {} \; | grep -v arm64
# /opt/puppetlabs/puppet/bin/facter mountpoints
{
  / => {
    available => "63.31 GiB",
    available_bytes => 67981316096,
    capacity => "25.08%",
@joshcooper joshcooper added the bug Something isn't working label May 8, 2024
@joshcooper joshcooper mentioned this issue May 8, 2024
8 tasks
@joshcooper joshcooper added the triaged Jira issue has been created for this label May 8, 2024
Copy link

github-actions bot commented May 8, 2024

Migrated issue to PA-6422

@joshcooper
Copy link
Contributor Author

Fixed in #847

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triaged Jira issue has been created for this
Projects
None yet
Development

No branches or pull requests

1 participant