지풍@blog

지풍@blog RSS

간혹 컴파일에 따라 아래와 같이 오류를 맽으면서 컴파일이 안 되는 경우가 발생합니다


undefined reference to `clock_getres'

collect2: ld returned 1 exit status


컴파일에 따라 RT library를 기본 포함하느냐 마느냐에 따라 위와 같이 오류가 발생합니다


-lrt를 추가해서 같이 컴파일 해주면 오류 없이 컴파일을 되는 것을 확인 할 수 있습니다


출처 : http://stackoverflow.com/questions/922492/use-of-clock-getres-newbie-linux-c

간혹 개발 서버를 재 설치 이후에 컴파일을 하면 아래와 같이 math 라이브러리를 못 찾는 다는 오류가 뜹니다

/usr/bin/ld: cannot find -lm

이럴 때는 glibc-static.x86_64 패키지를 설치 해주면 오류를 해결 할 수 있습니다

Redhat 계열은 아래와 같이 yum으로 간단히 설치 가능합니다

# yum install glibc-static.x86_64
Loaded plugins: fastestmirror, priorities, refresh-packagekit, security
Loading mirror speeds from cached hostfile
epel/metalink                                            | 5.2 kB     00:00
 * base: ftp.daum.net
 * epel: ftp.kddilabs.jp
 * extras: ftp.daum.net
 * updates: ftp.neowiz.com
PlexRepo                                                 |  951 B     00:00
base                                                     | 3.7 kB     00:00
epel                                                     | 3.9 kB     00:00
epel/primary_db                                          | 5.6 MB     00:01
extras                                                   | 3.4 kB     00:00
updates                                                  | 3.4 kB     00:00
updates/primary_db                                       | 4.5 MB     00:01
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package glibc-static.x86_64 0:2.12-1.107.el6_4.4 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package            Arch         Version                    Repository     Size
================================================================================
Installing:
 glibc-static       x86_64       2.12-1.107.el6_4.4         updates       1.4 M

Transaction Summary
================================================================================
Install       1 Package(s)

Total download size: 1.4 M
Installed size: 6.5 M
Is this ok [y/N]: y
Downloading Packages:
glibc-static-2.12-1.107.el6_4.4.x86_64.rpm               | 1.4 MB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : glibc-static-2.12-1.107.el6_4.4.x86_64                       1/1
  Verifying  : glibc-static-2.12-1.107.el6_4.4.x86_64                       1/1

Installed:
  glibc-static.x86_64 0:2.12-1.107.el6_4.4

Complete!


출처 : 
http://software.intel.com/en-us/articles/error-ld-cannot-find-lm

1 
분류 전체보기 (202)
내가 사는 이야기 (2)
백과사전 (89)
듣고 보는 것 (0)
세상 이야기 (1)
맛집 투어 & 여행 (0)
컴퓨터 이야기 (110)
게임 이야기 (0)
위시리스트 (0)
스포츠 이야기 (0)
영화 이야기 (0)
우하하하하 (0)

공지사항

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백