2021/03/21

M1 mac で Quartus が動いた

動かせた.

「そもそも Intel mac と docker で動かせるのか」と思い, Intel mac で構築しつつ m1 mac でも構築してみたらうまくいってしまった.

注意

  • たまたま自分の環境で動いただけであって他の端末での動作は保証しない
  • 「動いた」のは quartus_sh --flow compile だけで他に動くかは知らない
  • 動作保証外の環境で動くかどうかを楽しむのが目的であって動作することを期待してはならない

環境

Quartus のバージョンが一番影響しているような気がする. 他のバージョンでも試したが動かないこともあった.

  • Quartus-lite-20.1.0.711
  • Docker version 20.10.5, build 55c4c88
  • XQuartz 2.8.0_rc4 (xorg-server 1.19.7)
  • Homebrew 3.0.7
    • Homebrew/homebrew-core (git revision 251dbf0a29; last commit 2021-03-20)
    • Homebrew/homebrew-cask (git revision 6a506eefa6; last commit 2021-03-20)

X11 環境構築

参考そのままなので省略. brew で XQuartz をインストールして, 環境設定でセキュリティの許可. xhost の追加を行うだけ.

Docker 構築

ちゃんと Dockerfile 作った.

Dockerfile

FROM --platform=linux/amd64 ubuntu:18.04

RUN apt-get update && \
    apt-get install -y xserver-xorg x11-apps \
    locales

RUN apt-get -y --no-install-recommends install libtcmalloc-minimal4

RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \
    locale-gen en_US.UTF-8 && \
    /usr/sbin/update-locale LANG=en_US.UTF-8

ビルド

$ docker build -t quartus-ubuntu .

作業ディレクトリを用意してそこに Quartus のインストーラを配置.

workdir
├── installer
│   ├── Quartus-lite-20.1.0.711-linux.tar
│   ├── components
│   │   ├── ModelSimSetup-20.1.0.711-linux.run
│   │   ├── QuartusHelpSetup-20.1.0.711-linux.run
│   │   ├── QuartusLiteSetup-20.1.0.711-linux.run
│   │   ├── arria_lite-20.1.0.711.qdz
│   │   ├── cyclone-20.1.0.711.qdz
│   │   ├── cyclone10lp-20.1.0.711.qdz
│   │   ├── cyclonev-20.1.0.711.qdz
│   │   ├── max-20.1.0.711.qdz
│   │   ├── max10-20.1.0.711.qdz
│   ├── readme.txt
│   ├── setup.sh
└── intelFPGA_lite

Quartus のインストールのためにコンテナに入ってインストール. あとで足りないライブラリの環境変数 (LD_PRELOAD) を追加するが, ここで追加してしまうとインストーラがセグフォする.

workdir$ docker run --rm -it -e DISPLAY=$(hostname):0 \
    -v ~/.Xauthority:/root/.Xauthority \
    -v $(pwd)/installer:/usr/local/installer \
    -v $(pwd)/intelFPGA_lite:/root/intelFPGA_lite \
    quartus-ubuntu

コンテナ内でインストーラ起動. いつものインストーラが動いて, インストールが完了する.

root# /usr/local/installer/setup.sh

幾度となく見たインストーラ画面.

インストール完了後, 動かすためのセットアップが必要.

環境変数を追加. これは Intel mac でも必須だった.

root# export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4

<インストール場所>/quartus/adm/qenv.sh が余計なエラーを吐いているみたいなので該当部分(l.96-109)をコメントアウト. 見たところ動作保証のチェックだけっぽい.

# We don't support processors without SSE extensions (e.g. Pentium II and older CPUs).
# cpumodel=`grep 'model name' /proc/cpuinfo | sed -e's/model name.*: //g' | uniq`
# export cpumodel="$cpumodel"
# grep sse /proc/cpuinfo > /dev/null 2>&1
# if test $? != 0 ; then
#     echo ""
#     echo "The Quartus II software is optimized for the Intel Pentium III processor"
#     echo "and newer processors.  The required extensions were not found on:"
#     echo "'$cpumodel'"
#     echo ""
#     echo "The Quartus II software will not function properly on this processor model."
#     echo "Terminating..."
#     export QENV_STATUS=-1
# fi

で起動. 1回目は起動せずターミナルも返って来なかったので, 強制終了してみたら2回目はうまくいった.

root# /root/intelFPGA_lite/20.1/quartus/bin/quartus

とりあえずコンパイル (quartus_sh --flow compile) だけは通った. 56 ALMs のコンパイルに10分もかかったので使い物にはならない. 素直に対象のOSを使おう.

また ModelSim は起動しようとしたらライセンスがないのか以下のエラーになった.

Info: *******************************************************************
Info: Running Quartus Prime Shell
    Info: Version 20.1.0 Build 711 06/05/2020 SJ Lite Edition
~~~
    Info: Processing started: Sun Mar 21 06:27:42 2021
Info: Command: quartus_sh -t /root/intelFPGA_lite/20.1/quartus/common/tcl/internal/nativelink/qnativesim.tcl --rtl_sim FIB FIB
Info: Quartus(args): --rtl_sim FIB FIB
Info: Info: Start Nativelink Simulation process
Info: Info: NativeLink has detected VHDL design -- VHDL simulation models will be used
Info: Info: Starting NativeLink simulation with ModelSim-Altera software
Error: Error: Can't launch ModelSim-Altera Simulation software -- make sure the software is properly installed and the environment variable LM_LICENSE_FILE or MGLS_LICENSE_FILE points to the correct license file.
Error: Error: NativeLink simulation flow was NOT successful
Info: Info: For messages from NativeLink scripts, check the file /usr/local/src/FIB/FIB_nativelink_simulation.rpt File: /usr/local/src/FIB/FIB_nativelink_simulation.rpt Line: 0
Error (23031): Evaluation of Tcl script /root/intelFPGA_lite/20.1/quartus/common/tcl/internal/nativelink/qnativesim.tcl unsuccessful
Error: Quartus Prime Shell was unsuccessful. 3 errors, 0 warnings
    Error: Peak virtual memory: 536 megabytes
    Error: Processing ended: Sun Mar 21 06:27:48 2021
    Error: Elapsed time: 00:00:06
    Error: Total CPU time (on all processors): 00:00:01

参考

0 件のコメント:

コメントを投稿