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

try to move linux arm gnueahibf onto container #29

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

andreamah
Copy link
Contributor

Fixes #24

@andreamah andreamah closed this Jun 7, 2023
@andreamah andreamah reopened this Jun 7, 2023
Copy link

@lex-ibm lex-ibm left a comment

Choose a reason for hiding this comment

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

Just chiming in

Comment on lines 20 to 23
libx11-dev:armhf \
libx11-xcb-dev:armhf \
libxkbfile-dev:armhf \
libsecret-1-dev:armhf \
Copy link

Choose a reason for hiding this comment

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

I don't think these are really needed to build ripgrep. All you actually need is cargo, correct?

Comment on lines 9 to 11
gcc-8-arm-linux-gnueabihf \
g++-8-arm-linux-gnueabihf \
binutils-arm-linux-gnueabihf \
Copy link

Choose a reason for hiding this comment

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

I think this part is already covered by build/install.sh

Comment on lines 3 to 7
sudo sed -i "s/^deb/deb [arch=amd64,i386]/g" /etc/apt/sources.list
echo "deb [arch=arm64,armhf] http://ports.ubuntu.com/ bionic main universe multiverse restricted" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=arm64,armhf] http://ports.ubuntu.com/ bionic-security main universe multiverse restricted" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=arm64,armhf] http://ports.ubuntu.com/ bionic-updates main universe multiverse restricted" | sudo tee -a /etc/apt/sources.list
sudo dpkg --add-architecture armhf
Copy link

Choose a reason for hiding this comment

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

Not really needed, is it?

Copy link

Choose a reason for hiding this comment

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

Is the build/create_container.sh executable? Might be a good idea to add #!/bin/bash and chmod +x build/create_container.sh but that's just a personal preference.

Comment on lines 14 to 17
pkg-config \
fakeroot \
rpm \
sudo \
Copy link

Choose a reason for hiding this comment

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

Are these also needed?

libsecret-1-dev:armhf \
curl \
gnupg \
unzip
Copy link

Choose a reason for hiding this comment

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

I believe what you initially need to install is just nodejs and git, and I think that's pretty much it, after that, /build/install.sh will install cargo.

build/main.yml Outdated
- script: |
set -ex
sudo apt-get install git
sudo apt-get install nodejs
Copy link

Choose a reason for hiding this comment

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

Can you try running without sudo?

@lex-ibm
Copy link

lex-ibm commented Jun 12, 2023

Looks like the container is running rootless, so we can't install sudo or any of the other packages.
From my understanding, we could use the image mentioned in the issue (without having to install any specific packages).
But this needs the VSCodeHub registry set up (I'm external, so I don't know if this repo has the registry setup).
If this repo has access to VSCodeHub to pull images from there, then we can just have:

container: VSCodeHub/vscode-linux-build-agent:centos7-devtoolset8-x64

No need to change x64 or install anything else.

@lex-ibm
Copy link

lex-ibm commented Jun 12, 2023

I'm guessing that's the correct path from https://github.com/microsoft/vscode-linux-build-agent/blob/main/build.yml

@andreamah
Copy link
Contributor Author

Looks like the container is running rootless, so we can't install sudo or any of the other packages. From my understanding, we could use the image mentioned in the issue (without having to install any specific packages). But this needs the VSCodeHub registry set up (I'm external, so I don't know if this repo has the registry setup). If this repo has access to VSCodeHub to pull images from there, then we can just have:

container: VSCodeHub/vscode-linux-build-agent:centos7-devtoolset8-x64

No need to change x64 or install anything else.

I asked about using that container, and the team preferred that I don't rely on it since it might be changing often. Instead, they proposed that I extract what I need from it and run my own container. That's what I'm trying to do here (with my limited container experience)...

@lex-ibm
Copy link

lex-ibm commented Jun 12, 2023

Hmmmm well... you can install nodejs from a binary release, that should not require superuser, but git will.

From what I've read from other issues, it doesn't look like we can install packages on the running container without some more complicated steps. I wrote a PoC using the steps mentioned in the issue above but I don't really feel like that's going a be an accepted solution (too fragile and might change in the future).

I would reconsider using vscode-linux-build-agent:centos7-devtoolset8-x64, or maybe creating another image. Also, as a sidenote, this issue is present in the binary for PowerPC64LE, so it might be in other architectures as well.

@andreamah
Copy link
Contributor Author

Yeah, I would imagine that this is an issue for any non-musl linux releases. I think that I could maybe install packages like they do in zeromq-prebuilt https://github.com/microsoft/zeromq-prebuilt/blob/55d19504bf58b0ff04c7e17f015ad5b6a826bbf3/build/main.yml#L178-L193, but I'm unsure how to cleanly run everything in that container in this case. Would I need to run everything from a script rather than yml file steps?

@lex-ibm
Copy link

lex-ibm commented Jun 13, 2023

Hmmm do you think this will work then?

- job: linux_arm
  pool:
    vmImage: 'ubuntu-latest'
  container:
      image: mcr.microsoft.com/mirror/docker/library/ubuntu:18.04
      options: '--name build-container'
  steps:
    - script: |
        set -ex
        docker exec -t -u root build-container mv /etc/sudoers /etc/sudoers.bak
        docker exec -t -e DEBIAN_FRONTEND=noninteractive -u root build-container apt-get -qq update
        docker exec -t -e DEBIAN_FRONTEND=noninteractive  -u root build-container apt-get -qq install sudo curl git nodejs
        docker exec -t -u root build-container mv /etc/sudoers.bak /etc/sudoers
      displayName: Container Pre-reqs
      target: host
    - template: linux.yml
      parameters:
        target: arm-unknown-linux-gnueabihf

We create the container with the ubuntu:18.04 image and name it build-container, and then on "Container Pre-reqs" we apt update and apt install without changing the /etc/sudoers (this in theory runs docker on the host with target: host). If all succeeds, everything after this runs in the modified container with the packages sudo, git, nodejs, and curl installed.

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.

arm-unknown-linux-gnueabihf enforces a minimum GLIBC
2 participants