kuroの覚え書き

96の個人的覚え書き

RNAmotifのコンパイル(OSX)

config.hは以下のようになっている。

#  Edit the configuration variables below to match your system.  The default
#  values given here should work on GNU/Linux systems.

CC= gcc
CFLAGS= -O2 -Wall

#  Notes: clang can replace gcc above;
#         for icc (version 13.0.1) you need to use -O1 in cflags.

#  The yacc compiler is typically "yacc" (for the *real* yacc), "byacc"
#  (for the Berkeley equivalent) or "bison -y" (to get yacc compatible output 
#  from bison).  Note that /bin/yacc is sometimes a symlink to bison; on
#  such systems you need the -y flag.

#  Note that you need to get version 1.875 or later of bison.  Since this 
#  was released in 2003, that should not be much of a problem....
#  Go to http://www.gnu.org/software/bison/bison.html for more information.

YACC = bison -y

#  The GNU version of lex is called flex.  So the following variable is 
#  either "lex" or "flex", depending upon your system.

LEX = flex

# Uncomment & use these 3 lines to use Genbank in addition to FASTN:

# GBHOME=/home/macke/gensearch
# GBLIB=$(GBHOME)/libgb.a
# CFLAGS=-O2 -DUSE_GENBANK

you may need to locate the C-compiler, lex or yacc, and set compiler
flags.
と説明があったのでbisonをインストールしておく。

$ brew install bison

・・・

bison 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 bison first in your PATH run:
  echo 'export PATH="/usr/local/opt/bison/bin:$PATH"' >> ~/.bash_profile

For compilers to find bison you may need to set:
  export LDFLAGS="-L/usr/local/opt/bison/lib"

言われたとおりPATHを通しておく。

lexもいるようなので

$ brew install flex

・・・

flex 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 flex first in your PATH run:
  echo 'export PATH="/usr/local/opt/flex/bin:$PATH"' >> ~/.bash_profile

For compilers to find flex you may need to set:
  export LDFLAGS="-L/usr/local/opt/flex/lib"
  export CPPFLAGS="-I/usr/local/opt/flex/include"

これまたPATHを通しておく。


さてmakeしてみる。

$ make
cd src; make
gcc -O2 -Wall   -c -o rnamot.o rnamot.c
flex rmlex.l
bison -y -d -v -t rmgrm.y
rmgrm.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
gcc -O2 -Wall   -c -o compile.o compile.c
gcc -O2 -Wall   -c -o dbutil.o dbutil.c
gcc -O2 -Wall   -c -o dump.o dump.c
gcc -O2 -Wall   -c -o efn.o efn.c
gcc -O2 -Wall   -c -o efn2.o efn2.c
gcc -O2 -Wall   -c -o errormsg.o errormsg.c
gcc -O2 -Wall   -c -o find_motif.o find_motif.c
gcc -O2 -Wall   -c -o getargs.o getargs.c
gcc -O2 -Wall   -c -o log.o log.c
gcc -O2 -Wall   -c -o mm_regexp.o mm_regexp.c
./mk_dumpnode.h.sh y.tab.h > dumpnode.h
gcc -O2 -Wall   -c -o node.o node.c
gcc -O2 -Wall   -c -o preprocessor.o preprocessor.c
gcc -O2 -Wall   -c -o regexp.o regexp.c
regexp.c:344:15: warning: implicit conversion from 'int' to 'char' changes value from 255
      to -1 [-Wconstant-conversion]
                                                *ep++ = 255;
                                                      ~ ^~~
1 warning generated.
gcc -O2 -Wall   -c -o score.o score.c
gcc -O2 -Wall   -c -o split.o split.c
gcc -O2 -Wall   -c -o y.tab.o y.tab.c
y.tab.c:1601:16: warning: implicit declaration of function 'yylex' is invalid in C99
      [-Wimplicit-function-declaration]
      yychar = yylex ();
               ^
y.tab.c:2631:7: warning: implicit declaration of function 'yyerror' is invalid in C99
      [-Wimplicit-function-declaration]
      yyerror (YY_("syntax error"));
      ^
y.tab.c:2742:3: warning: implicit declaration of function 'yyerror' is invalid in C99
      [-Wimplicit-function-declaration]
  yyerror (YY_("memory exhausted"));
  ^
In file included from rmgrm.y:545:
lex.yy.c:1691:17: warning: unused function 'yyunput' [-Wunused-function]
    static void yyunput (int c, char * yy_bp )
                ^
4 warnings generated.
gcc	-O2 -Wall -o rnamotif rnamot.o compile.o dbutil.o dump.o efn.o efn2.o errormsg.o find_motif.o getargs.o log.o mm_regexp.o node.o preprocessor.o regexp.o score.o split.o y.tab.o	  -lm
gcc -O2 -Wall   -c -o rmprune.o rmprune.c
gcc	-O2 -Wall -o rmprune rmprune.o split.o log.o
gcc -O2 -Wall   -c -o rm2ct.o rm2ct.c
gcc	-O2 -Wall -o rm2ct rm2ct.o split.o log.o
gcc -O2 -Wall   -c -o rmfmt.o rmfmt.c
gcc	-O2 -Wall -o rmfmt rmfmt.o split.o log.o
gcc -O2 -Wall   -c -o efn_drv.o efn_drv.c
gcc	-O2 -Wall -o efn_drv efn_drv.o efn.o split.o log.o -lm
gcc -O2 -Wall   -c -o efn2_drv.o efn2_drv.c
gcc	-O2 -Wall -o efn2_drv efn2_drv.o efn2.o split.o log.o -lm 

warningはでたものの、makeはできたらしく、srcディレクトリに色々できている。

testを走らせてみる。

$ make test
cd test; make
=====================================================
Running nanlin test:

nanlin.descr: complete descr length: min/max = 54/58
  PASSED
=====================================================
Running pk1 test:

pk1.descr: complete descr length: min/max = 22/46
  PASSED
=====================================================
Running pk_j1+2 test:

pk_j1+2.descr: complete descr length: min/max = 66/118
  PASSED
=====================================================
Running qu+tr test:

qu+tr.descr: complete descr length: min/max = 45/101
  PASSED
=====================================================
Running score.1 test:

score.1.descr: complete descr length: min/max = 18/24
  PASSED
=====================================================
Running score.2 test:

score.2.descr: complete descr length: min/max = 25/40
  PASSED
=====================================================
Running trna test:

trna.descr: complete descr length: min/max = 63/95
  PASSED
=====================================================
Running mp.ends test:

mp.ends.descr: complete descr length: min/max = 20/24
  PASSED
=====================================================
Running efn test:

・・・

< SEU28SRRNA -21.400 0  152 28 tcaac cgg  .  ggcg g  actg tcct cagt g  cgcc .   ccg cccgc
< TTERRDA    -21.700 0   59 27 cgagt cgc  .  gcgc .  ccgg ggcg ccgg .  gcgc g   gcg cacgg
< MEPMETH    -22.100 0 1234 32 acaat ggga .  tcc  ga cccc gaaa gggg ga  gga aa tccc ctaaa
< MVORR16SY  -22.700 0 1201 32 acaat ggga .  cgc  ga cccc gaaa gggg ga  gcg aa tccc ctaaa
< THCLRRNA   -23.200 0  261 22 ctgaa cc   .  ctc  .  cggg gaaa cccg .   gag .    gg gatgt
< HRTSSRRNA  -24.400 0  667 31 tcttt agtg gt ccgc .  ccc  ttcg  ggg a  gcgg gt cact ggcct
   FAILED (possibly; see if diffs above look OK)

FAILEDで終わった。なにかまずいのか。

echo 'export EFNDATA="/Users/kuro/local/bin/rnamotif-master/efndata"' >> ~/.bash_profile 

これでヨシ。