nettle-3.6 on CentOS 5.8
공식 홈페이지 : https://www.lysator.liu.se/~nisse/nettle/
0. 주의사항
2003년 8월 현재 CentOS 5.8 에서 nettle 3.7 이상은 컴파일 방법이 약간 다르다.
- nettle-3.7.3
- nettle-3.8.1
- nettle-3.9.1
1. 준비작업
1.1. 다운로드
https://www.lysator.liu.se/~nisse/nettle/ 에서 다운로드 한다.
wget ftp://ftp.gnu.org/gnu/nettle/nettle-3.6.tar.gz
gnu 패키지들은 ftp 다운로드 경로를 제공하므로, CentOS 순정 wget 으로 다운로드 받을 수 있다.
1.2. make, gcc 설치
yum install make gcc -y
1.3. gmp-6.3.0 설치
이에 대해서는 필자가 작성한 다른 글을 참조한다.
2. 컴파일 및 설치
설치 디렉토리(--prefix
) 는 알아서 변경한다.
대부분의 Linux 배포판들은 /usr 이 설치 디렉토리(
--prefix
)이지만, 컴파일해서 설치하는 것들은 /usr/local 이나 /opt 아래에 두는 경우가 많다.
$ mkdir -p logs/nettle-3.6 $ tar xvfz nettle-3.6.tar.gz > logs/nettle-3.6/tar.`date +%Y%m%d.%H%M%S`.log 2>&1 $ cd nettle-3.6 $ ./configure \ --with-include-path=/opt/gmp-6.3.0/include \ --with-lib-path=/opt/gmp-6.3.0/lib \ --prefix=/opt/nettle-3.6 > ../logs/nettle-3.6/config.`date +%Y%m%d.%H%M%S`.log 2>&1 $ make > ../logs/nettle-3.6/make.`date +%Y%m%d.%H%M%S`.log 2>&1 $ make install > ../logs/nettle-3.6/install.`date +%Y%m%d.%H%M%S`.log 2>&1
nettle 3.7 이상에서는 다음과 같다.
$ ./configure \ --disable-assembler \ --with-include-path=/opt/gmp-6.3.0/include \ --with-lib-path=/opt/gmp-6.3.0/lib \ --prefix=/opt/nettle-3.6 > ../logs/nettle-3.6/config.`date +%Y%m%d.%H%M%S`.log 2>&1
3. 적용
3.1. 현재 환경에 적용
현재 환경에서는 다음과 같이 적용한다.
$ export PATH=/opt/nettle-3.6/bin:${PATH} $ export LD_LIBRARY_PATH=/opt/nettle-3.6/lib64:${LD_LIBRARY_PATH}
pkg-config 를 사용하는 경우 다음의 내용도 추가할 수 있다.
export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:/opt/nettle-3.6/lib64/pkgconfig
3.2. 현재 로그인한 사용자에게 적용
현재 로그인한 사용자에게 적용하려면, ".bash_profile" 파일의 끝에 위의 내용을 추가한다.
3.3. 시스템 전체에 적용
3.3.1. 환경변수 변경
"/etc/bashrc" 파일의 끝에 위의 내용을 추가한다.
LD_LIBRARY_PATH 는 ld.so.conf 를 변경하는 방법도 있다.
3.3.2. ld.so.conf 변경
"/etc/ld.so.conf.d/nettle.conf" 파일을 편집(추가)한다.
$ vi /etc/ld.so.conf.d/nettle.conf
다음의 내용으로 교체(추가)한다.
/opt/nettle-3.6/lib64
변경사항을 적용한다.
$ ldconfig
4. 문제해결
4.1. no such instruction
nettle 3.7 이상에서 발생한다.
- nettle-3.7.3
- nettle-3.8.1
- nettle-3.9.1
configure 에 --disable-assembler
옵션을 추가해야 한다.
gcc 버전에 따라 오류가 나는 위치가 다르다면, gcc 최신버전에서는 에러가 나지 않을 가능성이 있지만, 테스트 하지 않았다.
다음은 gcc 4.1.2 로 컴파일 할 때 오류이다.
aes128-encrypt-2.s: Assembler messages: aes128-encrypt-2.s:83: Error: no such instruction: `aesenc %xmm1,%xmm11' aes128-encrypt-2.s:84: Error: no such instruction: `aesenc %xmm2,%xmm11' aes128-encrypt-2.s:85: Error: no such instruction: `aesenc %xmm3,%xmm11' aes128-encrypt-2.s:86: Error: no such instruction: `aesenc %xmm4,%xmm11' aes128-encrypt-2.s:87: Error: no such instruction: `aesenc %xmm5,%xmm11' aes128-encrypt-2.s:88: Error: no such instruction: `aesenc %xmm6,%xmm11' aes128-encrypt-2.s:89: Error: no such instruction: `aesenc %xmm7,%xmm11' aes128-encrypt-2.s:90: Error: no such instruction: `aesenc %xmm8,%xmm11' aes128-encrypt-2.s:91: Error: no such instruction: `aesenc %xmm9,%xmm11' aes128-encrypt-2.s:92: Error: no such instruction: `aesenclast %xmm10,%xmm11' aes128-encrypt-2.s:105: Error: no such instruction: `aesenc %xmm1,%xmm11' aes128-encrypt-2.s:106: Error: no such instruction: `aesenc %xmm1,%xmm12' aes128-encrypt-2.s:107: Error: no such instruction: `aesenc %xmm2,%xmm11' aes128-encrypt-2.s:108: Error: no such instruction: `aesenc %xmm2,%xmm12' aes128-encrypt-2.s:109: Error: no such instruction: `aesenc %xmm3,%xmm11' aes128-encrypt-2.s:110: Error: no such instruction: `aesenc %xmm3,%xmm12' aes128-encrypt-2.s:111: Error: no such instruction: `aesenc %xmm4,%xmm11' aes128-encrypt-2.s:112: Error: no such instruction: `aesenc %xmm4,%xmm12' aes128-encrypt-2.s:113: Error: no such instruction: `aesenc %xmm5,%xmm11' aes128-encrypt-2.s:114: Error: no such instruction: `aesenc %xmm5,%xmm12' aes128-encrypt-2.s:115: Error: no such instruction: `aesenc %xmm6,%xmm11' aes128-encrypt-2.s:116: Error: no such instruction: `aesenc %xmm6,%xmm12' aes128-encrypt-2.s:117: Error: no such instruction: `aesenc %xmm7,%xmm11' aes128-encrypt-2.s:118: Error: no such instruction: `aesenc %xmm7,%xmm12' aes128-encrypt-2.s:119: Error: no such instruction: `aesenc %xmm8,%xmm11' aes128-encrypt-2.s:120: Error: no such instruction: `aesenc %xmm8,%xmm12' aes128-encrypt-2.s:121: Error: no such instruction: `aesenc %xmm9,%xmm11' aes128-encrypt-2.s:122: Error: no such instruction: `aesenc %xmm9,%xmm12' aes128-encrypt-2.s:123: Error: no such instruction: `aesenclast %xmm10,%xmm11' aes128-encrypt-2.s:124: Error: no such instruction: `aesenclast %xmm10,%xmm12' make[1]: *** [aes128-encrypt-2.o] Error 1
다음은 gcc 4.4 혹은 4.8.2 로 컴파일 할 때 오류이다.
sha1-compress-2.s: Assembler messages: sha1-compress-2.s:73: Error: no such instruction: `sha1rnds4 $0,%xmm5,%xmm4' sha1-compress-2.s:78: Error: no such instruction: `sha1nexte %xmm1,%xmm6' sha1-compress-2.s:80: Error: no such instruction: `sha1rnds4 $0,%xmm6,%xmm4' sha1-compress-2.s:81: Error: no such instruction: `sha1msg1 %xmm1,%xmm0' sha1-compress-2.s:86: Error: no such instruction: `sha1nexte %xmm2,%xmm5' sha1-compress-2.s:88: Error: no such instruction: `sha1rnds4 $0,%xmm5,%xmm4' sha1-compress-2.s:89: Error: no such instruction: `sha1msg1 %xmm2,%xmm1' sha1-compress-2.s:96: Error: no such instruction: `sha1nexte %xmm3,%xmm6' sha1-compress-2.s:98: Error: no such instruction: `sha1msg2 %xmm3,%xmm0' sha1-compress-2.s:99: Error: no such instruction: `sha1rnds4 $0,%xmm6,%xmm4' sha1-compress-2.s:100: Error: no such instruction: `sha1msg1 %xmm3,%xmm2' sha1-compress-2.s:104: Error: no such instruction: `sha1nexte %xmm0,%xmm5' sha1-compress-2.s:106: Error: no such instruction: `sha1msg2 %xmm0,%xmm1' sha1-compress-2.s:107: Error: no such instruction: `sha1rnds4 $0,%xmm5,%xmm4' sha1-compress-2.s:108: Error: no such instruction: `sha1msg1 %xmm0,%xmm3' sha1-compress-2.s:113: Error: no such instruction: `sha1nexte %xmm1,%xmm6' sha1-compress-2.s:115: Error: no such instruction: `sha1msg2 %xmm1,%xmm2' sha1-compress-2.s:116: Error: no such instruction: `sha1rnds4 $1,%xmm6,%xmm4' sha1-compress-2.s:117: Error: no such instruction: `sha1msg1 %xmm1,%xmm0' sha1-compress-2.s:121: Error: no such instruction: `sha1nexte %xmm2,%xmm5' sha1-compress-2.s:123: Error: no such instruction: `sha1msg2 %xmm2,%xmm3' sha1-compress-2.s:124: Error: no such instruction: `sha1rnds4 $1,%xmm5,%xmm4' sha1-compress-2.s:125: Error: no such instruction: `sha1msg1 %xmm2,%xmm1' sha1-compress-2.s:129: Error: no such instruction: `sha1nexte %xmm3,%xmm6' sha1-compress-2.s:131: Error: no such instruction: `sha1msg2 %xmm3,%xmm0' sha1-compress-2.s:132: Error: no such instruction: `sha1rnds4 $1,%xmm6,%xmm4' sha1-compress-2.s:133: Error: no such instruction: `sha1msg1 %xmm3,%xmm2' sha1-compress-2.s:137: Error: no such instruction: `sha1nexte %xmm0,%xmm5' sha1-compress-2.s:139: Error: no such instruction: `sha1msg2 %xmm0,%xmm1' sha1-compress-2.s:140: Error: no such instruction: `sha1rnds4 $1,%xmm5,%xmm4' sha1-compress-2.s:141: Error: no such instruction: `sha1msg1 %xmm0,%xmm3' sha1-compress-2.s:145: Error: no such instruction: `sha1nexte %xmm1,%xmm6' sha1-compress-2.s:147: Error: no such instruction: `sha1msg2 %xmm1,%xmm2' sha1-compress-2.s:148: Error: no such instruction: `sha1rnds4 $1,%xmm6,%xmm4' sha1-compress-2.s:149: Error: no such instruction: `sha1msg1 %xmm1,%xmm0' sha1-compress-2.s:154: Error: no such instruction: `sha1nexte %xmm2,%xmm5' sha1-compress-2.s:156: Error: no such instruction: `sha1msg2 %xmm2,%xmm3' sha1-compress-2.s:157: Error: no such instruction: `sha1rnds4 $2,%xmm5,%xmm4' sha1-compress-2.s:158: Error: no such instruction: `sha1msg1 %xmm2,%xmm1' sha1-compress-2.s:162: Error: no such instruction: `sha1nexte %xmm3,%xmm6' sha1-compress-2.s:164: Error: no such instruction: `sha1msg2 %xmm3,%xmm0' sha1-compress-2.s:165: Error: no such instruction: `sha1rnds4 $2,%xmm6,%xmm4' sha1-compress-2.s:166: Error: no such instruction: `sha1msg1 %xmm3,%xmm2' sha1-compress-2.s:170: Error: no such instruction: `sha1nexte %xmm0,%xmm5' sha1-compress-2.s:172: Error: no such instruction: `sha1msg2 %xmm0,%xmm1' sha1-compress-2.s:173: Error: no such instruction: `sha1rnds4 $2,%xmm5,%xmm4' sha1-compress-2.s:174: Error: no such instruction: `sha1msg1 %xmm0,%xmm3' sha1-compress-2.s:178: Error: no such instruction: `sha1nexte %xmm1,%xmm6' sha1-compress-2.s:180: Error: no such instruction: `sha1msg2 %xmm1,%xmm2' sha1-compress-2.s:181: Error: no such instruction: `sha1rnds4 $2,%xmm6,%xmm4' sha1-compress-2.s:182: Error: no such instruction: `sha1msg1 %xmm1,%xmm0' sha1-compress-2.s:186: Error: no such instruction: `sha1nexte %xmm2,%xmm5' sha1-compress-2.s:188: Error: no such instruction: `sha1msg2 %xmm2,%xmm3' sha1-compress-2.s:189: Error: no such instruction: `sha1rnds4 $2,%xmm5,%xmm4' sha1-compress-2.s:190: Error: no such instruction: `sha1msg1 %xmm2,%xmm1' sha1-compress-2.s:195: Error: no such instruction: `sha1nexte %xmm3,%xmm6' sha1-compress-2.s:197: Error: no such instruction: `sha1msg2 %xmm3,%xmm0' sha1-compress-2.s:198: Error: no such instruction: `sha1rnds4 $3,%xmm6,%xmm4' sha1-compress-2.s:199: Error: no such instruction: `sha1msg1 %xmm3,%xmm2' sha1-compress-2.s:203: Error: no such instruction: `sha1nexte %xmm0,%xmm5' sha1-compress-2.s:205: Error: no such instruction: `sha1msg2 %xmm0,%xmm1' sha1-compress-2.s:206: Error: no such instruction: `sha1rnds4 $3,%xmm5,%xmm4' sha1-compress-2.s:207: Error: no such instruction: `sha1msg1 %xmm0,%xmm3' sha1-compress-2.s:211: Error: no such instruction: `sha1nexte %xmm1,%xmm6' sha1-compress-2.s:213: Error: no such instruction: `sha1msg2 %xmm1,%xmm2' sha1-compress-2.s:214: Error: no such instruction: `sha1rnds4 $3,%xmm6,%xmm4' sha1-compress-2.s:217: Error: no such instruction: `sha1nexte %xmm2,%xmm5' sha1-compress-2.s:219: Error: no such instruction: `sha1msg2 %xmm2,%xmm3' sha1-compress-2.s:220: Error: no such instruction: `sha1rnds4 $3,%xmm5,%xmm4' sha1-compress-2.s:222: Error: no such instruction: `sha1nexte %xmm3,%xmm6' sha1-compress-2.s:224: Error: no such instruction: `sha1rnds4 $3,%xmm6,%xmm4' sha1-compress-2.s:226: Error: no such instruction: `sha1nexte %xmm8,%xmm5' make[1]: *** [sha1-compress-2.o] Error 1