wipe ios build artifcats in react native clean project exit 65 - ios

When running either xcodebuild clean
or
using react-native-clean-project which includes a command along with the ios clean commands...
```'rm -rf ios/build && (killall Xcode || true) && xcrun -k && cd ios && xcodebuild -alltargets clean && cd .. && rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache" && rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$(whoami)/ModuleCache" && rm -fr ~/Library/Developer/Xcode/DerivedData/ && rm -fr ~/Library/Caches/com.apple.dt.Xcode/',```
ios build errors with exit code 65 in azure devops or i'm unable to delete the build folder because it was not created by the build system? Is this a permission issue? I use the package above to clean or just regular xcodebuild clean.
IDEPackageSupportUseBuiltinSCM = YES
error: Could not delete `/Users/me/repos/Mobile-App/ios/build` because it was not created by the build system.
note: To mark this directory as deletable by the build system, run `xattr -w com.apple.xcode.CreatedByBuildSystem true /Users/me/repos/Mobile-App/ios/build` when it is created.```
Looking for how to prevent this failure to clean the iOS build with react native.

In my case, mostly code 65 comes because
<your_app>/ios/build still exists.
Solution
rm -rf iod/build and run again
Or you can just copy and paste xattr -w com.apple.xcode.CreatedByBuildSystem true <your_app>/ios/build command above the error message

Related

qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory

I have a Rancher Deskop(dockerd) on M1 MacOS and when I am trying to build below dockerfile I am getting an error such as below. Here is the command how I am trying to build the image docker build -t te-grafana-dashboards-toolchain --no-cache .
I tried to change the platforms but nonae of them worked for me. I am a bit lost about this platform issue for M1 but any help will be appreciated, What I am doing wrong? What might the root cause of this?
Removing intermediate container 70af516d5d6b
---> a69229847153
Step 5/6 : RUN GO111MODULE="on" go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb; ln -s $(go env GOPATH)/bin/jb /usr/bin/jb
---> Running in 13545862fffe
qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory
qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory
Removing intermediate container 13545862fffe
Dockerfile
FROM --platform=linux/amd64 ubuntu:focal
RUN apt update; apt install -y curl jq build-essential python3.8 python3-pip docker-compose jsonnet bison mercurial
RUN ln -s /usr/bin/python3.8 /usr/bin/python
RUN curl -OL https://golang.org/dl/go1.17.linux-amd64.tar.gz; mkdir /etc/golang; tar -xvzf go1.17.linux-amd64.tar.gz -C /etc/golang; ln -s /etc/golang/go/bin/go /usr/bin/go; rm -f go1.17.linux-amd64.tar.gz
RUN GO111MODULE="on" go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb; ln -s $(go env GOPATH)/bin/jb /usr/bin/jb
WORKDIR /workspace
Incidentally, in case it's helpful to another who lands here, I have the same issue on an M1 Max MacBook Pro laptop attempting to do a docker build from a company repo that should be a pretty well traveled path, but I might be the only one (it's a small company) that has an ARM64 M1 "Apple Silicon" Mac. However I found the solution (well, a solution) to my situation was exactly the opposite of the solution to the OP's, and that was to add --platform=linux/amd64 to the FROM line of the docker file.
Otherwise it was using an ARM64 image to start from without me being the wiser but then later in the Dockerfile the build attempts to install and execute code compiled for x86_64. Starting the build process by requesting the base image be linux/amd64 ends up with then the base image having /lib64/ld-linux-x86-64.so.2. This probably means everything is being emulated as x86_64 on the ARM64 CPU via qemu-x86_64 and so if you have the option to start from an ARM64 image and can compile within the container during build time any software you can't install as ARM64 binaries, it'll probably go faster when you later run the container on the M1 based Mac. I'm not able to try that myself just yet for this case.
Modifying Dockerfile seems to be the most popular answer but you can also set the DOCKER_DEFAULT_PLATFORM environment variable to linux/amd64.
export DOCKER_DEFAULT_PLATFORM=linux/amd64
The cause seems to reside in the AArch64 image.
this resolved my issue.
FROM ubuntu:focal
RUN apt update; apt install -y curl jq build-essential python3.8 python3-pip docker-compose jsonnet bison mercurial
RUN ln -s /usr/bin/python3.8 /usr/bin/python
RUN curl -OL https://golang.org/dl/go1.17.linux-arm64.tar.gz; mkdir /etc/golang; tar -xvzf go1.17.linux-arm64.tar.gz -C /etc/golang; ln -s /etc/golang/go/bin/go /usr/bin/go; rm -f go1.17.linux-arm64.tar.gz
RUN GO111MODULE="on" go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb#latest; ln -s /root/go/bin/jb /usr/bin/jb
WORKDIR /workspace
Instead of editing the Dockerfile, as suggested in this answer, or setting an environment variable, as suggested in this answer, I prefer to pass the platform as an argument to the docker build command, with the --platform flag. The command used by the OP would then be:
docker build --platform linux/amd64 -t te-grafana-dashboards-toolchain --no-cache .
Passing following flag to C preprocessor as CPPFLAGS solved similar issue in my M1
-DPNG_ARM_NEON_OPT=0
Pass the value as env var with key CPPFLAGS to relevant service.
Provided the base image includes the target architecture, another option that might work in your case is using Docker's built-in TARGETARCH build arg. This works for me on macOS M1.
FROM ubuntu:focal
ARG TARGETARCH
RUN apt update; apt install -y curl jq build-essential python3.8 python3-pip docker-compose jsonnet bison mercurial
RUN ln -s /usr/bin/python3.8 /usr/bin/python
RUN curl -OL https://golang.org/dl/go1.17.linux-${TARGETARCH}.tar.gz; mkdir /etc/golang; tar -xvzf go1.17.linux-${TARGETARCH}.tar.gz -C /etc/golang; ln -s /etc/golang/go/bin/go /usr/bin/go; rm -f go1.17.linux-${TARGETARCH}.tar.gz
RUN GO111MODULE="on" go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb; ln -s $(go env GOPATH)/bin/jb /usr/bin/jb
WORKDIR /workspace

Docker build for Go project with GitLab private repositories

I am having some issues getting my build to work with dependencies in private GitLab repositories. All-in-all it is a multistage build, but the stage where I am attempting to build my Go project is listed below. This works locally for me, so there is an issue somewhere getting this working in Docker:
FROM golang:1.16.8-alpine3.14 as BuildStage
RUN apk update && apk add --no-cache git ca-certificates tzdata gcc libc-dev openssh-client bash
RUN mkdir /root/.ssh
RUN ssh-keyscan -H gitlab.com >> ~/.ssh/known_hosts
COPY localRsa /root/.ssh/id_rsa
RUN chmod 0400 /root/.ssh/id_rsa
RUN eval $(ssh-agent -s) && ssh-add /root/.ssh/id_rsa
WORKDIR $GOPATH/src/myproject
COPY . .
ENV GOPRIVATE="gitlab.com/MyGitLabUser"
RUN git config --global url."git#gitlab.com".insteadOf "https://gitlab.com"
RUN go mod download
RUN go mod verify
RUN GOOS=linux GOARCH=amd64 \
go build -ldflags='-w -s -extldflags "-static"' -tags musl -a -o /go/bin/mybinary
The error message I get:
go: gitlab.com/MyProject/Sub1/Sub2/some-library#v0.0.6: reading gitlab.com/MyProject/Sub1/Sub2/some-library.git/go.mod at revision v0.0.6: unknown revision v0.0.6
The release definitely exists and is working locally. I am missing a step somewhere.
Update:
Cloning the project works from that stage if I add:
git clone git#gitlab.com:MyProject/Sub1/Sub2/some-library.git
Makes me think I'm missing something in my Go configuration or linking Go with Git.
Issues
After putting together everything that everyone provided here (thanks, by the way). I was able to rework my Dockerfile to do exactly what I needed and get things to work! So first, let me go through and enumerate all of the problems that were in my original submission:
Passing in the SSH key is completely unnecessary (see here - hat tip #RakeshGupta)
Using go mod download -x helped a lot to search out there for more specific information (hat tip #mh-cbon)
I was able to simplify more (see here - hat tip #sytech)
One of the big things was a typo that I fixed, so now it's: git config --global url."git#gitlab.com:".insteadOf "https://gitlab.com/"
Updated Dockerfile
FROM golang:1.16.8-alpine3.14 as BuildStage
# setup Git & SSL (for getting dependencies)
RUN apk update && \
apk add --no-cache git ca-certificates tzdata gcc libc-dev openssh-client && \
update-ca-certificates
ENV GOPRIVATE="gitlab.com/MyProject"
RUN mkdir -p -m 0600 ~/.ssh && ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
RUN git config --global url."git#gitlab.com:".insteadOf "https://gitlab.com/"
# setup an application user
ENV USER=appuser
ENV UID=10001
RUN adduser --disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" "${USER}"
# build the project
WORKDIR $GOPATH/src/myproject
COPY . .
# make sure Go knows the packages are private
RUN go env -w GOPRIVATE="gitlab.com/MyProject/*"
# build the binary
RUN --mount=type=ssh go mod download -x && go mod verify
RUN --mount=type=ssh GOOS=linux GOARCH=amd64 go build -ldflags='-w -s -extldflags "-static"' -tags musl -a -o /go/bin/mybinary
Updated Build Command
So that's cute and all, but I need BuildKit with SSH:
eval "$(minikube docker-env)"
DOCKER_BUILDKIT=1 docker build --ssh default -t myservice:latest .

How should be a dockerfile for a flutter project

I was trying to containerized my flutter project and wanted to make a docker file for the same could anyone help me doing this.
I found the way to make a docker file for the flutter project which is something like this.
FROM ubuntu:18.04
# Prerequisites
RUN apt update && apt install -y curl git unzip xz-utils zip libglu1-mesa openjdk-8-jdk wget
# Set up new user
RUN useradd -ms /bin/bash developer
USER developer
WORKDIR /home/developer
# Prepare Android directories and system variables
RUN mkdir -p Android/sdk
ENV ANDROID_SDK_ROOT /home/developer/Android/sdk
RUN mkdir -p .android && touch .android/repositories.cfg
# Set up Android SDK
RUN wget -O sdk-tools.zip https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
RUN unzip sdk-tools.zip && rm sdk-tools.zip
RUN mv tools Android/sdk/tools
RUN cd Android/sdk/tools/bin && yes | ./sdkmanager --licenses
RUN cd Android/sdk/tools/bin && ./sdkmanager "build-tools;29.0.2" "patcher;v4" "platform-tools" "platforms;android-29" "sources;android-29"
ENV PATH "$PATH:/home/developer/Android/sdk/platform-tools"
# Download Flutter SDK
RUN git clone https://github.com/flutter/flutter.git
ENV PATH "$PATH:/home/developer/flutter/bin"
# Run basic check to download Dark SDK
RUN flutter doctor
this should be your dockerfile inside a flutter-docker folder then create a folder workspace in which you can run your project without any problem.
then create a dockerignore file and mention what are the things you want to ignore like packages and other things.
now make a dev folder and create a file named devcontainer with below code in it.
{
"name": "flutter_docker",
"context": "..",
"dockerFile": "../Dockerfile",
"remoteUser": "developer",
"settings": {
"terminal.integrated.shell.linux": null
},
"runArgs": ["--privileged"],
"extensions": ["dart-code.flutter"],
"workspaceMount": "source=${localWorkspaceFolder}/workspace,target=/home/developer/workspace,type=bind,consistency=delegated",
"workspaceFolder": "/home/developer/workspace"
}
and you can run your flutter program in the same.

How to fix configure error when building a Git repo using docker-compose

I'm trying to build OpenModelica from Git using docker-compose. I've downloaded all the dependencies that they have listed here. Now I'm using their build instructions as a RUN statement, and getting an error when I launch /.configure. The full sequence of commands to execute is
> autoconf
> ./configure CC=clang CXX=clang++
> make -j8
> build/bin/omc --version
> (cd testsuite/partest && ./runtests.pl)
I've tried dropping the clang options from the ./configure step, but that didn't resolve the error.
My Docker file and supporting files are:
Dockerfile
FROM python:3.7
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
COPY pips.txt /code/
COPY gets.txt /code/
RUN pip install -r pips.txt \
&& apt-get update \
&& xargs -a gets.txt apt-get -y install \
&& apt update \
&& apt install -y openscenegraph-3.4
COPY OpenModelica /code/OpenModelica
RUN cd /code/OpenModelica \
&& autoconf \
&& autoreconf -i
RUN cd /code/OpenModelica \
&& ./configure CC=clang-3.8 CXX=clang++-3.8
RUN make -j8 \
&& build/bin/omc --version \
&& (cd testsuite/partest && ./runtests.pl)
COPY . /code/
pips.txt
Django==2.2
psycopg2==2.8.2
gets.txt
...
clang-3.8
clang++-3.8
...
I'm getting these error messages when I launch docker-compose build
ln: failed to create symbolic link '.git/hooks/pre-commit': File exists
which I don't think is a fatal error, then the code continues to execute for a few lines, then
configure: error: no
The full error message in context is
Step 10/12 : RUN cd /code/OpenModelica && ./configure CC=clang-3.8 CXX=clang++-3.8
---> Running in 9da205a757d3
checking for gcc... clang-3.8
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether clang-3.8 accepts -g... yes
checking for clang-3.8 option to accept ISO C89... none needed
checking whether we are using the GNU C++ compiler... yes
checking whether clang++-3.8 accepts -g... yes
checking how to run the C preprocessor... clang-3.8 -E
configure: OpenModelica pre-commit hook has been installed
ln: failed to create symbolic link '.git/hooks/pre-commit': File exists
configure: OpenModelica commit-msg hook has been installed
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
build_short: x86_64-linux-gnu
host_short: x86_64-linux-gnu
checking if cppruntime is requested... no
checking for omlibrary target... core
checking for libraries directory... configure: error: no
I haven't been able to find any useful info on the error since it's so vague. I'm new to Docker, so I'm not sure if it's a Docker thing or something specific to OpenModelica.
The error
checking for libraries directory... configure: error: no
suggests that the folder libraries from submodule OpenModelica/OMLibraries is missing.
How did you clone the OpenModelica repository? You need to clone it recursively with all submodules.
# Faster pulling by using openmodelica.org read-only mirror (low latency in Europe; very important when updating all submodules)
# Replace the openmodelica.org pull URL with https://github.com/OpenModelica/OpenModelica.git if you want to pull directly from github
# The default choice is to push to your fork on github.com (SSH). Replace MY_FORK with OpenModelica to push directly to the OpenModelica repositories (if you have access)
>MY_FORK=MyGitHubUserName ; git clone https://openmodelica.org/git-readonly/OpenModelica.git --recursive && (cd OpenModelica && git remote set-url --push origin git#github.com:$MY_FORK/OpenModelica.git && git submodule foreach --recursive 'git remote set-url --push origin `git config --get remote.origin.url | sed s,^.*/,git#github.com:'$MY_FORK'/,`')
To see the docker files used for building and distributing OpenModelica on various systems you can have a look into OpenModelica/OpenModelicaBuildScripts.

Clean up if any left overs from last build

I have been trying to deploy rocketchat from jenkins. intially I did my own installations for dependencies but now I found the cleanup code given in the tutorial. as fallowing . this code seems inconsistant. I am copying as it is to avoid any confusion. can anyone help incase of corrections as this is failing with syntax errors.
#Clean up if any left overs from last build
SCREEN_RUNNING=’/usr/bin/pgrep SCREEN’
SCREEN_RUNNING fi NODE_RUNNING=’/usr/bin/pgrep node’ ifNODE_RUNNING fi
if [ -f master.zip ]; then rm -f master.zip fi
INSTDIR=./Rocket.Chat-master
if [ -dINSTDIR fi MONDIR=/home/ubuntu/db
if [ -d $MONDIR ]; then rm -Rf /home/ubuntu/db fi pwd
#Install packages we need for the build sudo apt-get install unzip
curl https://install.meteor.com/ | sh
sudo npm install -g n sudo n 0.10.40

Resources