Help us understand the problem. What is going on with this article?

ubuntu18.04+mbed(offline)でハマる

More than 1 year has passed since last update.

ハマった状況

ubuntu 18.04上でmbed(offline)環境が構築できない(=コンパイルに失敗する).

最終的にどうしたか?

Docker上にubuntu 16.04 + python2.7 + mbed-cli の環境を構築することで対応.

FROM ubuntu:16.04

RUN apt-get update && \
    apt-get install -y python2.7 python-pip git mercurial && \
    apt-get install -y gcc-arm-none-eabi && \ 
    pip2 install --upgrade pip && \
    apt-get clean

RUN pip2 install mbed-cli jsonschema && \
    mbed toolchain -G GCC_ARM

実験環境

  • ubuntu 18.04(on Windows10 VirtualBox)
  • mbed-cli
  • mbed classic (OS2)のコンパイルがしたい(not Mbed-OS)

テストコード

何の変哲もないLチカです.mbed-cliで新しくプロジェクトを作成し,このコードが一発でコンパイル出来るかで試しました.

#include "mbed.h" 
DigitalOut led1(LED1); 
int main() {
    while (true) {
        led1 = !led1;
        wait(0.5);
    }
} 

実験結果

環境構築は,mbed-cliのページのドキュメントに沿って実施しました.しかしやり方が悪いのか,そういうものなのか,ubunt 16.04 + ython2.7の組み合わせでしか成功しませんでした...

OS Python Result
ubuntu 16.04 python2.7 OK
ubuntu 16.04 python3.6 NG
ubuntu 18.04 python2.7 NG
ubuntu 18.04 python3.6 NG

例えば,ubuntu 18.04 + python3.6だと,コンパイルを実行すると

[mbed] WARNING: If youre using Python 3 with Mbed OS 5.8 and earlier versions, Python errors will occur when compiling, testing and exporting
---
[mbed] Auto-installing missing Python modules...
[ERROR] 'dict' object has no attribute 'has_key'
[mbed] ERROR: "/usr/bin/python3" returned error.
       Code: 1
       Path: "/home/user/Workspace/mbed/blink"
       Command: "/usr/bin/python3 -u /home/user/Workspace/mbed/blink/.temp/tools/make.py -t GCC_ARM -m SSCI824 --source . --build ./BUILD/SSCI824/GCC_ARM"
       Tip: You could retry the last command with "-v" flag for verbose output

とか言われたり,ubuntu 18.04 + python2.7だと

/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/crt0.o: Conflicting CPU architectures 12/1
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/crt0.o
collect2: error: ld returned 1 exit status
[ERROR] /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/crt0.o: Conflicting CPU architectures 12/1
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/crt0.o
collect2: error: ld returned 1 exit status

[mbed] ERROR: "/usr/bin/python" returned error.
       Code: 1
       ...

とか言われたりしてさんざんな感じです.なお後者は ubuntu 18.04 のバグではないか,という情報が上がっているようです.少し調べてはみましたが,自身の手にはおえませんでした.

Mbed-OS(os5)のほうならこうも悩まなくてもよいのでしょうかね...

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした