CORDEA blog

Android applications engineer

GlueLangを動かしてみる。

とりあえず、私のMacでGlueLangのサンプルを動かすまでの話です。
Ubuntuでは上手くいくのですが、私のMacだと始めにちょっとこけたのでメモ。

  • 2015/01/13 追記

 現在はLLVM 6.0でも動作することを確認しました。

GlueLang

 

ryuichiueda/GlueLang · GitHub


Mac OS X (10.9.5)

 

使ってみる

% git clone https://github.com/ryuichiueda/GlueLang/
% cd GlueLang
% make
% ./glue EXAMPLE/if_then_else.glue

私の場合EXAMPLEのfizzbuzz.glueとif_then_else.glueがCommand errorで動作しなかった。

 

こけた原因と対処法

原因

おそらくgccとg++のversion

対処法
% ./glue EXAMPLE/if_then_else.glue

Execution error at line 5, char 3
        line5: ? /usr/bin/true
                 ^
        Command error

        process_level 1
        exit_status 127
        pid 34374

  ...

% brew tap homebrew/versions
% brew install gcc48
% sudo ln -sf /usr/local/bin/gcc-4.8 /usr/bin/gcc
% sudo ln -sf /usr/local/bin/g++-4.8 /usr/bin/g++

% make clean
rm -f glue Arg.o Command.o CommandLine.o Comment.o Element.o Environment.o Feeder.o IfBlock.o Import.o Pipeline.o Script.o TmpFile.o VarString.o main.o /usr/local/bin/glue

% make
g++ -Wall -O3 --static -std=c++11   -c -o Arg.o Arg.cc
g++ -Wall -O3 --static -std=c++11   -c -o Command.o Command.cc
g++ -Wall -O3 --static -std=c++11   -c -o CommandLine.o CommandLine.cc
g++ -Wall -O3 --static -std=c++11   -c -o Comment.o Comment.cc
g++ -Wall -O3 --static -std=c++11   -c -o Element.o Element.cc
g++ -Wall -O3 --static -std=c++11   -c -o Environment.o Environment.cc
g++ -Wall -O3 --static -std=c++11   -c -o Feeder.o Feeder.cc
Feeder.cc: In member function 'int Feeder::countIndent()':
Feeder.cc:476:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while(i < p->size()){
                    ^
g++ -Wall -O3 --static -std=c++11   -c -o IfBlock.o IfBlock.cc
IfBlock.cc: In member function 'virtual int IfBlock::exec()':
IfBlock.cc:136:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<m_nodes.size();i++){
                             ^
g++ -Wall -O3 --static -std=c++11   -c -o Import.o Import.cc
g++ -Wall -O3 --static -std=c++11   -c -o Pipeline.o Pipeline.cc
g++ -Wall -O3 --static -std=c++11   -c -o Script.o Script.cc
g++ -Wall -O3 --static -std=c++11   -c -o TmpFile.o TmpFile.cc
g++ -Wall -O3 --static -std=c++11   -c -o VarString.o VarString.cc
g++ -Wall -O3 --static -std=c++11   -c -o main.o main.cc
g++ -o glue Arg.o Command.o CommandLine.o Comment.o Element.o Environment.o Feeder.o IfBlock.o Import.o Pipeline.o Script.o TmpFile.o VarString.o main.o

% ./glue EXAMPLE/if_then_else.glue
OK
a
OK
OK

 

ここには書いておりませんがgcc,g++のVersionを上げた後、fizzbuzz.glueも正常に動くことを確認しています。

gcc, g++ Version

上げる前
% gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
% g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix

 

上げた後
% gcc --version
gcc (Homebrew gcc48 4.8.3) 4.8.3
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
% g++ --version
g++ (Homebrew gcc48 4.8.3) 4.8.3
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 
 

Ubuntu

普通に動作しているのでversionだけ。

Version

% uname -r
3.16.7-tinycore64
% cat /etc/issue
Ubuntu 14.04.1 LTS \n \l
% gcc --version
gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
% g++ --version
g++ (Ubuntu 4.8.2-19ubuntu1) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.