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

(PA-5640) Fix up Solaris' ffi gem #700

Conversation

cthorn42
Copy link
Collaborator

This PR cleans up a bit of the Solaris FFI gem work around Solaris. We no longer copy over the system libffi and rely on the OpenCSW libffi we install. Also when installing them ffi gem we use the OpenCSW libffi.

This PR cleans up a bit of the Solaris FFI gem work around Solaris. We no
longer copy over the system libffi and rely on the OpenCSW libffi we install.
Also when installing them ffi gem we use the OpenCSW libffi.
@@ -21,6 +21,9 @@
pkg.environment "PATH", "$(shell cygpath -u #{settings[:gcc_bindir]}):$(shell cygpath -u #{settings[:ruby_bindir]}):$(shell cygpath -u #{settings[:bindir]}):/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:$(PATH)"
end

if name =~ /ffi/ && settings[:ruby_version].to_f >= 3.2 && platform.is_solaris?
extra_install_settings = ' -- --enable-system-libffi'
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The libffi thing has confused me for awhile, but I think I'm starting to understand.

Since libffi is a runtime component (as of Ruby 3.2), then we're building and installing it as part of the runtime build. So when components that depend on libffi, like ruby, etc, we should (in general) build against the same version built.

For example, on Solaris 11 Intel, we're installing libffi-dev from OpenCSW, currently version 3.2.1 and we compile against that. But we ship libffi version 3.4.3. Those differences could introduce runtime failures.

Ideally, I think we want to specify the libffi dependency, something like:

gem install ffi-1.15.5.gem --local -- --with-libffi-dir=/opt/puppetlabs/puppet

I think a better option is to tell the gem to use pkg-config to resolve dependencies, something like:

PKG_CONFIG_PATH=/opt/puppetlabs/puppet/lib/pkgconfig:$PKG_CONFIG_PATH gem install ffi-1.15.5.gem --local

Similar to what's being done in https://github.com/ffi/ffi/blob/a480ff6db209713fc73a3dbbb4f1c31a376d6e6a/.github/workflows/ci.yml#L34

I think this might solve the issue @AriaXLi was seeing with the ffi gem on macOS 12 ARM as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trying out the PKG_CONFIG_PATH suggestion, if that builds and completes I'll close this and put up a new PR with that work.

@cthorn42 cthorn42 closed this Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants