Xcode 6 throws clang error while compiling - xcode

I have recently updated my Xcode to version 6.0 (6A313). Now, during the compilation I get the following error:
clang: error: unknown argument: '-wall'
From Clang Compiler User's Manual, I found out that this flag is responsible for enabling all warnings. I have also read many posts on the temporary fix for Apple LLVM Compiler for Xcode 5.1, where users would downgrade all clang errors to warnings with:
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future easy_install ExtensionName
However, that does not help me, as there is no such extension as "all". So I am stuck at this point and any suggestions would be appreciated.
Also, I have upgraded to Ruby 2.1.1 (from 2.0.x), but that did not seem to help either.

The argument is -Wall, not -wall.

Related

Unable to compile C++ code after Xcode upgrade: <sys/cdefs.h> no such file or directory

After upgrading macOS BigSur to 11.1 and Xcode to 12.3 this morning my MacPorts 2.6.4 distribution started to have problems. I can no longer compile a simple C++ program with the GNU C++ v10.2.0_4:
g++ -O3 -std=c++11 -c libvec.cpp
In file included from /opt/local/include/gcc10/c++/cmath:45,
from libvec.cpp:1:
/opt/local/lib/gcc10/gcc/x86_64-apple-darwin20/10.2.0/include-fixed/math.h:45:10: fatal error: sys/cdefs.h: No such file or directory
45 | #include <sys/cdefs.h>
| ^~~~~~~~~~~~~
compilation terminated.
Preliminary internet search suggests that this problem may be caused by the inconsistency with the Xcode command line tools. Would you please direct me, on how to debug and fix it? Maybe I need to reinstall the MacPorts distribution after such an upgrade? Thank you!
This issue is indeed caused by the macOS update from 11.0 to 11.1 and Xcode update from 12.2 to 12.3. Apple's new policy is to increment the SDK version with each system update. The MacPorts GNU C++ compiler installed with a previous SDK version fails now due to this increment. A quick workaround is to set the SDKROOT environment variable to match the new version number:
export SDKROOT=`xcrun --show-sdk-path`
Place this command into your ~/.profile file for convenience. Detailed issue explanation and this solution may be found in the following thread on MacPorts mailing list.

Could not build gem5 on a machine with anaconda: "lto1: fatal error: bytecode stream"

When I tried to build gem5 with command scons build/X86/gem5.opt -j12, I received an error message saying
lto1: fatal error: bytecode stream in file '/home/beihai/anaconda3/lib/python3.8/config-3.8-x86_64-linux-gnu/libpython3.8.a' generated with LTO version 6.0 instead of the expected 8.1
I think it might be the problem of wrong gcc version. But I do not know how to fix it.
My system is Kubuntu 20.04
By running gcc -v, I got the global gcc version gcc version 9.3.0
By running /home/beihai/anaconda/envs/gem5build/bin/x86_64-conda_cos6-linux-gnu-gcc -v, I got the anaconda gcc version gcc version 7.3.0 (crosstoll-NG 1.23.0.449-a04d0)
Please tell me how to fix this problem.
I came across almost the same issue, except that mine said "LTO version 6.0 instead of the expected 6.2".
I searched for general solution for LTO compatibility issue and got some inspiration from this link: https://github.com/rust-lang/rust/issues/57176
Quick take from the above link: "I've looked into how this is related to python and found that the error only happens with python installed through anaconda."
So I removed my entire anaconda software package, and removed the build directory inside Gem5, and rerun the scon commands with an additional "--force-lto" arguments, now the installation is successful. Hope it can solve your issue as well.
The command I used: "scons --force-lto build/X86/gem5.opt -j6"
My setups is:
Ubuntu 18 withe kernel 4.15.0-134-generic
g++ --version = g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0

Cython compilation errors: '-mno-fused-madd'

Whenever I compile Cython code (using pyximport) and frequently when I install packages from source (with pip) I get
clang: warning: argument unused during compilation: '-mno-fused-madd'
What is this warning and what can I do to prevent it? I suspect I may not be able to prevent when pip triggers it, but is thre at least some way to configure pyximport to avoid it?
OS X 10.9, Python 2.7.5, Xcode clang 500.2.79
The answer before didn't work for me, but it worked this to tell clang to ignore these error messages:
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
Solution found in clang error: unknown argument: '-mno-fused-madd' (python package installation failure)
-mno-fused-madd is a gcc cpu target option. It is for enabling/disabling the generation of the fused multiply/add instructions (FMACs. Common in DSPs).
Since this is gcc-specific, clang gives a warning that it doesn't understand the option.
If you really don't want to see this warning you could try setting the default compiler by
env CC=/usr/bin/gcc pip install ...
This should also work for pyximport too (But I haven't tried).

run using KLEE error

I am new to Klee, so I started to make the tutorials.
If for compilation I use:
llvm-gcc --emit-llvm -c -g get_sign.c and then I try to run using klee get_sign.o I get the error : KLEE: ERROR: error loading program 'get_sign.o': Invalid MODULE_CODE_GLOBALVAR record . The error is defined in the BitcodeReader.cpp file http://llvm.org/docs/doxygen/html/BitcodeReader_8cpp_source.html at line 01594.
clang (that I have used succesfully for my LLVM passes), it appears that is not possible to use it: KLEE: ERROR: error loading program 'get_sign.o': Invalid bitcode signature .
Do you know what I can do?
Also, it would be nice to give Klee inputs compiled with Clang that I already use for my passes, but as the error suggest, it is possible?
Thank you in advance !
The problem is that I installed Klee over LLVM 3.1. In the instructions from http://klee.llvm.org/GetStarted.html it is mentioned that Klee is fully compatible with LLVM 2.9. It is mentioned : "KLEE is currently tested only on Linux x86-32 and x86-64 targets, using LLVM 2.9. KLEE will not work with older LLVM versions (e.g., 2.5), and might not work with newer versions (e.g., 3.0).".
I installed Klee on LLVM 2.9 and it is working perfectly.

OpenCV compilation error with gcc 4.3 or above in MAC OS X

I want to use BRIEF and ORB in OpenCV and in order to use SSE4.2 (to speed up matching) in OpenCV, we need to compile OpenCV with gcc 4.3 or above and SSE4.2 option enabled.
I have no problem compiling OpenCV with gcc4.2.1 which is the default version in my Mac OS X 10.6.8.
Then, I have tried using Macports to install gcc4.3, 4.4, 4.5, 4.6, 4.7, 4.8 and switched gcc to the new one. I first tried installing OpenCV with default settings like instruction in OpenCV website. But I couldn't compile the code like when I used gcc4.2.1. Please note that, no problem with gcc4.2.1. Problems happen with gcc4.3 or above.
Could you please give me an advice where the problems come from? It seems that the errors come from compiler compatibility.
Some errors are:
OpenCV-2.4.0/modules/highgui/src/window_cocoa.mm: In function 'void cvDestroyAllWindows()':
OpenCV-2.4.0/modules/highgui/src/window_cocoa.mm:198:21: error: expected ';' before 'in'
OpenCV-2.4.0/modules/highgui/src/window_cocoa.mm:198:21: error: 'in' was not declared in this scope
OpenCV-2.4.0/modules/highgui/src/window_cocoa.mm:198:24: error: expected ';' before 'list'
In file included from /opt/local/include/libavformat/avformat.h:42:0,
from OpenCV-2.4.0/modules/highgui/src/ffmpeg_codecs.hpp:78,
from OpenCV-2.4.0/modules/highgui/src/cap_ffmpeg_impl.hpp:56,
from OpenCV-2.4.0/modules/highgui/src/cap_ffmpeg.cpp:45:
/opt/local/include/libavcodec/avcodec.h:554:1: internal compiler error: Segmentation fault
Please submit a full bug report,
The issue is that for(NSString *key in list) in window_cocoa.mm is an Objective-C 2 construct and is compiled as Objective-C++
gcc from GNU does not support the version 2 syntax and so cannot compile this. gcc4.2 from Apple includes Apple extensions including Objective C 2 but pure gcc does not.
You'll have to try the clang compiler.

Resources