gem install unf_ext -v '0.0.6' fails on Mountain Lion mac - c++

This is the error I get when I run bundle install
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/sam/.rvm/rubies/ree-1.8.7-2012.02/bin/ruby extconf.rb
checking for main() in -lstdc++... yes
checking for ruby/encoding.h... no
creating Makefile
CXX is automatically set to g++-4.6
make
g++-4.6 -I. -I/opt/local/include -I. -I/Users/sam/.rvm/rubies/ree-1.8.7-2012.02/lib/ruby/1.8/i686-darwin12.5.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -g -O2 -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl098/include -fno-common -pipe -fno-common -c unf.cc
make: g++-4.6: No such file or directory
make: *** [unf.o] Error 1
Gem files will remain installed in /Users/sam/.rvm/gems/ree-1.8.7-2012.02#global/gems/unf_ext-0.0.6 for inspection.
Results logged to /Users/sam/.rvm/gems/ree-1.8.7-2012.02#global/gems/unf_ext-0.0.6/ext/unf_ext/gem_make.out
An error occurred while installing unf_ext (0.0.6), and Bundler cannot continue.
Make sure that `gem install unf_ext -v '0.0.6'` succeeds before bundling.
It looks like g++ 4.6 is missing.
which g++ returns /usr/bin/g++ but which g++-4.6 returns nothing.
I definitely have Xcode Developer Tools installed. I'm not really sure what to do. How can I get bundle install to succeed?

Installed fine using jruby. Seems to be a problem with the ree version I was using.

Related

cannot install rJava on macOS Catalina 10.15.1

My mac system is macOS Catalina 10.15.1, and my R version is 3.6.1. When I try to install the rJava package on Rstudio using install.packages("rJava", type="source), it comes with error:
make: *** [jri_glue.o] Error 1
ERROR: compilation failed for package ‘rJava’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava’
Warning in install.packages :
installation of package ‘rJava’ had non-zero exit status
I have tried sudo R CMD javareconf and then reinstall the rJava package but it does not work. When I use sudo R CMD javareconf on terminal, it shows that
ava interpreter : /usr/bin/java
Java version : 13.0.2
Java home path : /Library/Java/JavaVirtualMachines/jdk-13.0.2.jdk/Contents/Home
Java compiler : /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar
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
gcc-7 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/Library/Java/JavaVirtualMachines/jdk-13.0.2.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/jdk-13.0.2.jdk/Contents/Home/include/darwin -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -mtune=native -g -O2 -Wall -pedantic -Wconversion -c conftest.c -o conftest.o
gcc-7 -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/jdk-13.0.2.jdk/Contents/Home/lib/server -ljvm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
JAVA_HOME : /Library/Java/JavaVirtualMachines/jdk-13.0.2.jdk/Contents/Home
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
Done.
This problem happened before and I use this solution trouble installing and loading rJava on mac El Capitan. But when my mac is updated to Catalina 10.15.1, the solution does not work. I am not familiar with java. How to install rJava successfully in such situation?

libswscale/swscale.h: No such file or directory

When installing Sumo-0.30.0 on Ubuntu 16.04, make resulted in the following error:
make[4]: Entering directory '/home/<path>/sumo-0.30.0/src/gui'
g++ -DHAVE_CONFIG_H -I. -I../../src -I/home/<path>/sumo-0.30.0/./src -I/usr/include/ffmpeg -I/usr/local/include -I/usr/include/fox-1.6 -I/usr/include/gdal -I/usr/local/include -I/usr/include -msse2 -mfpmath=sse -O2 -DNDEBUG -MT GUIViewTraffic.o -MD -MP -MF .deps/GUIViewTraffic.Tpo -c -o GUIViewTraffic.o GUIViewTraffic.cpp
In file included from GUIViewTraffic.cpp:36:0:
../../src/utils/gui/div/GUIVideoEncoder.h:58:32: fatal error: libswscale/swscale.h: No such file or directory
compilation terminated.
Makefile:449: recipe for target 'GUIViewTraffic.o' failed
Having installed all the prerequisite libraries as mentioned in Installing/Linux Build Libraries and verifying my ffmpeg version is the latest one, I proceeded with ./configure command from installation guide which was successful. The last lines of ./configure result shows that ffmpeg is enabled.
Optional features summary
-------------------------
Enabled: TRACI PROJ GDAL GUI ffmpeg
Disabled: Debug Profiling Coverage PIC UnitTests Python OSG
I could neither locate libswscale directory nor swscale.h even after going through similar post here.
According to another post here, someone mentions that on Ubuntu the problem is that ffmpeg package does not install swscale.h.
How do I fix this?
Install the libswscale-dev package. It provides /usr/include/*/libswscale/swscale.h.

Installing mod_wsgi for Python 3.7 virtualenv

Trying to install mod_wsgi for Python 3.7 to complete setup of Django. But it fails with following error message
Collecting mod-wsgi
Using cached https://files.pythonhosted.org/packages/9e/37/dd336068ece37c43957aa337f25c59a9a6afa98086e5507908a2d21ab807/mod_wsgi-4.6.4.tar.gz
Building wheels for collected packages: mod-wsgi
Running setup.py bdist_wheel for mod-wsgi ... error
Complete output from command /home/user/myproject_env/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-9hnl4thc/mod-wsgi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-a9t55ene --python-tag cp37:
WARNING: The Python installation you are using does not appear to have
been installed with a shared library, or in the case of MacOS X, as a
framework. Where these are not present, the compilation of mod_wsgi may
fail, or if it does succeed, will result in extra memory being used by
all processes at run time as a result of the static library needing to
be loaded in its entirety to every process. It is highly recommended
that you reinstall the Python installation being used from source code,
supplying the '--enable-shared' option to the 'configure' script when
configuring the source code prior to building and installing it.
...
running build_ext
building 'mod_wsgi.server.mod_wsgi-py37' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/src
creating build/temp.linux-x86_64-3.7/src/server
...
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/httpd -I/home/user/python/include/python3.7m -c src/server/wsgi_stream.c -o build/temp.linux-x86_64-3.7/src/server/wsgi_stream.o -I/usr/include/httpd -I. -I/usr/include/apr-1 -DLINUX -D_REENTRANT -D_GNU_SOURCE -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -pthread -I/usr/include/apr-1 -I/usr/include/apr-1
gcc -pthread -shared build/temp.linux-x86_64-3.7/src/server/wsgi_thread.o build/temp.linux-x86_64-3.7/src/server/mod_wsgi.o build/temp.linux-x86_64-3.7/src/server/wsgi_buckets.o build/temp.linux-x86_64-3.7/src/server/wsgi_memory.o build/temp.linux-x86_64-3.7/src/server/wsgi_interp.o build/temp.linux-x86_64-3.7/src/server/wsgi_restrict.o build/temp.linux-x86_64-3.7/src/server/wsgi_logger.o build/temp.linux-x86_64-3.7/src/server/wsgi_server.o build/temp.linux-x86_64-3.7/src/server/wsgi_convert.o build/temp.linux-x86_64-3.7/src/server/wsgi_metrics.o build/temp.linux-x86_64-3.7/src/server/wsgi_validate.o build/temp.linux-x86_64-3.7/src/server/wsgi_daemon.o build/temp.linux-x86_64-3.7/src/server/wsgi_apache.o build/temp.linux-x86_64-3.7/src/server/wsgi_stream.o -o build/lib.linux-x86_64-3.7/mod_wsgi/server/mod_wsgi-py37.cpython-37m-x86_64-linux-gnu.so -L/home/user/python/lib -L/home/user/python/lib/python3.7/config-3.7m-linux -lpython3.7m
/usr/bin/ld: /home/user/python/lib/libpython3.7m.a(abstract.o): relocation R_X86_64_32S against symbol `_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC
...
/usr/bin/ld: /home/user/python/lib/libpython3.7m.a(getopt.o): relocation R_X86_64_32S against `.rodata.str4.4' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /home/user/python/lib/libpython3.7m.a(parser.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/home/user/myproject_env/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-9hnl4thc/mod-wsgi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-fxo44dv3/install-record.txt --single-version-externally-managed --compile --install-headers /home/user/myproject_env/include/site/python3.7/mod-wsgi" failed with error code 1 in /tmp/pip-install-9hnl4thc/mod-wsgi/
Here is the version information:
Apache 2.4.6
CentOS 7
Python 3.7.0
Django 2.0.5
Edit:
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)
httpd-devel-2.4.6-80.el7.centos.1.x86_64
As is documented in mod_wsgi documentation, your issue is lack of shared library for Python.
http://modwsgi.readthedocs.io/en/develop/user-guides/installation-issues.html#lack-of-python-shared-library
http://modwsgi.readthedocs.io/en/develop/user-guides/installation-issues.html#mixing-32-bit-and-64-bit-packages
If installing Python from source code yourself, also read:
http://blog.dscpl.com.au/2015/06/installing-custom-python-version-into.html
Ignore that talks about docker. Same issues arise. You have to be careful about selecting configure options.
As the warning from installation indicates, you're attempting to install mod-wsgi into a python which does not provide a shared object.
When compiling python from source, add the --enable-shared flag so that it produces a libpython#.#.so shared object which can be linked against
Thanks #Graham Dumpleton for sharing the useful links.
I have installed python from source packages with only --enable-shared, so got error "python: error while loading shared libraries: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory" when tried to install packages via pip3
so did the below steps to make it work.
./configure --prefix /usr/local --enable-shared LDFLAGS="-Wl,-rpath,/usr/local/lib"
make
make install
now pip3 install mod-wsgi worked fine.

error: command 'gcc' failed with exit status 1; Unable to make after clone

Im trying to run the eval.py to evaluate my training session. To do that I need to install the cocodataset (see the error message below). This is where the error occurs.
I've tried
sudo apt-get update && sudo apt-get upgrade
uninstalling and re-installing cython, gcc, numpy
It seems to me that there are a lot of errors regarding gcc, which leads me to think that my error might not be related to the cocodataset, but maybe my packages or environment variables. I need advice/directions on how to solve the problem or possibly where to look. Any help is much appreciated! Thanks in advance.
System Info
Distributor ID: Ubuntu
Description: Ubuntu 16.04.4 LTS
Release: 16.04
Codename: xenial
Python 2.7.14 :: Anaconda, Inc
Running on AWS Deep Learning AMIs
Error
git clone https://github.com/pdollar/coco.git
Cloning into 'coco'...
remote: Counting objects: 927, done.
remote: Total 927 (delta 0), reused 0 (delta 0), pack-reused 927
Receiving objects: 100% (927/927), 11.68 MiB | 3.14 MiB/s, done.
Resolving deltas: 100% (554/554), done.
Checking connectivity... done.
(tensorflow_p27) ubuntu#remoteip:~/tmp$ cd coco/PythonAPI/
(tensorflow_p27) ubuntu#remoteip:~/tmp/coco/PythonAPI$ make
python setup.py build_ext --inplace
Compiling pycocotools/_mask.pyx because it changed.
[1/1] Cythonizing pycocotools/_mask.pyx
running build_ext
building 'pycocotools._mask' extension
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/pycocotools
creating build/common
gcc -pthread -B /home/ubuntu/anaconda3/envs/tensorflow_p27/compiler_compat -Wl,--sysroot=/ -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/ubuntu/anaconda3/envs/tensorflow_p27/lib/python2.7/site-packages/numpy/core/include -I../common -I/home/ubuntu/anaconda3/envs/tensorflow_p27/include/python2.7 -c pycocotools/_mask.c -o build/temp.linux-x86_64-2.7/pycocotools/_mask.o -Wno-cpp -Wno-unused-function -std=c99
gcc -pthread -B /home/ubuntu/anaconda3/envs/tensorflow_p27/compiler_compat -Wl,--sysroot=/ -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/ubuntu/anaconda3/envs/tensorflow_p27/lib/python2.7/site-packages/numpy/core/include -I../common -I/home/ubuntu/anaconda3/envs/tensorflow_p27/include/python2.7 -c ../common/maskApi.c -o build/temp.linux-x86_64-2.7/../common/maskApi.o -Wno-cpp -Wno-unused-function -std=c99
gcc -pthread -shared -B /home/ubuntu/anaconda3/envs/tensorflow_p27/compiler_compat -L/home/ubuntu/anaconda3/envs/tensorflow_p27/lib -Wl,-rpath=/home/ubuntu/anaconda3/envs/tensorflow_p27/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-2.7/pycocotools/_mask.o build/temp.linux-x86_64-2.7/../common/maskApi.o -L/home/ubuntu/anaconda3/envs/tensorflow_p27/lib -lpython2.7 -o /home/ubuntu/tmp/coco/PythonAPI/pycocotools/_mask.so
/home/ubuntu/anaconda3/envs/tensorflow_p27/compiler_compat/ld: cannot find -lpthread
/home/ubuntu/anaconda3/envs/tensorflow_p27/compiler_compat/ld: cannot find -lc
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
Makefile:3: recipe for target 'all' failed
make: *** [all] Error 1
As you see above I get the following error: command 'gcc' failed with exit status 1.
Do you finished install gcc? I think you should check it, I have some error when make coco lib, and I just realized that something wrong with the hosts contains some gcc packages.
Try:
sudo apt-get update
then
sudo apt-get gcc
And make sure that you have successfully install gcc.

capybara-webkit on yosemite g++: error: unrecognized command line option '-Xarch_x86_64'

I'm having problem installing on OS X 10.10 Yosemite, running with gcc4.9.2 and qt 4.8.6 installed via Brew.
gem install capybara-webkit
Building native extensions. This could take a while...
ERROR: Error installing capybara-webkit:
ERROR: Failed to build gem native extension.
/usr/local/var/rbenv/versions/2.1.4/bin/ruby extconf.rb
cd src/ && /usr/local/bin/qmake /usr/local/rbenv/gem/gems/capybara-webkit-1.3.1/src/webkit_server.pro -spec /usr/local/Cellar/qt/4.8.6/mkspecs/macx-g++ -o Makefile.webkit_server
cd src/ && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile.webkit_server
g++ -pipe -O2 -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Cellar/qt/4.8.6/mkspecs/macx-g++ -I. -I/usr/local/Cellar/qt/4.8.6/lib/QtCore.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.6/lib/QtCore.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.6/lib/QtNetwork.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.6/lib/QtNetwork.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.6/lib/QtGui.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.6/lib/QtGui.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.6/lib/QtWebKit.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.6/lib/QtWebKit.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.6/include -Ibuild -F/usr/local/Cellar/qt/4.8.6/lib -x c++-header -c stable.h -o build/webkit_server.gch/c++
g++: error: unrecognized command line option '-Xarch_x86_64'
make[1]: *** [build/webkit_server.gch/c++] Error 1
make: *** [sub-src-webkit_server-pro-make_default-ordered] Error 2
Command 'make' failed
I had the same problem using GCC installed via MacPorts (tested several versions up to gcc5). The solution for me was using g++ supplied with the XCode command line tools. I uninstalled all MacPorts GCC versions. Below version details of the g++ command that worked.
$ g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
A similar problem was asked here: QT Creator adds -Xarch.