모세 스크립트 설치 중 문제

모세 스크립트 설치 중 문제

중복 가능성:
/bin/sh: ./check-dependent.pl: 찾을 수 없지만 check-dependent.pl은 존재합니다!

컴파일 중 오류가 발생했습니다 moses-script. 내용은 다음과 같습니다.

minakshi@minakshi-Vostro-3500:~/Desktop/monu/moses/scripts$ make release
# Compile the parts
make all
make[1]: Entering directory `/home/minakshi/Desktop/monu/moses/scripts'
# Building memscore may fail e.g. if boost is not available.
# We ignore this because traditional scoring will still work and memscore isn't used by default.
cd training/memscore ; \
      ./configure && make \
      || ( echo "WARNING: Building memscore failed."; \
           echo 'training/memscore/memscore' >> ../../release-exclude )
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of g++... gcc3
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for boostlib >= 1.31.0... yes
checking for cos in -lm... yes
checking for gzopen in -lz... yes
checking for cblas_dgemm in -lgslcblas... no
checking for gsl_blas_dgemm in -lgsl... no
checking how to run the C++ preprocessor... g++ -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking n_gram.h usability... no
checking n_gram.h presence... no
checking for n_gram.h... no
checking for size_t... yes
checking for ptrdiff_t... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
make[2]: Entering directory `/home/minakshi/Desktop/monu/moses/scripts/training/memscore'
make  all-am
make[3]: Entering directory `/home/minakshi/Desktop/monu/moses/scripts/training/memscore'
make[3]: Leaving directory `/home/minakshi/Desktop/monu/moses/scripts/training/memscore'
make[2]: Leaving directory `/home/minakshi/Desktop/monu/moses/scripts/training/memscore'
touch release-exclude # No files excluded by default
pwd=`pwd`; \
    for subdir in cmert-0.5 phrase-extract symal mbr lexical-reordering; do \
      make -C training/$subdir || exit 1; \
      echo "### Compiler $subdir"; \
      cd $pwd; \
    done
make[2]: Entering directory `/home/minakshi/Desktop/monu/moses/scripts/training/cmert-0.5'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/minakshi/Desktop/monu/moses/scripts/training/cmert-0.5'
### Compiler cmert-0.5
make[2]: Entering directory `/home/minakshi/Desktop/monu/moses/scripts/training/phrase-extract'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/minakshi/Desktop/monu/moses/scripts/training/phrase-extract'
### Compiler phrase-extract
make[2]: Entering directory `/home/minakshi/Desktop/monu/moses/scripts/training/symal'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/minakshi/Desktop/monu/moses/scripts/training/symal'
### Compiler symal
make[2]: Entering directory `/home/minakshi/Desktop/monu/moses/scripts/training/mbr'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/minakshi/Desktop/monu/moses/scripts/training/mbr'
### Compiler mbr
make[2]: Entering directory `/home/minakshi/Desktop/monu/moses/scripts/training/lexical-reordering'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/minakshi/Desktop/monu/moses/scripts/training/lexical-reordering'
### Compiler lexical-reordering
## All files that need compilation were compiled
make[1]: Leaving directory `/home/minakshi/Desktop/monu/moses/scripts'
/bin/sh: ./check-dependencies.pl: not found
make: *** [release] Error 127

이 오류가 발생하는 이유를 모르십니까? check-dependent.pl 파일은 scripts 폴더에 있습니다.

답변1

내 직감: ./check-dependencies.pl처음부터 #!/usr/local/bin/perl. 첫 번째 줄을 로 변경합니다 #!/usr/bin/perl.

설명: 프로그램을 실행하면 커널이 파일을 메모리에 로드하고 실행합니다. 그러나 많은 실행 파일(실제로 대부분)은 직접 실행할 수 없지만 다른 프로그램인 로더가 필요합니다.

  • 대부분의 바이너리는 동적으로 연결되어 있으므로동적 링커( /lib/ld-linux.so.232비트 프로그램의 경우, /lib64/ld-linux-x86-64.so.264비트 프로그램의 경우) 프로그램에서 요청한 라이브러리를 로드하는 역할을 담당합니다.
  • 스크립트는 해당 인터프리터를 통해 로드되어야 합니다.

커널은 다음으로 시작하는 스크립트를 인식합니다.셰르본철사. shebang 줄은 스크립트의 첫 번째 줄이며 문자 #!와 인터프리터의 전체 경로로 구성됩니다. (선택 사항) 줄에는 공백과 그 뒤에 인터프리터에 전달된 인수가 포함될 수도 있습니다.

예를 들어, 스크립트가 로 시작하면 #!/usr/local/bin/perl -w커널은 스크립트를 실행하라는 지시를 받을 때 스크립트를 실행합니다 /usr/local/bin/perl -w /path/to/script. 실행에 실패하면 /usr/local/bin/perl오류 메시지가 표시됩니다. 커널은 오류 코드만 보고할 수 있고 다른 정보는 보고할 수 없으므로 스크립트가 존재하지 않거나 인터프리터가 존재하지 않는 경우 커널의 정보는 동일합니다.

이 경우 일부 쉘은 오류 조건을 다시 확인하고 스크립트가 존재하지만 커널이 "파일을 찾을 수 없음"을 보고하는 경우 "잘못된 해석기"와 같은 다른 메시지를 인쇄합니다. 하지만 Ubuntu( )의 기본 스크립팅 셸 /bin/sh은 Dash입니다. 이는 스크립트를 빠르게 실행하도록 설계되었으며 이와 같은 추가 편의 기능은 없습니다. 따라서 간단한 "파일을 찾을 수 없음" 보고서를 받게 됩니다.

많은 Perl 스크립트는 #!/usr/local/bin/perl대부분의 비 Linux 설치에서 Perl 경로인 로 시작합니다. 귀하의 컴퓨터에서 이를 생성하는 것이 도움이 될 수 있습니다. 이를 심볼릭 링크로 만들고 /usr/bin/perl이를 사용할 때 다른 인터프리터에 대해서도 동일한 작업을 수행하십시오.

cd /usr/local/bin
ln -s ../../../bin/bash ../../bin/perl ../../bin/python ../../bin/ruby .

스크립트를 작성할 때 다음과 같은 shebang 줄을 작성하면 이 문제를 피할 수 있습니다 #!/usr/bin/env perl. 이는 인터프리터에 매개변수를 전달하지 않는 경우에만 수행할 수 있습니다. 바라보다내 shebang으로 "#!/path/to/NAME" 대신 "#!/usr/bin/env NAME"을 사용하는 것이 더 나은 이유는 무엇입니까?이 가능성에 대해 논의해 봅시다.

관련 정보