LoginSignup
1

More than 5 years have passed since last update.

homebrewでOctave(version 4.2.1)をインストールした時に、tf2pzが使えない問題の解消

Last updated at Posted at 2017-10-09

Octave-Forgeのパッケージのsignal, controlが入っていないことが原因。しかし、

octave:1> pkg install -forge signal control

を実行すると以下のエラーが出る。

octave:1> pkg install -forge signal control
In file included from __control_helper_functions__.cc:7:
./lti_input_idx.cc:65:48: warning: 'nelem' is deprecated [-Wdeprecated-declarations]
    octave_idx_type len = args(0).cell_value().nelem();
                                               ^
/usr/local/Cellar/octave/4.2.1_6/include/octave-4.2.1/octave/Array.h:360:19: note: 'nelem' has
      been explicitly marked deprecated here
  octave_idx_type nelem (void) const { return numel (); }
                  ^
1 warning generated.
clang: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument]
In file included from __control_slicot_functions__.cc:24:
./sl_tg04bx.cc:79:33: warning: 'length' is deprecated [-Wdeprecated-declarations]
        octave_idx_type ip = pr.length ();  // ip: number of finite poles
                                ^
/usr/local/Cellar/octave/4.2.1_6/include/octave-4.2.1/octave/Array.h:354:19: note: 'length' has
      been explicitly marked deprecated here
  octave_idx_type length (void) const { return numel (); }
                  ^
In file included from __control_slicot_functions__.cc:24:
./sl_tg04bx.cc:80:33: warning: 'length' is deprecated [-Wdeprecated-declarations]
        octave_idx_type iz = zr.length ();  // iz: number of zeros
                                ^
/usr/local/Cellar/octave/4.2.1_6/include/octave-4.2.1/octave/Array.h:354:19: note: 'length' has
      been explicitly marked deprecated here
  octave_idx_type length (void) const { return numel (); }
                  ^
In file included from __control_slicot_functions__.cc:42:
./sl_ident.cc:184:40: warning: 'nelem' is deprecated [-Wdeprecated-declarations]
        octave_idx_type n_exp = y_cell.nelem ();            // number of experiments
                                       ^
/usr/local/Cellar/octave/4.2.1_6/include/octave-4.2.1/octave/Array.h:360:19: note: 'nelem' has
      been explicitly marked deprecated here
  octave_idx_type nelem (void) const { return numel (); }
                  ^
In file included from __control_slicot_functions__.cc:43:
./sl_ib01cd.cc:97:40: warning: 'nelem' is deprecated [-Wdeprecated-declarations]
        octave_idx_type n_exp = y_cell.nelem ();            // number of experiments
                                       ^
/usr/local/Cellar/octave/4.2.1_6/include/octave-4.2.1/octave/Array.h:360:19: note: 'nelem' has
      been explicitly marked deprecated here
  octave_idx_type nelem (void) const { return numel (); }
                  ^
In file included from __control_slicot_functions__.cc:44:
./sl_ib01ad.cc:148:40: warning: 'nelem' is deprecated [-Wdeprecated-declarations]
        octave_idx_type n_exp = y_cell.nelem ();            // number of experiments
                                       ^
/usr/local/Cellar/octave/4.2.1_6/include/octave-4.2.1/octave/Array.h:360:19: note: 'nelem' has
      been explicitly marked deprecated here
  octave_idx_type nelem (void) const { return numel (); }
                  ^
5 warnings generated.
clang: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument]
ld: warning: directory not found for option '-L/usr/local/Cellar/gcc/7.2.0/lib/gcc/7/gcc/x86_64-apple-darwin16.7.0/7.2.0'
ld: warning: directory not found for option '-L/usr/local/Cellar/gcc/7.2.0/lib/gcc/7/gcc/x86_64-apple-darwin16.7.0/7.2.0/../../..'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [__control_slicot_functions__.oct] Error 1
tar -xzf slicot.tar.gz
/usr/local/Cellar/octave/4.2.1_6/bin/mkoctfile-4.2.1 __control_helper_functions__.cc
mkdir sltmp
mv slicot/src/*.f ./sltmp
mv slicot/src_aux/*.f ./sltmp
cp TG04BX.fortran ./sltmp/TG04BX.f
cp TB01ZD.fortran ./sltmp/TB01ZD.f
cd sltmp; /usr/local/Cellar/octave/4.2.1_6/bin/mkoctfile-4.2.1 -c *.f
ar -rc slicotlibrary.a ./sltmp/*.o
rm -rf sltmp slicot
LFLAGS="-L/usr/local/Cellar/octave/4.2.1_6/lib/octave/4.2.1 -L/usr/local/Cellar/octave/4.2.1_6/lib  -L/usr/local/opt/veclibfort/lib -lvecLibFort  -L/usr/local/Cellar/gcc/7.2.0/lib/gcc/7/gcc/x86_64-apple-darwin16.7.0/7.2.0 -L/usr/local/Cellar/gcc/7.2.0/lib/gcc/7/gcc/x86_64-apple-darwin16.7.0/7.2.0/../../.. -lgfortran -lquadmath -lm" \
    /usr/local/Cellar/octave/4.2.1_6/bin/mkoctfile-4.2.1 __control_slicot_functions__.cc common.cc slicotlibrary.a

pkg: error running `make' for the control package.
error: called from
    configure_make at line 95 column 9
    install at line 192 column 7
    pkg at line 394 column 9

これは

$ mkdir -p /usr/local/Cellar/gcc/7.2.0/lib/gcc/7/gcc/x86_64-apple-darwin16.7.0/7.2.0

を実行することで解消できる。

その後、

$ octave
octave:1> pkg install -forge signal control  
octave:2> pkg load control
octave:3> pkg load signal

を実行することで、tf2zpが使えるようになる。

(参考)
https://github.com/Homebrew/homebrew-science/issues/3167

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
1