How can I know the gcc version which is used to compile a certain rpm package ?

 SOLUTION UNVERIFIED - 已更新 2014年六月17日10:56 - 

​English ​

环境

  • Red Hat Enterprise Linux All Versions

问题

How can I know the gcc version which is used to compile a certain rpm package ?

决议

  • Step 1. Download the related debuginfo package.
    Let's take bind as an example: bind-debuginfo-9.8.2-0.17.rc1.el6_4.4
  • Step 2. Install the debuginfo package.

​Raw​

# rpm -ivh bind-debuginfo-9.8.2-0.17.rc1.el6_4.4.x86_64

  • Step 3. Execute the following ​​readelf​​ command

​Raw​

# readelf -p .comment /usr/lib/debug/usr/sbin/named.debug 

String dump of section '.comment':
[ 0] GCC: (GNU) 4.4.6 20120305 (Red Hat 4.4.6-4)
[ 2c] GCC: (GNU) 4.4.7 20120313 (Red Hat 4.4.7-3)