c++ - 汇编消息 : no such instruction when Compiling C++

标签 c++ c++11 gcc

我正在尝试在 Scientific Linux 6.7 版上使用 gcc/5.3 编译 C++ 代码。每当我运行我的 Makefile 时,我总是收到以下错误:

/tmp/ccjZqIED.s: Assembler messages:
/tmp/ccjZqIED.s:768: Error: no such instruction: `shlx %rax,%rdx,%rdx'
/tmp/ccjZqIED.s:1067: Error: no such instruction: `shlx %rax,%rdx,%rdx'
/tmp/ccjZqIED.s: Assembler messages:
/tmp/ccjZqIED.s:6229: Error: no such instruction: `mulx %r10,%rcx,%rbx'
/tmp/ccjZqIED.s:6248: Error: no such instruction: `mulx %r13,%rcx,%rbx'
/tmp/ccjZqIED.s:7109: Error: no such instruction: `mulx %r10,%rcx,%rbx'
/tmp/ccjZqIED.s:7128: Error: no such instruction: `mulx %r13,%rcx,%rbx'

我尝试遵循这个问题的建议,但没有改变我的输出: Compile errors with Assembler messages

我的编译器选项目前是:

CXXFLAGS        = -g -Wall -O0 -pg -std=c++11

有人知道是什么原因造成的吗?

最佳答案

这意味着 GCC 正在输出您的汇编程序不支持的指令。这要么来自源代码中的内联 asm,要么不应该发生,并建议您在另一台机器上使用较新的汇编器编译 GCC,然后将其复制到另一台它没有的机器上'正常工作。

假设这些指令没有在 asm 语句中明确使用,您应该能够告诉 GCC 不要使用合适的标志发出这些指令,例如 -mno-avx(或任何适合禁止使用这些特定指令的标志)。

关于c++ - 汇编消息 : no such instruction when Compiling C++,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38403611/

相关文章:

python - EAGAIN 在 zeromq REQ/REP 上收到,没有阻塞套接字

c++ - for 循环不能正常工作

c++ - 纯粹通过原始套接字连接连接到网站

c++ - 返回指向 const 数据成员的 const 指针和 'auto' 关键字。有点迷茫

c++ - Ubuntu 10.04 需要什么包才能运行用 gcc/g++ 4.7 编译的程序?

c++ - 为什么 co_await 不能返回字符串?

c++ - 开关盒中的默认值

c++ - 在数组中查找最小值

c - 高效的文件系统搜索

c++ - 如何在 Mac 上使用 clang 构建我的 C++ 代码?