I am trying to install pycrypto package on Mac OS X by running following command :
ARCHFLAGS=-Wno-error CFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib sudo -E pip install pycrypto**
But it fails and show following error :
/usr/bin/clang -bundle -undefined dynamic_lookup -isysroot
/Developer/SDKs/MacOSX10.6.sdk -g -L/opt/local/lib -Wno-error
-L/opt/local/lib -I/opt/local/include -Wno-error build/temp.macosx-10.6-x86_64-3.4/src/_fastmath.o -lgmp -o
build/lib.macosx-10.6-x86_64-3.4/Crypto/PublicKey/_fastmath.so
ld: library not found for -lSystem
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
error: command '/usr/bin/clang' failed with exit status 1
ld: library not found for -lgmp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
For the error above, the following works for me on Yosemite.
brew install gmp
export LIBRARY_PATH=/usr/local/lib
pip install pycrypto
I have fixed this by running following command -
CFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -I/usr/local/include" LDFLAGS="-L/usr/local/lib" pip install pycrypto
Issue was that my default '-isysroot' was pointing to 10.6 SDK and clang file was from 10.9 SDK.
-Gaurav
I had this issue on MacOs Catalina and I don't have /Applications/Xcode.app folder (I guess because I don't have Xcode App), so I used another SDK path
CFLAGS="-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include" LDFLAGS="-L/usr/local/lib" pip install pycrypto
and it worked.
Related
I'm trying to install pycurl2 with pip (pip install 'pycurl2==7.20.0'), but it's failing on this clang command:
clang -bundle -undefined dynamic_lookup -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/openssl#1.1/lib -L/Users/ed/.pyenv/versions/2.7.17/lib -L/usr/local/opt/openssl/lib -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sasl build/temp.macosx-10.15-x86_64-2.7/src/pycurl.o -lcurl -o build/lib.macosx-10.15-x86_64-2.7/pycurl2.so /usr/lib/libcurl.#libext# #LDFLAGS# #LIBCURL_LIBS#
clang: error: no such file or directory: '/usr/lib/libcurl.#libext#'
clang: error: no such file or directory: '#LDFLAGS#'
clang: error: no such file or directory: '#LIBCURL_LIBS#'
error: command 'clang' failed with exit status 1
If you look at the last part of the clang command (/usr/lib/libcurl.#libext# #LDFLAGS# #LIBCURL_LIBS#) it looks like for some reason the installer is not substituting the actual values of LDFLAGS, etc. when generating the command and leaving in the placeholders (marked with #).
Does anyone know what's wrong, or how to fix the clang command?
I am running the command
gcc -o openmptest -fopenmp openmptest.c
however am getting the error:
clang: error: unsupported option '-fopenmp'
I am running this on Mac Mojave. In addition I am using VS code which is telling me
cannot open source file "omp.h"
for my include statement.
I think it could work if you install libomp by
brew install libomp
and then,
clang -Xpreprocessor -fopenmp -I/usr/local/include -L/usr/local/lib -lomp openmptest.c -o main
This should work, I was having the same issue and and managed to compile my code by using the above.
I'm trying to install rJava on MacOS Sierra. Have to tried the tips and guides elsewhere for other other version MacOS such as https://github.com/snowflakedb/dplyr-snowflakedb/wiki/Configuring-R-rJava-RJDBC-on-Mac-OS-X
and Install xlsx and rJava on Mac
but it does not work out. Much appreciate any help. Thanks.
My Mac version: macOS Sierra, version 10.12.15
My R version: 3.4.0 (2017-04-21)
My Rstudio version: Version 0.99.903
Java version:
bash-3.2$ /usr/libexec/java_home -V
bash-3.2$ java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
bash-3.2$ R CMD javareconf
Java interpreter : /usr/bin/java
Java version : 1.8.0_131
Java home path : /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre
Java compiler : /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar
Non-system Java on macOS
trying to compile and link a JNI program
detected JNI cpp flags : -I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/darwin
detected JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/../include -I/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/../include/darwin -I/usr/local/include -fPIC -Wall -g -O2 -c conftest.c -o conftest.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o conftest.so conftest.o -L/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/server -ljvm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
JAVA_HOME : /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre
Java library path: $(JAVA_HOME)/lib/server
JNI cpp flags : -I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/darwin
JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
Updating Java configuration in /Library/Frameworks/R.framework/Resources
override rw-r--r-- root/admin for /Library/Frameworks/R.framework/Resources/etc/Makeconf? (y/n [n]) n
not overwritten
override rw-r--r-- root/admin for /Library/Frameworks/R.framework/Resources/etc/ldpaths? (y/n [n]) n
not overwritten
Done.
When I tried to install rJava, I ran
`R --quiet -e 'install.packages("rJava", type="source", repos="http://cran.us.r-project.org")`
I got the errors:
clang: error: unsupported option '-fopenmp'
make[2]: *** [libjri.jnilib] Error 1
make[1]: *** [src/JRI.jar] Error 2
make: *** [jri] Error 2
ERROR: compilation failed for package ‘rJava’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava’
The downloaded source packages are in
‘/private/var/folders/w8/ksbj8dh15bz2lkss7h2tpzk80000gn/T/Rtmp6r9HI0/downloaded_packages’
Warning message:
In install.packages("rJava", type = "source", repos = "http://cran.us.r-project.org") :
installation of package ‘rJava’ had non-zero exit status
I ran:
"curl -#ROL https://www.rforge.net/rJava/snapshot/rJava_0.9-8.tar.gz
R CMD INSTALL rJava_0.9-8.tar.gz"
and got the following error messages:
clang: error: unsupported option '-fopenmp'
make[2]: *** [libjri.jnilib] Error 1
make[1]: *** [src/JRI.jar] Error 2
make: *** [jri] Error 2
ERROR: compilation failed for package ‘rJava’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava’
I dont know what to do. Thanks for your help.
This article here solved this fopenmp issue for me on macOS Sierra 10.12.4. I outlined the solution here but also below. The problem is that forenmp option is not supported in macOS gcc so we have to compile a new version of the gcc.
Solution to forenmp problem
I have tested this with Homerew's r-app brew cask install r-app and Oracle's JDK. Then I did the following
brew install homebrew/versions/gcc49 --without-multilib #Long ~70min compiling...
sudo chown -R $(whoami):admin /usr/local
brew link --overwrite --force gcc49
brew unlink gcc49 && brew link gcc49
brew install llvm
mkdir ~/.R; touch ~/.R/Makevars
echo "VER=-4.9
CC=gcc$(VER)
CXX=g++$(VER)
CXX1X=g++$(VER)
CFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion
CXXFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion
FLIBS=-L/usr/local/Cellar/gcc/4.9.3/lib/gcc/4.9" > ~/.R/Makevars
and now
sudo R CMD javareconf
Rscript -e 'install.packages("rJava", repos="http://rforge.net", type="source")'
and now rJava is working!
Comments using OSX 10.12.6 with Java 1.8.0_181 and dealing with the above issue and another issue related to compiling rJava.
First:
Install rJava with these commands:
wget https://cran.r-project.org/src/contrib/rJava_0.9-10.tar.gz
tar xvfz rJava_0.9-10.tar.gz
cd rJava
R CMD INSTALL rJava
Why use R CMD INSTALL? This will keep the config.log file that will allow you to debug things; install.packages() does not and help you get might not be very helpful in that case (e.g. https://github.com/s-u/rJava/issues/111).
Second:
Make sure you run the following, if you've updated Java (remember you need the JDK, not JRE).
sudo R CMD javareconf
Error (checking JNI data types):
To fix this error:
checking JNI data types... configure: error: One or more JNI types differ from the corresponding native type. You may need to use non-standard compiler flags or a different compiler in order to fix this.
do this:
sudo ln -f -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib
sudo ln -f -s /usr/local/lib/libjvm.dylib /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/
Error (unsupported option '-fopenmp):
To fix this error:
clang: error: unsupported option '-fopenmp
do the following:
Note: The instructions may need to be modified for newer versions of gcc, but make sure you get a version greater than 7 (see notes that follow); the following command can be used to find out the available versions:
brew search gcc
Then install gcc:
brew install gcc#7
sudo chown -R $(whoami):admin /usr/local
brew link --overwrite --force gcc#7
brew unlink gcc#7 && brew link gcc#7
brew install llvm
mkdir -p ~/.R
## Check the versions and folder in FLIBS match what you install
echo "CC=gcc-7
CXX=g++-7
CXX1X=g++-7
CFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion
CXXFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion
FLIBS=-L/usr/local/Cellar/gcc\#7/7.3.0/lib/gcc/7" > ~/.R/Makevars
Notes: You need any version of gcc greater than 7; the without-multilib flag mentioned in the earlier answer may not be available, but it is important. Why the without-multilib flag?: https://thecoatlessprofessor.com/programming/openmp-in-r-on-os-x/ and OpenMP/gcc on macOS : gcc --without-multilib not available
Then install rJava
R CMD INSTALL rJava
Finally, test library (you should see your Java version):
library(rJava)
.jinit()
.jcall("java/lang/System", "S", "getProperty", "java.runtime.version")
Take a look here:
http://www.owsiak.org/?p=3671
You can find quite detailed description of how to deal with rJava in macOS.
Make sure to install JDK that is provided by Oracle before you proceed.
I am trying to install Lektor on a MacbookPro with OS X 10.6.8.
Imagemagick and Python2.7 are already installed.
When I run the installation command:
curl -sf https://www.getlektor.com/install.sh | sh
The build process runs until it gets an error when building '_watchdog_fsevents' extension. The error is:
cc1: error: -Werror=unused-command-line-argument-hard-error-in-future: No option -Wunused-command-line-argument-hard-error-in-future
I've cut and pasted the output just prior to the error into the following code section.
How should I overcome this?
running build_ext
building '_watchdog_fsevents' extension
creating build/temp.macosx-10.6-x86_64-2.7
creating build/temp.macosx-10.6-x86_64-2.7/src
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -Wno-error=unused-command-line-argument-hard-error-in-future -DWATCHDOG_VERSION_STRING="0.8.3" -DWATCHDOG_VERSION_MAJOR=0 -DWATCHDOG_VERSION_MINOR=8 -DWATCHDOG_VERSION_BUILD=3 -I/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/watchdog_fsevents.c -o build/temp.macosx-10.6-x86_64-2.7/src/watchdog_fsevents.o -std=c99 -pedantic -Wall -Wextra -fPIC -Wno-error=unused-command-line-argument-hard-error-in-future
cc1: error: -Werror=unused-command-line-argument-hard-error-in-future: No option -Wunused-command-line-argument-hard-error-in-future
cc1: error: -Werror=unused-command-line-argument-hard-error-in-future: No option -Wunused-command-line-argument-hard-error-in-future
error: command 'gcc-4.2' failed with exit status 1
----------------------------------------
Failed building wheel for watchdog
Failed to build watchdog
Most likely your version of OS X is too old to support the installation of watchdog with the version of gcc you have. If you cannot upgrade your OS X installation then I recommend installing a recent version of clang via brew and install lektor after exporting CC=clang.
Note though that Lektor is not tested for OS X < 10.9.
Your problem may be an updated version of Xcode in which you have not agreed to the license. Try running this first:
sudo xcodebuild -license
scroll to the very bottom and it will allow you to type "agree".
This resolved the issue for me.
I am trying to install a python module (SPArse Modeling Software) but the install script doesn't seem to be able to find the system's default Python.framework. This is an almost new (no migration assistant) Mac OS 10.9.5 system with both the default system python and Anaconda installed. I briefly installed Enthought Canopy but removed it when I decided to go with Anaconda. /System/Library/Frameworks/Python.framework exists and seems to have all the files you would expect.
In terminal, this is what happens:
bash-3.2$ which python
//anaconda/bin/python
bash-3.2$ cd spams-python
bash-3.2$ python setup.py build
running build
running build_py
running build_ext
building '_spams_wrap' extension
gcc -fno-strict-aliasing -I//anaconda/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -Ispams/linalg -Ispams/prox -Ispams/decomp -Ispams/dictLearn -I//anaconda/lib/python2.7/site-packages/numpy/core/include -I/usr/include/python2.7/ -I//anaconda/include/python2.7 -c spams_wrap.cpp -o build/temp.macosx-10.5-x86_64-2.7/spams_wrap.o -DNDEBUG -DUSE_BLAS_LIB -fPIC -fopenmp -m32
clang: warning: argument unused during compilation: '-fopenmp'
#Omitting some irrelevant (I think) warnings#
4 warnings generated.
gcc -bundle -undefined dynamic_lookup -L//anaconda/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.5-x86_64-2.7/spams_wrap.o -L//anaconda/lib -lstdc++ -lblas -llapack -o build/lib.macosx-10.5-x86_64-2.7/_spams_wrap.so -m32 -framework Python
ld: framework not found Python
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'gcc' failed with exit status 1
So, my question is, is my diagnosis of the problem correct? How can I tell GCC where Python.framework is? Is there some environment variable that isn't set correctly?
The Anaconda Python is not a Framework build of Python. If the module expects that it's not going to work. Commenting out commenting out "'-framework', 'Python'" in setup.py sounds like a good start, and if it works, then it probably is the right solution.
Compile it with gcc-5, and I successed.