clang: error: unknown argument: '-mno-fused-madd' - python

When installing ReportLab 3.1.8, I ran into the problem where I kept getting the error and I could not find where this compiler option was being set.
The point in setup was:
building 'reportlab.lib._rl_accel' extension
clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
error: command 'cc' failed with exit status 1

Here is my solution.
Cause: I keep my mac up to date and as a result it seems I now have a newer (different) version of the c compiler (clang) than the one that allowed the "-mno-fused-madd" command line switch.
Solution: I did not find the above switch in any file in the reportlab source. It had to be on the computer itself. The culprit seemed to be in the distutils, because setup.py uses module distutils.
The problem was in the file /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_sysconfigdata.py. This file contains definitions as a dictionary named build_time_vars. We are obviously in the right place as we have a build time problem.
First make a copy as a safeguard.
sudo <editor> <file path> to edit the file.
Then editing this file, search for and remove the switch -mno-fused-madd from the file. I found it in line beginning with 'CFLAGS' since this is a compile flag.
Change the line:
... -fwrapv -mno-fused-madd -DENABLE_DTRACE ... to ... -fwrapv -DENABLE_DTRACE ...
Save the file and continue with your build. It will now stay fixed. No need for environment variables or any such thing.
Edit: While you are at it, remove both _sysconfigdata.pyc and _sysconfigdata.pyo files.

You can still repress these errors from clang by using the following environment variables:
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
A detailed answer to a similar question can be found here:
clang error: unknown argument: '-mno-fused-madd' (python package installation failure)
According to the following the issue has also been fixed in OS X 10.9.3:
clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]

Related

fatal error: 'Eigen/Dense' file not found

I am an Ultra Linux newbie, and I am trying to install this program and when I try to build the python wrapper I'd get this
~/Downloads/DeepMimic-master/DeepMimicCore$ make python
clang++ -c -g -std=c++11 -O3 -Wall -fPIC -I./ -I../../libraries/eigen -I../../libraries/bullet3/src -I/usr/include/python3.6m -I/usr/lib/ -lpython3.6m -o objs/Main.o Main.cpp
clang: warning: -lpython3.6m: 'linker' input unused [-Wunused-command-line-argument]
In file included from Main.cpp:3:
In file included from ./DeepMimicCore.h:3:
In file included from ./util/ArgParser.h:6:
./util/MathUtil.h:5:10: fatal error: 'Eigen/Dense' file not found
#include "Eigen/Dense"
You're missing a dependency, Eigen, which is listed under 'Dependencies' in the DeepMimic readme.
I see this problem has been encountered before:
fatal error: Eigen/Dense: No such file or directory
Looks like that program depends on Eigen. Try download Eigen and putting it in the appropriate directory.
Eigen is a template library, so you just have to download it, unzip it, and copy the folder called Eigen inside of the directory of the program.
Eigen website

Error: command 'gcc' failed with exit status 1 while installing crf++

I tried to install crf++ in my macbook. I downloaded CRF++-0.58 from https://taku910.github.io/crfpp/#download. Then I followed the instructins on the official website of crf++.
I firstly entered the folder named CRF++-0.58. Then I typed following code in terminal:
make
sudo make install
cd python
These commands run well. Then I typed
python setup.py install
The output was as following:
running build
running build_py
running build_ext
building '_CRFPP' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/anaconda3/include -arch x86_64 -I/anaconda3/include -arch x86_64 -I/anaconda3/include/python3.7m -c CRFPP_wrap.cxx -o build/temp.macosx-10.7-x86_64-3.7/CRFPP_wrap.o
warning: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on
the command line to use the libc++ standard library instead
[-Wstdlibcxx-not-found]
CRFPP_wrap.cxx:2375:23: warning: explicitly assigning value of variable of type
'int' to itself [-Wself-assign]
res = SWIG_AddCast(res);
~~~ ^ ~~~
CRFPP_wrap.cxx:2378:23: warning: explicitly assigning value of variable of type
'int' to itself [-Wself-assign]
res = SWIG_AddCast(res);
~~~ ^ ~~~
CRFPP_wrap.cxx:2900:9: warning: variable 'res' is used uninitialized whenever
'if' condition is true [-Wsometimes-uninitialized]
if (PyType_Ready(tp) < 0)
^~~~~~~~~~~~~~~~~~~~
CRFPP_wrap.cxx:2924:10: note: uninitialized use occurs here
return res;
^~~
CRFPP_wrap.cxx:2900:5: note: remove the 'if' if its condition is always false
if (PyType_Ready(tp) < 0)
^~~~~~~~~~~~~~~~~~~~~~~~~
CRFPP_wrap.cxx:2881:10: note: initialize the variable 'res' to silence this
warning
int res;
^
= 0
CRFPP_wrap.cxx:2981:10: fatal error: 'stdexcept' file not found
#include <stdexcept>
^~~~~~~~~~~
4 warnings and 1 error generated.
error: command 'gcc' failed with exit status 1
Then I searched the error "error: command 'gcc' failed with exit status 1" online. And I found people who had similar problems. I tried some of their solutions but none of them worked.
I tried to install python-dev to solve this problem but failed.
(base) localhost:python dxm$ brew install python3-dev
Error: No available formula with the name "python3-dev"
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
git -C "$(brew --repo homebrew/core)" fetch --unshallow
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...`enter code here`
==> Searching taps on GitHub...
Error: No formulae found in taps.
So how could I solve this problem?
I found apple gave a way to install crf++ which seems totally different with what I tried: http://macappstore.org/crf/
After installing by this way, I can use crf++ like this:
crf_train = "crf_learn -f 3 template.txt dg_train.txt dg_model"
os.system(crf_train)
crf_test = "crf_test -m dg_model dg_test.txt -o dg_result.txt"
os.system(crf_test)

Python: RuntimeError: invalid slot offset when importing a module

I am getting above error when trying to import ssl module.
In fact, the error showed up during the build and _ssl module was added to the failed module list.
However, the compilation and link went well.
There was no error on compilation and link phases, only some warnings. However, during Python build, there is an import phase right after the link, which shows the same error as stated.
building '_ssl' extension
xlc_r -DNDEBUG -O -IInclude -I. -I/usr/local/include -c /aix/Modules/_ssl.c -o build/temp.aix-6.1-3.3/aix/Modules/_ssl.o
"/aix/Modules/_ssl.c", line 262.17: 1506-196 (W) Initialization between types "void*" and "struct _object*(*)(struct {...}*)" is not allowed.
/aix/Modules/ld_so_aix xlc_r -bI:/aix/Modules/python.exp build/temp.aix-6.1-3.3/aix/Modules/_ssl.o -L/usr/local/lib -lssl -lcrypto -o build/lib.aix-6.1-3.3/_ssl.so
ld: 0711-224 WARNING: Duplicate symbol: .bcopy
ld: 0711-224 WARNING: Duplicate symbol: .memcpy
ld: 0711-224 WARNING: Duplicate symbol: .memmove
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
*** WARNING: importing extension "_ssl" failed with build/lib.aix-6.1-3.3/_ssl.so: <class 'RuntimeError'>: invalid slot offset: <traceback object at 0x3017e9e0>
Could anyone shed some lights on how to get it work?
Env:
Python: 3.3.2
OpenSSL: 0.9.8y (also tried 0.9.7)
OS: AIX 6.1 (also tried on HPUX_1131_IA)
Thanks in advance!
For future reference:
This is solved, there are different versions of SSL, and the error happened when the wrong one was chosen and the setup.py was messed up.

install gcc4.0 on mac os x 10.8

I am trying to read and learn the pytho2.5.6 source code, and try to recompile the code everytime i make some change on it.
But it doesn't seem to work when I comile the source code via the following commands:
./configure --prefix=/path/to/somewhere/that/don't/messup/myenv/
make
After make, the console just show errors like this:
cc1: error: unrecognized command line option "-Wno-long-double"
I search the google , and it seems like the gcc(4.2.1) that i am using is not compatiable with the python2.5.6.
some info of my sys:
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Xcode 4.6.2(installed via the xcode command cline tool )
python2.5.6 source code(download from python.org)
I have try some solutions like these:
1.download diff python code version , like 2.5.4, and do the steps again.
2.after configure,modify the Makefile,and remove the --Wno-long-double,but new errors showed like below:
➜ Python-2.5.6 make
gcc -c -fno-strict-aliasing -no-cpp-precomp -mno-fused-madd -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -o Python/mactoolboxglue.o Python/mactoolboxglue.c
In file included from Include/Python.h:57,
from Python/mactoolboxglue.c:26:
Include/pyport.h:547: warning: ‘struct winsize’ declared inside parameter list
Include/pyport.h:547: warning: its scope is only this definition or declaration, which is probably not what you want
Include/pyport.h:548: warning: ‘struct winsize’ declared inside parameter list
In file included from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:67,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:38,
from /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/CarbonCore.h:18,
from /System/Library/Frameworks/CoreServices.framework/Frameworks/AE.framework/Headers/AE.h:20,
from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:18,
from /System/Library/Frameworks/Carbon.framework/Headers/Carbon.h:20,
from Include/pymactoolbox.h:10,
from Python/mactoolboxglue.c:27:
/usr/include/AvailabilityMacros.h:109:14: warning: #warning Building for Intel with Mac OS X Deployment Target < 10.4 is invalid.
In file included from Python/mactoolboxglue.c:27:
.......
Python/mactoolboxglue.c: In function ‘MediaObj_Convert’:
Python/mactoolboxglue.c:431: error: ‘cobj’ undeclared (first use in this function)
Python/mactoolboxglue.c:431: error: too many arguments to function ‘PyMacGluePtr_MediaObj_Convert’
make: *** [Python/mactoolboxglue.o] Error 1
So, i wonder if there are some way to intall gcc4.0 manually?
PS:the reason why i use python2.5.6 is because i read a book called which is written in chinese.Or maybe the best solution is to read the 2.7 source code =.=....hmmm.....

A multitude of problems trying to install Python bcrypt on Windows (x64)

This problem has been mentioned elsewhere, but it does not provide a working solution, so I would still like to keep a ticket open.
c:\Users\me\Desktop\temp\py-bcrypt-0.2>setup.py install build --compiler=min
gw32
running install
running build
running build_py
running build_ext
building 'bcrypt._bcrypt' extension
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -IC:\Python27\include -IC:\Python27\PC -c bcrypt/bcrypt_python.c -o build\temp.win32-2.7\Release\bcrypt\bcrypt_python.o
bcrypt/bcrypt_python.c:29:26: error: expected declaration specifiers or '...' before 'u_int8_t'
bcrypt/bcrypt_python.c:29:38: error: expected declaration specifiers or '...' before 'u_int16_t'
bcrypt/bcrypt_python.c:29:49: error: expected declaration specifiers or '...' before 'u_int8_t'
bcrypt/bcrypt_python.c: In function 'bcrypt_encode_salt':
bcrypt/bcrypt_python.c:56:2: error: too many arguments to function 'encode_salt'
bcrypt/bcrypt_python.c:29:6: note: declared here
error: command 'gcc' failed with exit status 1
This is after getting rid of the initial “error: Setup script exited with error: Unable to find vcvarsall.bat”, I am left with what seems like a Gordic knot. pip and easy-install do not work. I have also read a number of other articles.
I don’t need to implement bcrypt at the moment, so it is not an urgent matter, but obviously, implementing a secure password protection is vital.
The simplest way I found was to download and install windows binaries, rather than trying to compile myself. This guy has some on bitbucket
supposing you are using mingw64, you should change _MSC_VER in _WIN32 on ifdefs into bcrypt.c, bcrypt_python.c and pybc_blf.h
(I've also replied the other question)

Categories

Resources