错误与gcc 5可变参数功能:后缀或操作数无效'movq' [英] error with gcc 5 for varargs function: suffix or operands invalid for `movq'

查看:256
本文介绍了错误与gcc 5可变参数功能:后缀或操作数无效'movq'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试安装OpenMPI时,.configure文件在检查所选编译器的ISO C99功能部分失败。

困惑的是gcc当然有std = gnu99和std = c99选项,我修剪了20,000行配置文件以隔离违规部分。最后,我将它追溯到gcc 5,不编译可变参数函数。

以下代码会生成后缀或操作数无效用于'movq''错误,这是.configure文件失败的根本原因。



(我遵循的OpenMPI的分步安装在这里 https://wiki.helsinki.fi/display/HUGG/Installing+Open+MPI+on+Mac+OS+X



任何人都看到了这一点,并知道如何解决它?

  // ------------------------------------------------ ----------------------------- 
//这不能用gcc 5.3
// $ b编译$ b //命令:gcc test4.c
//
//错误是:
// /var/folders/4s/gkkpz000gn/T//ccAraq59.s:47:suffix或操作数对'movq'无效
// /var/folders/4s/gkg0r000gn/T//ccAraq59.s:52:suffix或操作数对`movq'无效
//
/ / gcc版本是5.3.0:
//
// $ gcc --version
// gcc(GCC)5.3.0
// Copyright(C)2015 Free Software Foundation,Inc.
//这是免费软件;请参阅复制条件的来源。没有
//保修;甚至不适用于适销性或针对特定用途的适用性。
//
// -------------------------------------- ---------------------------------------


// Check varargs
static void
test_varargs(const char * format,...)
{
}


// b -------------------------------------------------- ------------
// MAIN {}
// ----------------------- ---------------------------------------

int
main()
{

// ============================== ======================
//检查可变参数。
// test_varargs(s,string); // WORKS
// test_varargs(d',65); // WORKS
// test_varargs(s,d',string,65); // WORKS

test_varargs(f。,34.234); //失败!!!
test_varargs(s,d'f。,string,65,34.234); //也失败
// ======================================== ============


return 0;
}


解决方案

XCode gcc安装。



我最终卸载了安装的所有gcc版本,删除了g ++,删除了剩下的所有悬挂链接。接下来,我从XCode 6升级到7,并使用与它一起的gcc版本。这解决了上述问题。
删除所有悬挂的符号链接和OpenMPI的unziped tar-ball,然后重新解压缩,OpenMPI可以顺利安装。 cd ./examples,make all,mpirun -np 4 hello_c工作,我们有一个快乐的MPI安装。

When trying to install OpenMPI the .configure filed failed in the section checking for ISO C99 ability of the selected compiler.

Puzzled as gcc of course has both the std=gnu99 and std=c99 option, I pruning the 20,000 lines configure file to isolate the offending section. In the end I traced it back to gcc 5 not compiling variable argument functions.

The below code generates the "suffix or operands invalid for `movq'" error, which is the root cause of the .configure file failing.

(The step-by-step installation for OpenMPI I followed is here https://wiki.helsinki.fi/display/HUGG/Installing+Open+MPI+on+Mac+OS+X)

Anyone has seen this and knows how to fix it?

//-----------------------------------------------------------------------------
// This fails to compile with gcc 5.3
//
// Command: gcc test4.c
//
// Error is: 
//  /var/folders/4s/gkkpz000gn/T//ccAraq59.s:47:suffix or operands invalid for `movq'
//  /var/folders/4s/gkg0r000gn/T//ccAraq59.s:52:suffix or operands invalid for `movq'
//
// gcc version is 5.3.0:
//
// $ gcc --version
// gcc (GCC) 5.3.0
// Copyright (C) 2015 Free Software Foundation, Inc.
// This is free software; see the source for copying conditions.  There is NO
// warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
//-----------------------------------------------------------------------------


// Check varargs
static void
test_varargs (const char *format, ...)
{
}


//--------------------------------------------------------------
//                         MAIN {}   
//--------------------------------------------------------------

 int
 main ()
 {

    //====================================================
    // Check varargs.
    // test_varargs ("s", "string");            //WORKS
    // test_varargs ("d' ", 65);                //WORKS
    // test_varargs ("s, d' ", "string", 65);   //WORKS

    test_varargs ("f .", 34.234);                       // FAILS!!!
    test_varargs ("s, d' f .", "string", 65, 34.234);   //ALSO FAILS
    //====================================================


   return 0;
 }

解决方案

TLDR: conflict between brew and XCode gcc installs.

I ended up uninstalling all gcc versions installed, deleting g++, deleting all dangling links left over. Next I upgraded from XCode 6 to 7 and used the gcc version coming with it. This fixed the above problem. Deleting all dangling symlinks and the unziped tar-ball of OpenMPI and then re-unzipping allowed the OpenMPI to be installed without a hitch. cd ./examples, make all, mpirun -np 4 hello_c worked and we have a happy MPI installation.

这篇关于错误与gcc 5可变参数功能:后缀或操作数无效'movq'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆