导航:首页 > 源码编译 > 如何查看本地编译器信息

如何查看本地编译器信息

发布时间:2022-10-14 23:33:37

❶ 请教如何在python代码中获取当前编译器的版本

获得编译器的版本有以下几种方式:

  1. 代码方式:

    importsys
    printsys.version
    #2.7.3(default,Apr102012,23:31:26)[MSCv.150032bit(Intel)]
    printsys.version_info
    #sys.version_info(major=2,minor=7,micro=3,releaselevel='final',serial=0)
  2. dos命令

❷ 如何打开Ubuntu的命令编译器

摘要 打开ubnutu开发环境,如下图所示,这里我们使用的是ubuntu 10.04。

❸ 如何查看程序被哪个版本编译器编译的linux-gcc

那是不可能的,除非你加入了调试信息,也就是编译的时候加入了-g参数,然后用gdb调试就可以显示。最大程度上查看一个elf文件信息。



readelf -Wa a.out | head
readelf -wi a.out
readelf -p .comment a.out
objmp -s --section .comment audioplayer



如下:

[root@localhost rootfs]# readelf -Wa bin/gzip

复制代码
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: ARM
Version: 0x1
Entry point address: 0xa080
Start of program headers: 52 (bytes into file)
Start of section headers: 1975444 (bytes into file)
Flags: 0x5000002, has entry point, Version5 EABI
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 6
Size of section headers: 40 (bytes)
Number of section headers: 25
Section header string table index: 24

Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .note.ABI-tag NOTE 000080f4 0000f4 000020 00 A 0 0 4
[ 2] .init PROGBITS 00008114 000114 00000c 00 AX 0 0 4
[ 3] .text PROGBITS 00008120 000120 17fcfc 00 AX 0 0 16
[ 4] __libc_freeres_fn PROGBITS 00187e1c 17fe1c 000f20 00 AX 0 0 4
[ 5] __libc_thread_fre PROGBITS 00188d3c 180d3c 0000e4 00 AX 0 0 4
[ 6] .fini PROGBITS 00188e20 180e20 000008 00 AX 0 0 4
[ 7] .rodata PROGBITS 00188e28 180e28 058147 00 A 0 0 8
[ 8] __libc_subfreeres PROGBITS 001e0f70 1d8f70 00005c 00 A 0 0 4
[ 9] __libc_atexit PROGBITS 001e0fcc 1d8fcc 000004 00 A 0 0 4
[10] __libc_thread_sub PROGBITS 001e0fd0 1d8fd0 000008 00 A 0 0 4
[11] .ARM.extab PROGBITS 001e0fd8 1d8fd8 001b04 00 A 0 0 4
[12] .ARM.exidx ARM_EXIDX 001e2adc 1daadc 006ea8 00 AL 3 0 4
[13] .tdata PROGBITS 001f1984 1e1984 000018 00 WAT 0 0 4
[14] .tbss NOBITS 001f199c 1e199c 000034 00 WAT 0 0 4
[15] .init_array INIT_ARRAY 001f199c 1e199c 000004 00 WA 0 0 4
[16] .fini_array FINI_ARRAY 001f19a0 1e19a0 000008 00 WA 0 0 4
[17] .jcr PROGBITS 001f19a8 1e19a8 000004 00 WA 0 0 4
[18] .data.rel.ro PROGBITS 001f19ac 1e19ac 00002c 00 WA 0 0 4
[19] .got PROGBITS 001f19d8 1e19d8 00007c 04 WA 0 0 4
[20] .data PROGBITS 001f1a58 1e1a58 0008f7 00 WA 0 0 8
[21] .bss NOBITS 001f2350 1e234f 004828 00 WA 0 0 8
[22] __libc_freeres_pt NOBITS 001f6b78 1e234f 00003c 00 WA 0 0 4
[23] .ARM.attributes ARM_ATTRIBUTES 00000000 1e234f 00002b 00 0 0 1
[24] .shstrtab STRTAB 00000000 1e237a 000118 00 0 0 1

Section to Segment mapping:
Segment Sections...
00 .ARM.exidx
01 .note.ABI-tag .init .text __libc_freeres_fn __libc_thread_freeres_fn .fini .rodata __libc_subfreeres __libc_atexit __libc_thread_subfreeres .ARM.extab .ARM.exidx
02 .tdata .init_array .fini_array .jcr .data.rel.ro .got .data .bss __libc_freeres_ptrs
03 .note.ABI-tag
04 .tdata .tbss

Attribute Section: aeabi
File Attributes
Tag_CPU_name: "5TE"
Tag_CPU_arch: v5TE
Tag_ARM_ISA_use: Yes
Tag_THUMB_ISA_use: Thumb-1
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align8_needed: Yes
Tag_ABI_align8_preserved: Yes, except leaf SP
Tag_ABI_enum_size: int
Tag_unknown_44: 1 (0x1)
复制代码

How to retrieve the GCC version used to compile a given ELF executable? http://stackoverflow.com/questions/2387040/how-to-retrieve-the-gcc-version-used-to-compile-a-given-elf-executable

QUES: I'd like to retrieve the GCC version used to compile a given executable. I tried readelf but didn't get the information. Any thoughts?

ANS: To complete what others have said: it's not stored in the object (or exe) file, unless you compile with debugging information! (option -g). If you compile with debug info, you can get it back with readelf:

复制代码
[root@localhost test]# gcc a.c
[root@localhost test]# readelf -wi a.out
[root@localhost test]# gcc a.c -g
[root@localhost test]# readelf -wi a.out
The section .debug_info contains:

Compilation Unit @ offset 0x0:
Length: 135
Version: 2
Abbrev Offset: 0
Pointer Size: 8
<0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
DW_AT_stmt_list : 0
DW_AT_high_pc : 0x400453
DW_AT_low_pc : 0x400448
DW_AT_procer : GNU C 4.1.2 20080704 (Red Hat 4.1.2-55)
DW_AT_language : 1 (ANSI C)
DW_AT_name : a.c
DW_AT_comp_dir : /work/farsight/test
<1><61>: Abbrev Number: 2 (DW_TAG_subprogram)
DW_AT_external : 1
DW_AT_name : main
DW_AT_decl_file : 1
DW_AT_decl_line : 4
DW_AT_prototyped : 1
DW_AT_type : <83>
DW_AT_low_pc : 0x400448
DW_AT_high_pc : 0x400453
DW_AT_frame_base : 0 (location list)
<1><83>: Abbrev Number: 3 (DW_TAG_base_type)
DW_AT_name : int
DW_AT_byte_size : 4
DW_AT_encoding : 5 (signed)
复制代码

ANS2:

❹ linux怎么用命令行查看编译器版本

所有的linux程序都可以使用这个命令查看版本信息。 以后要是遇到了linux方面的问题, shell编程

❺ 关于如何判断gcc之类的编译器的编译结果

我们再使用gcc编译的时候可以让他的输出信息保存到文件当中

gccmain.c-omain&>status.txt

上面的命令就是将gcc编译的信息保存到status.txt文件中,然后我们再程序中读取文件,看文件是否有内容,没有内容就说明没有报错和警告,编译成功。有内容就对每一行内容进行判断,看是warring还是error,只有warring也代表编译成功,有error代表编译失败,然后把这些报错信息都打印出来就好了。

下面看一下例子:

❻ 如何查看linux已安装的编译器及其版本

gcc -v、rpm -qa glibc、rpm -qa zlib。
FC6可以用这些命令,rpm -qa gcc glibc zlib。

补充:Linux是一套免费使用和自由传播的类Unix操作系统,是一个基于POSIX和UNIX的多用户、多任务、支持多线程和多CPU的操作系统。它能运行主要的UNIX工具软件、应用程序和网络协议。它支持32位和64位硬件。Linux继承了Unix以网络为核心的设计思想,是一个性能稳定的多用户网络操作系统。

Linux操作系统诞生于1991 年10 月5 日(这是第一次正式向外公布时间)。Linux存在着许多不同的Linux版本,但它们都使用了Linux内核。Linux可安装在各种计算机硬件设备中,比如手机、平板电脑、路由器、视频游戏控制台、台式计算机、大型机和超级计算机。

严格来讲,Linux这个词本身只表示Linux内核,但实际上人们已经习惯了用Linux来形容整个基于Linux内核,并且使用GNU 工程各种工具和数据库的操作系统。

❼ 如何查看执行文件或者库文件的编译器版本

ldd 查看可执行文件链接了哪些 系统动态链接库 nm 查看可执行文件里面有哪些符号 strip 去除符号表可以给可执行文件瘦身 如果我们想从可执行程序里面提取出来一点什么文本信息的话,还可以用strings命令 strings Linux操作系统上面的动态共享库...

❽ 能否查看一个可执行exe文件的编译器版本如何查看(C语言)

这个是看不到的
别说是版本,就是编译器类型都看不出来的。
编译出来的都是二进制文件,不管谁家的 都按照微软的要求来做的,里面并没有编译器自己的信息。

❾ 如何检查自己的电脑上是否有mingw编译器 我用的codeblocks 编C时总说什么都没做 网上说是编译器问题·求教

codeblocks的话,点setting ,compiler and debugger ,选executable Toolchain
然后会有一行设置编译器的path ,你点一下右边的auto detect。 如果有编译器的话,就会自动设置好了。

阅读全文

与如何查看本地编译器信息相关的资料

热点内容
怎么把自己的服务器备份成另一个 浏览:116
javafloat类型 浏览:401
instagram安卓无网络怎么弄 浏览:704
php弹出窗口调用另外一个html 浏览:432
程序员不幸福调查 浏览:843
苏宁程序员待遇 浏览:552
excel如何设置局域网服务器 浏览:902
linux查看tomcat命令 浏览:209
国外便宜云服务器 浏览:853
程序员岁数大了 浏览:794
广州程序员女朋友学医 浏览:877
linux怎么复制命令行 浏览:345
一氧化碳单片机报警 浏览:953
自己有一个服务器能干什么呢 浏览:659
怎么重启服务器显示屏 浏览:474
android图片叠放 浏览:259
编译原理紫龙书详情 浏览:426
2007天道源码 浏览:410
阳光餐饮app怎么入驻 浏览:544
如何给抖音关注加密 浏览:50