接続数

COUNTER267309FROM 2012/5/16

MISRA-C diary(C言語日誌)

MISRA-C >> 記事詳細

2017/09/12

brew install llvm

Tweet ThisSend to Facebook | by kaizen
brew install llvm
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (caskroom/cask, homebrew/core).
==> New Formulae
ampl-mp                    gmt                        ncview
apibuilder-cli             go@1.8                     nlopt
braid                      gomplate                   opencv@2
brainfuck                  gopass                     ott
clblas                     gromacs                    packmol
clfft                      hypre                      pcb
clinfo                     igraph                     pcl
clojure                    jupyter                    pdfsandwich
cppad                      lean                       pony-stable
credstash                  libbitcoin                 root@5
cryfs                      libbitcoin-explorer        s-nail
datamash                   libmatio                   stubby
docfx                      libxlsxwriter              sundials
erlang@17                  llvm@4                     telnet
frugal                     marathon-swift             trash-cli
geth                       mimic                      xtensor
gmsh                       nco
==> Updated Formulae
abcm2ps                                  jmxtrans
abcmidi                                  jpeg-turbo
ace                                      json-c
acmetool                                 json-fortran
activemq                                 jsoncpp
advancecomp                              juju
afl-fuzz                                 julius
agda                                     jvgrep
agedu                                    kibana
akamai                                   kitchen-sync
alexjs                                   klavaro
algernon                                 knot
allure                                   kompose

(中略)                                   

jenkins                                  zbar
jenkins-job-builder                      zimg
jenkins-lts                              zsh
jfrog-cli-go                             zsh-syntax-highlighting
jhipster                                 zstd
==> Renamed Formulae
fbida -> exiftran          gtef -> tepl               root6 -> root
gmt4 -> gmt@4              opencv3 -> opencv          srtp@1.5 -> srtp@1.6
==> Deleted Formulae
abi-compliance-checker     go-gui                     phantomjs@1.92
gh                         kafka@0.80                 phantomjs@1.98
Warning: Calling BottleSpecification.revision is deprecated!
Use BottleSpecification.rebuild instead.
/usr/local/Homebrew/Library/Taps/pizzafactory/homebrew-toppers_open/toppers-ngk-cfg109.rb:11:in `block in <class:ToppersNgkCfg109>'
Please report this to the pizzafactory/toppers_open tap!

Error: Calling BottleSpecification#sha1 is disabled!
Use BottleSpecification#sha256 instead.
/usr/local/Homebrew/Library/Taps/pizzafactory/homebrew-toppers_open/toppers-ngk-cfg109.rb:12:in `block in <class:ToppersNgkCfg109>'
Please report this to the pizzafactory/toppers_open tap!
If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):
  https://github.com/pizzafactory/homebrew-toppers_open/issues
==> Downloading https://homebrew.bintray.com/bottles/llvm-5.0.0.yosemite.bottle.
######################################################################## 100.0%
==> Pouring llvm-5.0.0.yosemite.bottle.tar.gz
==> Caveats
To use the bundled libc++ please add the following LDFLAGS:
  LDFLAGS="-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib"

This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.bash_profile

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/llvm/lib
    CPPFLAGS: -I/usr/local/opt/llvm/include


If you need Python to find bindings for this keg-only formula, run:
  echo /usr/local/opt/llvm/lib/python2.7/site-packages >> /usr/local/lib/python2.7/site-packages/llvm.pth
  mkdir -p /Users/ogawakiyoshi/.local/lib/python3.6/site-packages
  echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/ogawakiyoshi/.local/lib/python3.6/site-packages/homebrew.pth
==> Summary
  /usr/local/Cellar/llvm/5.0.0: 2,478 files, 1.2GB

---
環境変数の設定
----

vi ./.bash_profile

export PATH="/usr/local/opt/llvm/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/llvm/lib"
export CPPFLAGS="-I/usr/local/opt/llvm/include"

---
printenv

LDFLAGS=-L/usr/local/opt/llvm/lib

CPPFLAGS=-I/usr/local/opt/llvm/include

PATH=/usr/local/opt/llvm/bin:/Users/ogawakiyoshi/.pyenv/shims:/Users/ogawakiyoshi/.opam/system/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/texbin:/Applications/Wireshark.app/Contents/MacOS

----
 ./cvfiles utf8 unix
./cvfiles: line 12: nkf: command not found
./cvfiles: line 12: nkf: command not found
./cvfiles: line 12: nkf: command not found
./cvfiles: line 12: nkf: command not found
./cvfiles: line 12: nkf: command not found
./cvfiles: line 12: nkf: command not found
./cvfiles: line 12: nkf: command not found
./cvfiles: line 12: nkf: command not found
./cvfiles: line 12: nkf: command not found
./cvfiles: line 12: nkf: command not found
./cvfiles: line 12: nkf: command not found
./cvfiles: line 12: nkf: command not found
./cvfiles: line 12: nkf: command not found
./cvfiles: line 12: nkf: command not found
./cvfiles: line 12: nkf: command not found
./cvfiles: line 12: nkf: command not found
./cvfiles: line 12: nkf: command not found
./cvfiles: line 12: nkf: command not found
./cvfiles: line 12: nkf: command not found
./cvfiles: line 12: nkf: command not found
./cvfiles: line 12: nkf: command not found
./cvfiles: line 12: nkf: command not found
./cvfiles: line 12: nkf: command not found
./cvfiles: line 12: nkf: command not found
OgawaKiyoshi-no-MacBook-Pro:tglc ogawakiyoshi$ brew install nkf
==> Downloading https://homebrew.bintray.com/bottles/nkf-2.1.4.yosemite.bottle.t
######################################################################## 100.0%
==> Pouring nkf-2.1.4.yosemite.bottle.tar.gz
 /usr/local/Cellar/nkf/2.1.4: 4 files, 342.7KB
$ ./cvfiles utf8 unix
$

一見成功したかのように見えたが、全部0バイトのファイルになっていた。
ls -al
total 0
drwxr-xr-x@ 16 ogawakiyoshi  staff  544  9 13 01:40 .
drwxr-xr-x@ 10 ogawakiyoshi  staff  340  9 13 01:42 ..
-rw-r--r--   1 ogawakiyoshi  staff    0  9 13 01:40 code.h
-rw-r--r--   1 ogawakiyoshi  staff    0  9 13 01:40 const.h
-rw-r--r--   1 ogawakiyoshi  staff    0  9 13 01:40 error.cc
-rw-r--r--   1 ogawakiyoshi  staff    0  9 13 01:40 error.h
-rw-r--r--   1 ogawakiyoshi  staff    0  9 13 01:40 interpreter.cc
-rw-r--r--   1 ogawakiyoshi  staff    0  9 13 01:40 machine.h
-rw-r--r--   1 ogawakiyoshi  staff    0  9 13 01:40 makefile
-rw-r--r--   1 ogawakiyoshi  staff    0  9 13 01:40 symtable.cc
-rw-r--r--   1 ogawakiyoshi  staff    0  9 13 01:40 symtable.h
-rw-r--r--   1 ogawakiyoshi  staff    0  9 13 01:40 sysproc.h
-rw-r--r--   1 ogawakiyoshi  staff    0  9 13 01:40 system.cc
-rw-r--r--   1 ogawakiyoshi  staff    0  9 13 01:40 system.h
-rw-r--r--   1 ogawakiyoshi  staff    0  9 13 01:40 tglc.lex
-rw-r--r--   1 ogawakiyoshi  staff    0  9 13 01:40 tglc.y

make
g++  -c -o interpreter.o interpreter.cc
interpreter.cc:6:17: warning: using directive refers to implicitly-defined
      namespace 'std'
using namespace std;
                ^
interpreter.cc:13:10: fatal error: 'X11/Xlib.h' file not found
#include <X11/Xlib.h>
         ^
1 warning and 1 error generated.
makefile:2: recipe for target 'interpreter.o' failed
make: *** [interpreter.o] Error 1

---
1
OgawaKiyoshi-no-MacBook-Pro:MacOS ogawakiyoshi$ brew install X11
Error: No available formula with the name "X11"
==> Searching for a previously deleted formula...
Warning: homebrew/core is shallow clone. To get complete history run:
  git -C "$(brew --repo homebrew/core)" fetch --unshallow

Error: No previously deleted formula found.
==> Searching for similarly named formulae...
==> Searching local taps...
This similarly named formula was found:
x11vnc
To install it, run:
  brew install x11vnc
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.
---

Mac 用の X11 について

---
.bash_profile
export CPPFLAGS="-I/usr/local/opt/llvm/include;/opt/X11/include"

---
 source ./.bash_profile
http://www.itmedia.co.jp/help/tips/linux/l0450.html

---
include path

C言語におけるinclude文とgcc -Iオプションの関係

--

CC=

---

make
c -o interpreter.o interpreter.cc
make: c: Command not found
Makefile:2: recipe for target 'interpreter.o' failed
make: [interpreter.o] Error 127 (ignored)
c -o system.o system.cc
make: c: Command not found
Makefile:2: recipe for target 'system.o' failed
make: [system.o] Error 127 (ignored)
c -o symtable.o symtable.cc
make: c: Command not found
Makefile:2: recipe for target 'symtable.o' failed
make: [symtable.o] Error 127 (ignored)
c -o error.o error.cc
make: c: Command not found
Makefile:2: recipe for target 'error.o' failed
make: [error.o] Error 127 (ignored)
yacc -d -v tglc.y
I/usr/local/opt/llvm/include:/opt/X11/include  -c -o y.tab.o y.tab.c
make: I/usr/local/opt/llvm/include:/opt/X11/include: Command not found
<builtin>: recipe for target 'y.tab.o' failed
make: [y.tab.o] Error 127 (ignored)
flex tglc.lex
I/usr/local/opt/llvm/include:/opt/X11/include  -c -o lex.yy.o lex.yy.c
make: I/usr/local/opt/llvm/include:/opt/X11/include: Command not found
<builtin>: recipe for target 'lex.yy.o' failed
make: [lex.yy.o] Error 127 (ignored)
o tglc -L/usr/X11R6/lib -lX11 interpreter.o system.o symtable.o error.o y.tab.o lex.yy.o
make: o: Command not found
Makefile:10: recipe for target 'tglc' failed
make: [tglc] Error 127 (ignored)

---

CC=gcc

--

 make
gcc   -c -o interpreter.o interpreter.cc
interpreter.cc:6:17: warning: using directive refers to implicitly-defined
      namespace 'std'
using namespace std;
                ^
interpreter.cc:108:13: warning: enumeration value 'Scond' not handled in switch
      [-Wswitch]
    switch ((*it)->getID())  {
            ^
interpreter.cc:276:23: warning: illegal character encoding in string literal
      [-Winvalid-source-encoding]
  ...<BC>¹Ի<FE><A5><A8><A5>顼: <BC><B0><A4><CE>ɾ<B2><C1><A4><C7>̤<C4><EA><B5><C1><A4><CE><C6><F3><B9><E0><B1>黻<BB>Ҥ<AC><B8><A1><BD>Ф<B5><A4><EC><A4>ޤ<B7><A4><BF>...
     ^~~~  ~~~~~~~~~~~~~~~~    ~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~ ~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~
interpreter.cc:277:7: error: use of undeclared identifier 'exit'; did you mean
      '_exit'?
      exit(2);
      ^~~~
      _exit
/usr/include/unistd.h:424:7: note: '_exit' declared here
void     _exit(int) __dead2;
         ^
interpreter.cc:288:23: warning: illegal character encoding in string literal
      [-Winvalid-source-encoding]
  ...<BC>¹Ի<FE><A5><A8><A5>顼: <BC><B0><A4><CE>ɾ<B2><C1><A4><C7>̤<C4><EA><B5><C1><A4><CE><C9><E4><B9>椬<B8><A1><BD>Ф<B5><A4><EC><A4>ޤ<B7><A4><BF>...
     ^~~~  ~~~~~~~~~~~~~~~~    ~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~
interpreter.cc:289:7: error: use of undeclared identifier 'exit'; did you mean
      '_exit'?
      exit(2);
      ^~~~
      _exit
/usr/include/unistd.h:424:7: note: '_exit' declared here
void     _exit(int) __dead2;
         ^
interpreter.cc:304:21: warning: illegal character encoding in string literal
      [-Winvalid-source-encoding]
  ...<BC>¹Ի<FE><A5><A8><A5>顼: <BC><B0><A4><CE>ɾ<B2><C1><A4>ǡ<A2><BC><B0><A4>ǤϤʤ<A4><A4><E2><A4>Τ<U+B887D>Ф<B7><A4>ޤ<B7><A4><BF>...
     ^~~~  ~~~~~~~~~~~~~~~~    ~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~           ~~~~~~~~ ~~~~~~~~~~~~
interpreter.cc:305:5: error: use of undeclared identifier 'exit'; did you mean
      '_exit'?
    exit(2);
    ^~~~
    _exit
/usr/include/unistd.h:424:7: note: '_exit' declared here
void     _exit(int) __dead2;
         ^
interpreter.cc:329:5: error: use of undeclared identifier 'exit'; did you mean
      '_exit'?
    exit(2);
    ^~~~
    _exit
/usr/include/unistd.h:424:7: note: '_exit' declared here
void     _exit(int) __dead2;
         ^
5 warnings and 4 errors generated.
Makefile:2: recipe for target 'interpreter.o' failed
make: *** [interpreter.o] Error 1


----

CC = g++
--
make
g++   -c -o interpreter.o interpreter.cc
interpreter.cc:6:17: warning: using directive refers to implicitly-defined namespace 'std'
using namespace std;
                ^
---

https://stackoverflow.com/questions/3952304/llvm-compiler-2-0-warning-with-using-
namespace-std

--
add
#include <iostream>
---
最初の警告は消えた。

interpreter.cc:108:13: warning: enumeration value 'Scond' not handled in switch [-Wswitch]
    switch ((*it)->getID())  {
            ^
23:43 | 投票する | 投票数(0) | コメント(0)