我有一个c ++的构建脚本,如:
mpic ++ main.cpp tools.cpp treeofdevil.cpp solver.cpp periodicfunction.cpp -o ising -lgurobi_c ++ -lgurobi60 -lpthread -lm -Wall -m64 -fPIE -fexceptions -frounding-math -O2 -I / Library / gurobi604 / mac64 / include / -I / usr / local / include / -I。 -L / Library / gurobi604 / mac64 / lib / -L / usr / local / lib / -lboost_regex -lboost_system -lboost_mpi -lboost_serialization
在我从OSX 10.9 Maverick升级我的Mac之前 - > OSX El Capitan,在OS OSX 10.9中一切正常....但是,在升级之后,当我尝试以相同的方式编译时......我得到了错误......
In file included from /usr/local/Cellar/gcc48/4.8.4/include/c++/4.8.4/bits/postypes.h:40:0,
from /usr/local/Cellar/gcc48/4.8.4/include/c++/4.8.4/iosfwd:40,
from /usr/local/Cellar/gcc48/4.8.4/include/c++/4.8.4/iomanip:39,
from common.h:13,
from main.cpp:13:
/usr/local/Cellar/gcc48/4.8.4/include/c++/4.8.4/cwchar:44:19: fatal error: wchar.h: No such file or directory
#include <wchar.h>
^
compilation terminated.
In file included from /usr/local/Cellar/gcc48/4.8.4/include/c++/4.8.4/bits/postypes.h:40:0,
from /usr/local/Cellar/gcc48/4.8.4/include/c++/4.8.4/iosfwd:40,
from /usr/local/Cellar/gcc48/4.8.4/include/c++/4.8.4/ios:38,
from /usr/local/Cellar/gcc48/4.8.4/include/c++/4.8.4/ostream:38,
from /usr/local/Cellar/gcc48/4.8.4/include/c++/4.8.4/iostream:39,
from tools.h:13,
from tools.cpp:1:
/usr/local/Cellar/gcc48/4.8.4/include/c++/4.8.4/cwchar:44:19: fatal error: wchar.h: No such file or directory
#include <wchar.h>
^
compilation terminated.
In file included from /usr/local/Cellar/gcc48/4.8.4/include/c++/4.8.4/bits/postypes.h:40:0,
from /usr/local/Cellar/gcc48/4.8.4/include/c++/4.8.4/iosfwd:40,
from /usr/local/Cellar/gcc48/4.8.4/include/c++/4.8.4/ios:38,
from /usr/local/Cellar/gcc48/4.8.4/include/c++/4.8.4/ostream:38,
from /usr/local/Cellar/gcc48/4.8.4/include/c++/4.8.4/iostream:39,
from treeofdevil.h:13,
from treeofdevil.cpp:1:
/usr/local/Cellar/gcc48/4.8.4/include/c++/4.8.4/cwchar:44:19: fatal error: wchar.h: No such file or directory
#include <wchar.h>
^
compilation terminated.
In file included from solver.cpp:1:0:
solver.h:16:20: fatal error: unistd.h: No such file or directory
#include <unistd.h>
^
compilation terminated.
In file included from /usr/local/Cellar/gcc48/4.8.4/include/c++/4.8.4/bits/postypes.h:40:0,
from /usr/local/Cellar/gcc48/4.8.4/include/c++/4.8.4/iosfwd:40,
from /usr/local/Cellar/gcc48/4.8.4/include/c++/4.8.4/ios:38,
from /usr/local/Cellar/gcc48/4.8.4/include/c++/4.8.4/ostream:38,
from /usr/local/Cellar/gcc48/4.8.4/include/c++/4.8.4/iostream:39,
from periodicfunction.h:13,
from periodicfunction.cpp:1:
/usr/local/Cellar/gcc48/4.8.4/include/c++/4.8.4/cwchar:44:19: fatal error: wchar.h: No such file or directory
#include <wchar.h>
^
我该怎么办?谢谢。
任何帮助?
尝试更新brew结果:
myname-MacBook-Pro:ising1 myname$ sudo brew update
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- mach (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Library/Homebrew/extend/pathname.rb:2:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Library/Homebrew/global.rb:3:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Library/brew.rb:15:in `<main>'
myname-MacBook-Pro:ising1 myname$
myname-MacBook-Pro:ising1 myname$ sudo brew doctor
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- mach (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Library/Homebrew/extend/pathname.rb:2:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Library/Homebrew/global.rb:3:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Library/brew.rb:15:in `<main>'
myname-MacBook-Pro:ising1 myname$ sudo brew upgrade
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- mach (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Library/Homebrew/extend/pathname.rb:2:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Library/Homebrew/global.rb:3:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Library/brew.rb:15:in `<main>'
第二次更新: 我重新安装自制软件,但一切都错了,所以我跟着 https://www.youtube.com/watch?v=O6WuGENLF18 重新安装gnu编译器...
现在错误看起来像是:
:19086:suffix or operands invalid for `movq'
:5054:suffix or operands invalid for `movq'
:5059:suffix or operands invalid for `movq'
:5959:suffix or operands invalid for `movq'
:6196:suffix or operands invalid for `movq'
答案 0 :(得分:1)
修复您的编译器。操作系统版本升级后,它通常会被破坏。
此命令应该有所帮助:
brew update
brew doctor
brew upgrade
对于在El Capitan上工作的brew,您可能需要重置/ usr / local owner并禁用系统完整性保护csrutil disable