2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

DartAdvent Calendar 2021

Day 7

ARM Linux 用に Dart 実行環境を作る

Last updated at Posted at 2021-12-19

概要

Dart SDK は ARM をサポートしていますが、Dart の 公式ページに記載の方法では、ARMベースの Linux に Dart SDK を Install する事ができませんでした。

$ apt-get install apt-transport-https -y
$ sh -c 'wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
$ sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
$ apt-get update
$ apt-get install dart -y
#16 0.158 Reading package lists...                                                                                       
#16 0.452 Building dependency tree...
#16 0.522 Reading state information...
#16 0.528 E: Unable to locate package dart

といった感じになります。

$ cat /etc/apt/sources.list.d/dart_stable.list 
deb [arch=amd64] https://storage.googleapis.com/download.dartlang.org/linux/debian stable main

とのことから、dart_stable.list に インテル向けの設定しか入ってないのが原因です。

この記事ではARMベースのLinux で Dart SDK を Install する方法について解説します。

ARM Linux 環境

先に ARM64 向けの環境でCode-Server(VSCode)x Dart の環境を示します

Dockerfile

FROM ubuntu:21.04

# UNUSE INTERACTIVE
ENV DEBIAN_FRONTEND="nonintractive"

# INSTALL PACKAGE FOR CODE-SERVER AND DART
RUN apt-get update -y && apt-get install -y openssl zip unzip git
RUN apt-get install  -y curl wget gnupg less lsof net-tools git apt-utils

# MY FAVO
RUN apt-get install -y emacs

WORKDIR /app

#
# Install Code-Server
# IF INTEL
# COPY ./res/code-server_4.0.0_amd64.deb /app/code-server_4.0.0_amd64.deb
# RUN dpkg -i code-server_4.0.0_amd64.deb
# IF ARM
COPY ./res/code-server_4.0.0_arm64.deb /app/code-server_4.0.0_arm64.deb
RUN dpkg -i code-server_4.0.0_arm64.deb


#
# Install Dart Env
# IF INTEL You can use dep package
#  RUN apt-get install apt-transport-https -y
#  RUN sh -c 'wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
#  RUN sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
#  RUN apt-get update
#  RUN apt-get install dart -y
#  ENV PATH="${PATH}:/usr/lib/dart/bin/"
#  ENV PATH="${PATH}:/root/.pub-cache/bin"
# 
# IF ARM
COPY ./res/dartsdk-linux-arm64-release.zip /app/dartsdk-linux-arm64-release.zip
RUN unzip dartsdk-linux-arm64-release.zip -d /usr/local/ 

ENV PATH="${PATH}:/usr/local/dart-sdk/bin/"
ENV PATH="${PATH}:/root/.pub-cache/bin"

# IF USE WEBDEV OR STAGEHAND
# RUN dart pub global activate webdev
# RUN dart pub global activate stagehand


# [HOW TO BUILD AND START]
# - BUILD
# docker build -t  dart_codeserver .
# - RUN  
# docker run -p8080:8080 -p3030:3030 -it dart_codeserver bash 
# code-server --port=8080  --host=0.0.0.0 --auth=none
# open http0::/0.0.0.0:8080 from browser
# 


# MEMO
# 
# https://sourceware.org/bugzilla/show_bug.cgi?id=14341
# 

res 配下に、Code-Server と Dart-SDK を前もってDownloadしておいて、

$ docker build --platform="linux/arm64" -t  dart_codeserver .
$ docker run --platform="linux/arm64" -p8080:8080 -it dart_codeserver bash
$ code-server --port=8080  --host=0.0.0.0 --auth=none

とすると、ブラウザーからアクセスできます

スクリーンショット 2021-12-19 19.09.49.png

何をしたか

ARM上のLinuxで動作するDART SDK が欲しい場合は、debパッケージは諦めて、SDK
をアーカイブ(https://dart.dev/get-dart/archive) から取得して それを利用しましょう!!

終わり

2
1
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?