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-4867) Build ruby on Solaris 11 SPARC #706

Merged
merged 2 commits into from
Aug 3, 2023

Conversation

joshcooper
Copy link
Contributor

@joshcooper joshcooper commented Jul 20, 2023

I couldn't find a way to to make solaris-11-sparc platform definition take into
account the project, because of the way vanagon creates the Platform and then
later the Project. So create a new solaris-113-sparc platform definition for
native Solaris compiles.

Since the name of the file contains 113, vanagon assumes that's the
os_version. Setting the os_version from within the platform definition doesn't
seem to work, so I had to special case some logic to check for the
platform.name.

Although we're native compiling on SPARC, we have to explicitly set
--with-baseruby=no so that ruby's configure script does not attempt to use the
ancient ruby already installed. Instead build miniruby and have the build use
that. We should probably be setting --with-baseruby=no always, except in cases
where we're cross compiling to avoid this same problem on other platforms.

Similarly, ruby's configure script will attempt to enable dtrace because the
executable is present. Explicitly disable it.

The ruby-augeas gem's native extensions didn't work, because we were overriding
rbconfig when native compiling. It is only necessary to do that when cross
compiling, because the host ruby running on Solaris Intel needs to override CC,
etc configuration when installing gems with native extensions.

The ruby-shadow gem did work on SPARC, but it was relying on the rbconfig
overrides to find gcc. Instead add pl-build-tools to the PATH and only override
rbconfig when cross compiling.

Built agent-runtime-main in https://jenkins-platform.delivery.puppetlabs.net/view/vanagon-generic-builder/job/platform_vanagon-generic-builder_vanagon-packaging_generic-builder/BUILD_TARGET=solaris-113-sparc,SLAVE_LABEL=k8s-worker/2225/

Please merge https://github.com/puppetlabs/ci-job-configs/pull/9024 after this.

@joshcooper
Copy link
Contributor Author

joshcooper commented Jul 21, 2023

I was able to install the agent tarball on a new host, install facter gem and collect mountpoints which requires ffi:

root@pix-sol11-2:~# gtar zxf agent-runtime-main-202307070.26.g8980a87.solaris-113-sparc.tar.gz 
root@pix-sol11-2:~# mv opt/puppetlabs/ /opt/.
root@pix-sol11-2:~# /opt/puppetlabs/puppet/bin/ruby --version
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [sparc-solaris2.11]
root@pix-sol11-2:~# /opt/puppetlabs/puppet/bin/openssl version
OpenSSL 3.0.9 30 May 2023 (Library: OpenSSL 3.0.9 30 May 2023)
root@pix-sol11-2:~# /opt/puppetlabs/puppet/bin/gem install facter --no-document
Fetching facter-4.4.1.gem
Successfully installed facter-4.4.1
1 gem installed

A new release of RubyGems is available: 3.4.10 → 3.4.17!
Run `gem update --system 3.4.17` to update your installation.

root@pix-sol11-2:~# /opt/puppetlabs/puppet/bin/facter mountpoints
{
  / => {
    available => "91.81 GiB",
    available_bytes => 98575154176,
    capacity => "3.26%",
    device => "rpool/ROOT/solaris",
    filesystem => "zfs",
    options => [
      "dev=4bd0002"
    ],
    size => "94.90 GiB",
    size_bytes => 101894153728,
    used => "3.09 GiB",
    used_bytes => 3318999552
  },

openssl and curl seem good as well:

root@pix-sol11-2:~# /opt/puppetlabs/puppet/bin/curl -s https://www.google.com | head -1
<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="en"><head><meta content="Search the world's information, including webpages, images, videos and more.
...
root@pix-sol11-2:~# echo '' | /opt/puppetlabs/puppet/bin/openssl s_client google.com:443 | tail -5
depth=2 C = US, O = Google Trust Services LLC, CN = GTS Root R1
verify return:1
depth=1 C = US, O = Google Trust Services LLC, CN = GTS CA 1C3
verify return:1
depth=0 CN = *.google.com
verify return:1
DONE
Expansion: NONE
No ALPN negotiated
Early data was not sent
Verify return code: 0 (ok)
---

@joshcooper joshcooper marked this pull request as ready for review July 21, 2023 00:14
@joshcooper joshcooper requested review from a team as code owners July 21, 2023 00:14
@joshcooper joshcooper marked this pull request as draft July 21, 2023 07:06
@joshcooper
Copy link
Contributor Author

To sanity test ruby shadow:

require 'shadow'
Shadow::Passwd.getspent

To sanity test ruby augeas:

require 'augeas'
aug = Augeas.open
aug.match('/augeas/version')
aug.close

@joshcooper joshcooper force-pushed the solaris-sparc-native branch 2 times, most recently from 0927cd4 to 1b6e593 Compare August 1, 2023 22:22
I couldn't find a way to to make solaris-11-sparc platform definition take into
account the project, because of the way vanagon creates the Platform and then
later the Project. So create a new solaris-113-sparc platform definition for
native Solaris compiles.

Since the name of the file contains 113, vanagon assumes that's the
`os_version`. Setting the os_version from within the platform definition doesn't
seem to work, so I had to specialy case some logic to check for the
platform.name.

Although we're native compiling on SPARC, we have to explicitly set
`--with-baseruby=no` so that ruby's configure script does not attempt to use the
ancient ruby already installed. Instead build miniruby and have the build use
that. We should probably be setting `--with-baseruby=no` always, except in cases
where we're cross compiling to avoid this same problem on other platforms.

Similarly, ruby's configure script will attempt to enable `dtrace` because the
executable is present. Explicitly disable it.
The ruby-augeas gem's native extensions didn't work, because we were overriding
rbconfig when native compiling. It is only necessary to do that when cross
compiling, because the host ruby running on Solaris Intel needs to override CC,
etc configuration when installing gems with native extensions.

The ruby-shadow gem did work on SPARC, but it was relying on the rbconfig
overrides to find gcc. Instead add pl-build-tools to the PATH and only override
rbconfig when cross compiling.
@joshcooper
Copy link
Contributor Author

There are no changes to existing platforms. Only solaris-113-sparc is new for agent-runtime-7.x and agent-runtime-main (but the former isn't a supported combination and can be ignored):

$ bx rake vanagon:component_diff -- -P agent-runtime-7.x -m -p all --from 8eb0a73 --to HEAD 

# Here is what your code changes would affect:

## Project `agent-runtime-7.x`

### Platform name: `solaris-113-sparc`
$ bx rake vanagon:component_diff -- -P agent-runtime-main -m -p all --from 8eb0a73 --to HEAD  

# Here is what your code changes would affect:

## Project `agent-runtime-main`

### Platform name: `solaris-113-sparc`

@joshcooper joshcooper marked this pull request as ready for review August 2, 2023 05:03
@cthorn42 cthorn42 merged commit 9b8b735 into puppetlabs:master Aug 3, 2023
2 checks passed
@joshcooper joshcooper deleted the solaris-sparc-native branch August 3, 2023 17:30
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