빛나던꽁치의 IT
ubuntu환경에서 cross toolchain바이너리를 소스로 부터 빌드하는데 fgets오류 발생 본문
14.04 우분투 사용 중..
ftp.gnu.org에서 libiconv를(1.14) make명령어로 컴파일하는데 오류가 발생한다.
gets가 security error가 있으니 fgets 를 쓰라고한다.
./stdio.h:(숫자):1: error: 'gets' undeclared here (not in a function)
이런 식으로 뜰것이다.이런경우, 그 소스폴더 내부의 stdio.h를 수정해주면 손쉽게 해결된다.(해당 바이너리 소스는 예전거인데, gcc가 최신 것이라 발생한 문제로 보인다.)
관리자 권한으로 stdio.h를 찾은 뒤에,
ctrl+f를 누르고 security hole 이런 검색어로 위치를 찾아준 다음에
-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)
+ _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+#endif
즉,
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
를 지우고
#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
#endif
를 추가해주면 된다.
그리고 make, make install
해주면 오류없이 컴파일 후 설치 가능하다.