警告:段“__ textcoal_nt”是不推荐的,因为更新到Mac OSX Sierra [英] warning: section "__textcoal_nt" is deprecate since updating to Mac OSX Sierra

查看:1031
本文介绍了警告:段“__ textcoal_nt”是不推荐的,因为更新到Mac OSX Sierra的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新到Sierra I后,我将Xcode从7.2.1更新到Xcode 8.所以问题可能只是通过更新Xcode。我降级到7.2.1,仍然有同样的问题。



这是我编译C ++程序时得到的错误

  /var/folders/cj/1h3_84h56c9bgzt_ryhpf4940000gn/T//ccgjxtCM.s:4:11:warning:部分__textcoal_nt已弃用
.section __TEXT, __textcoal_nt,coalesced,pure_instructions
^ ~~~~~ b $ b /var/folders/cj/1h3_84h56c9bgzt_ryhpf4940000gn/T//ccgjxtCM.s:4:11:note:change section name to__text
.section __TEXT,__ textcoal_nt,coalesced,pure_instructions
^ ~~~~~
/ var / folders / cj / 1h3_84h56c9bgzt_ryhpf4940000gn / T // ccgjxtCM.s:54:11:warning:section__textcoal_ntis deprecated
.section __TEXT,__ textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~~~
/var/folders/cj/1h3_84h56c9bgzt_ryhpf4940000gn/T//ccgjxtCM.s:54:11:注意:将节名更改为__text
.section __TEXT,__ textcoal_nt,coalesced,pure_instructions

程序仍在运行,但显示此消息。即使代码中的唯一的东西是我做的名为graph的类,我有这样的代码错误出现。

  void explore(Graph& G,int x)
{
Node * nodePtr =& G.changeNode(x);
}

我在命令行中尝试这样做,但没有工作

  sudo xcode-select -s / Library / Developer / CommandLineTools 

这是我在Sublime Text中使用的构建,但是即使与其他c ++编译器不是c ++ 11,我得到相同的错误。命令行也出现错误。

  {
shell_cmd:g ++ -std = c ++ 11 \\ \\$ {file} \-o \$ {file_path} / $ {file_base_name} \,
file_regex:^(.. [^:] *): 0-9] +):?([0-9] +)?:?(。*)$,
working_dir:$ {file_path},
selector: source.c,source.c ++,

shell_cmd:g ++ -std = c ++ 11 \$ {file} \-o \$ {file_path} $ {file_base_name} \&& \$ {file_path} / $ {file_base_name} \
}

我认为唯一可以工作的是使用我在这个网站的某些线程上看到的补丁

  http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151012/305992.html 

解决方案

p>来自此处的答案: https://solarianprogrammer.com/2016 / 09/22 / compiling-gcc-6-macos /



您可以安全地忽略所有这些警告,这些警告与GCC生成的汇编代码有关并且与您的C ++代码无关。



不幸的是,目前没有办法指示GCC不使用__textcoal_nt,或者沉默上述警告。一个快速和肮脏的解决方法是过滤编译器的输出如下:

  g ++  -  6 main.cpp -o main 2& 1> / dev / null | grep -v -e'^ / var / folders / *'-e'^ [[:space:]] * \.section'-e'^ [[:space:]] * \ ^ [[:space :]] *〜*'


After updating to Sierra I then updated my Xcode from 7.2.1 to Xcode 8. So the problem might've occurred just by updating Xcode. I downgraded back to 7.2.1 and still got the same issue.

This is the error I get when compiling a C++ program

/var/folders/cj/1h3_84h56c9bgzt_ryhpf4940000gn/T//ccgjxtCM.s:4:11: warning: section "__textcoal_nt" is deprecated
        .section __TEXT,__textcoal_nt,coalesced,pure_instructions
                 ^      ~~~~~~~~~~~~~
/var/folders/cj/1h3_84h56c9bgzt_ryhpf4940000gn/T//ccgjxtCM.s:4:11: note: change section name to "__text"
        .section __TEXT,__textcoal_nt,coalesced,pure_instructions
                 ^      ~~~~~~~~~~~~~
/var/folders/cj/1h3_84h56c9bgzt_ryhpf4940000gn/T//ccgjxtCM.s:54:11: warning: section "__textcoal_nt" is deprecated
        .section __TEXT,__textcoal_nt,coalesced,pure_instructions
                 ^      ~~~~~~~~~~~~~
/var/folders/cj/1h3_84h56c9bgzt_ryhpf4940000gn/T//ccgjxtCM.s:54:11: note: change section name to "__text"
        .section __TEXT,__textcoal_nt,coalesced,pure_instructions

The program still runs, but this message is displayed. Even when the only thing in the code is the class I made called graph and I have code like this the error appears.

void explore(Graph & G, int x)
{
  Node* nodePtr = &G.changeNode(x);
}

I tried doing this in command line and it didn't work

sudo xcode-select -s /Library/Developer/CommandLineTools

This is the build I use in Sublime Text, but even with the other c++ compiler that's not c++11 I get the same error. Error appears on command line too.

{
    "shell_cmd": "g++ -std=c++11 \"${file}\" -o \"${file_path}/${file_base_name}\"",
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "working_dir": "${file_path}",
    "selector": "source.c, source.c++",

    "shell_cmd": "g++ -std=c++11 \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\""
}

The only thing I think can work is using the patches that I've seen on some threads that are on this site

http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151012/305992.html

I have no idea how to use them or run though.

解决方案

An answer from here: https://solarianprogrammer.com/2016/09/22/compiling-gcc-6-macos/

You can safely ignore all these warnings, these are related to the assembly code generated by GCC and have nothing to do with your C++ code.

Unfortunately, at this time, there is no way in which to instruct GCC not to use __textcoal_nt, or silence the above warnings. A quick and dirty workaround is to filter the output of the compiler with something like:

g++-6 main.cpp -o main 2>&1 >/dev/null | grep -v -e '^/var/folders/*' -e '^[[:space:]]*\.section' -e '^[[:space:]]*\^[[:space:]]*~*'

这篇关于警告:段“__ textcoal_nt”是不推荐的,因为更新到Mac OSX Sierra的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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