How to install libarchive on macOS and make compiler will detect it? - macos

I am trying to install libarchive on macOS for my school project. I tried to do it using brew formulae, but CMake says that it can't detect it. How can I install libarchive in the right way?
What I tried:
brew install libarchive
What I got in CLion:
Could NOT find LibArchive (missing: LibArchive_INCLUDE_DIR)

As mentioned in this GitHub issue post, libarchive isn't installed into the standard system paths. So, you'll need to tell CMake where to find it by setting the following in your CMake file:
set(LibArchive_INCLUDE_DIR "/usr/local/opt/libarchive/include")
Note, you may have to modify the path here to match where libarchive was installed on your system

Related

Struggling to compile gdal with hdf4 support

I am unable to compile gdal with hdf4 support using bash on a mac osx el capitan version 10.11.6. I began with the homebrew approach to building gdal described on the osgeo website. Unfortunately, hdf4 is not by default supported by gdal. The hdf format page includes a great description of the hdf4 data structure but fails to help getting support for gdal. I've installed the szip, zlib, and jpeg libraries discussed here, and reviewed the struggles described by /u/dschneiderch here. The github thread lead me to a final link, which is the basis for my current post.
Using homebrew, I have installed hdf4 (brew install homebrew/versions/hdf4 returns a warning that versions was deprecated and homebrew will use science instead). I've been fighting with this gdal problem for a while, and sure enough, homebrew/science/hdf4-4.2.11_2 already installed. So, I linked hdf4 using brew link -overwrite-hdf4, and a warning comes back that it's already been linked.
I used brew remove gdal to start fresh with the install, then followed Shaun's approach in the sig-geo listserv to complete the gdal installation. Thus, my total workflow was:
brew tap homebrew/versions
brew install hdf4
brew link --overwrite hdf4
brew install gdal --complete --enable-unsupported --with-hdf4
Unfortunately, even after linking the overwrite, I get a warning: Warning: gdal: this formula has no --with-hdf4 option so it will be ignored!. The installation continues, though, and homebrew is able to build gdal.
Checking gdalinfo --formats, hdf4 is still not included in the list. Any tips for what else to try?
I've made some progress using this source, in that gdalinfo --formats' now includes HDF4 as a supported product. However, using pyModis to download data, I still pull a GDAL installation has no support for HDF4, please update GDAL` error.
Importantly, though, after installing Macport the following code works well for installing GDAL on Mac with HDF4 support:
sudo port install gdal +hdf4 +hdf5 +netcdf

Installing PySide on Mac: is there a working method?

I may be doing something wrong, but I have been trying to install pyside on Mac 10.12 (Sierra). Here is what I tried (after installing Qt with brew):
With the precompiled package (1.2.1); fails because of "incompatible package".
With sudo -H pip install pyside (1.2.4): fails with the following error:
Qt QTGUI library not found.
Qt QTXML library not found.
Qt QTCORE library not found.
CMake Error at ApiExtractor/CMakeLists.txt:82 (qt4_add_resources):
Unknown CMake command "qt4_add_resources".
With brew install pyside==1.2.2 : works successfully but when calling it from a python program, fails with ImportError: dlopen(/Library/Python/2.7/site-packages/PySide/QtCore.so, 2): Libmrary not loaded: libpyside-python2.7.1.2.dylib
Referenced from: /Library/Python/2.7/site-packages/PySide/QtCore.so
Reason: unsafe use of relative rpath libpyside-python2.7.1.2.dylib in /Library/Python/2.7/site-packages/PySide/QtCore.so with restricted binary
The last one did offer some hope, and I tried PySide import error Mac OS X El Capitan, Library not loaded: #rpath/libpyside.cpython-34m.1.2.dylib . Unfortunately, the explanation was quite elliptic and I ended up breaking things further.
Am I missing something obvious? The fact that the precompiled packages are old and the web doc is not updated, that brew install does not seem to work (and the documentation makes no mention of it) and generally number of questions asked about pyside and the technical complication of the answers do not seem very good signs.
Does someone know what the matter is with PySide's installation on Mac OS, technically? What's the best solution in my particular case?
More generally, is there hope for improvement with PySide on Mac?
Update (25 Jan 2017): Workaround?
Since we are waiting for an update from Pyside, is someone willing to take the challenge of installing 1.2.2 on OS Sierra with brew, and resolve the "unsafe use of relative path"? Perhaps propose a step-by-step tutorial?
That might save the day for PySide on Mac... while relieving the time pressure on the Pyside development team?
I have MAC osSierra (10.12.6). I needed to install PySide 1.2.4 for Python 3.3.6. I did the following to build and install PySide 1.2.4 that I need. You can do the following for any Python 3.3.x, I guess.
I am a newbie to Mac and Python. Please ignore if I have any mistakes.
Install pyenv
brew install pyenv
Install Python 3.3.6 using pyenv
pyenv install 3.3.6
Add python 3.3.6 into system path
PATH="/Users/myname/.pyenv/versions/3.3.6/bin:${PATH}"
export PATH
Install Xcode from app store, then run the following. Xcode download and install took 30-40 minutes for me.
xcode-select --install
sudo xcodebuild -license
Install cmake
brew install cmake
Verify cmake is installed. I see version 3.10.0 installed
cmake —version
Tap qt4. Note: I tried qt5, but pyside build is not working for me with qt5.
brew tap cartr/qt4
brew tap-pin cart/qt4
Install qt#4.
brew install qt#4
Verify qmake is installed. I see version 2.01a installed
qmake —version
(If qmake is not recognized, create links to it using below command)
brew link cartr/qt4/qt#4 —-force
If you are using “PySide.QtWebKit” in your programs, you need to install qt-webkit. Install pyside (1.2.2 ??), which will install qt-webkit. I am not sure if qt-webkit can be installed directly, if so someone can correct me.
brew install pyside
Download PySide 1.2.4 tar file.
wget https://pypi.python.org/packages/source/P/PySide/PySide-1.2.4.tar.gz
Untar the tar file
tar -xvf PySide-1.2.4.tar.gz
Go into the folder
cd PySide-1.2.4
Build pyside. This build step took almost 30-40 minutes for me
python setup.py bdist_wheel
Verify that “dist” folder is created and it has pyside wheel file in it.
Go into the “dist” folder
cd dist
Instal PySide, last step!!
pip install PySide-1.2.4-cp33-cp33m-macosx_10_12_x86_64.whl
Congratulations!, now you have PySide 1.2.4 for Python 3.3.x
This isn't the answer but unfortunately there has not been any output from pyside team for macOS sierra .Only supported OS from apple are
10.6 Snow LeopardOS X
10.7 LionOS X
10.8 Mountain LionOS X
10.9 MavericksOS X
10.10 Yosemite
Update : (You can try this still )
curl -O https://raw.githubusercontent.com/Homebrew/homebrew-core/fdfc724dd532345f5c6cdf47dc43e99654e6a5fd/Formula/qt5.rb
brew install ./qt5.rb
If above lines doesn't work :
You’ll need the Xcode commandline tools:
xcode-select --install sudo xcodebuild -license
Then the following packages can be easily installed via brew:
brew install qt5 cmake libxslt libxml2
This will install Qt 5.6.1-1 and cmake 3.5.2 your system
Now time to clone ! Not from github but from this link :
So Clone the pyside-setup repository and have it also pull down its gitmodules:
git clone --recursive https://codereview.qt-project.org/pyside/pyside-setup
This command worked fine for people using Python 2.7.11 and Python 3.5.1. Remember to have pip installed with the wheel package or you’ll get an error about bdist_wheel.
python setup.py bdist_wheel --ignore-git --qmake=/usr/local/Cellar/qt5/5.6.1-1/bin/qmake --cmake=/usr/local/bin/cmake --openssl=/usr/local/Cellar/openssl/1.0.2h_1/bin
(Note :
The exact paths given in the arguments may not be identical on your system so verify those prior to compiling)
Install the wheel :
A wheel was hopefully built in the dist folder. So just cd dist and pip install away!
Notes on pre-compiled wheels
Unfortunately, and like with PySide, these wheels are not “portable” and won’t install on systems which doesn’t already have the specific Qt5 version installed used during compilation. This, I believe, is because PySide2 links dynamically (instead of statically) against the Qt5 installation. Hopefully, this is something The Qt Company will address via official PySide2 wheels, as Riverbank Software is now providing a fully portable PyQt5 wheel for Python 3 which is absolutely awesome.
New Repository (not from github)
Reference
The Mac steps from here worked for me: https://fredrikaverpil.github.io/2016/08/17/compiling-pyside2/
You’ll need the Xcode commandline tools:
xcode-select --install
sudo xcodebuild -license
Then the following packages, easily installed via brew:
brew install qt5 cmake libxslt libxml2
Clone the pyside-setup repository and have it also pull down its gitmodules:
git clone --recursive https://codereview.qt-project.org/pyside/pyside-setup
Build it. This command worked fine for me using Python 2.7.11 and Python 3.5.1. Remember to have pip installed with the wheel package or you’ll get an error about bdist_wheel.
cd pyside-setup
python setup.py bdist_wheel --ignore-git --qmake=/usr/local/Cellar/qt5/5.6.1-1/bin/qmake --cmake=/usr/local/bin/cmake --openssl=/usr/local/Cellar/openssl/1.0.2h_1/bin
Last but not least, install the wheel:
cd dist
pip install PySide2-2.0.0.dev0-cp27-cp27m-macosx_10_12_x86_64.whl
All credits go to Fredrik Averpil's wonderful post.
You need a specific version of Qt and pyside.
Install both the QT 4.8.5 package as well as pyside from the Mac installers on the page below:
https://wiki.qt.io/PySide_Binaries_MacOSX
You need QT4 to install PySide on 10.11 (not sure about 10.12).
Install QT5 either via Brew or via installer, get cmake via brew and get the latest PySide source (https://pypi.python.org/packages/source/P/PySide/PySide-1.2.4.tar.gz) Run the following to get Qt4:
brew tap cartr/qt4
brew tap-pin cartr/qt4
brew install qt_4
Once you do so; cd in the source folder and run the following to build:
python setup.py bdist_wheel --ignore-git --qmake=[QMAKE_FROM_QT4_PATH] --cmake=[YOUR_CMAKE_PATH]
cd dist
pip install [YOUR_BUILT_PYSIDE_WHEEL]
Once you do so, you can check that PySide is working correctly, opening a Python console and typing import PySide
I still not have a solution, but I found an alternative.
First of all, I am not an expert (I am super new coding). Based on my own experience below you will find a solution as well.
I need to clarify something first, there are two ways to use this GUI QT - PyQt by Riverbank Computing or(and) PySide, originally developed by Nokia.
I tried many differents ways to install PySide on my MacOS Sierra version10.12.5, but no success, so I ended up finding PyQt, that does the same thing.
Watching this video I installed the PyQT5 in my Mac OS and now it is working. https://www.youtube.com/watch?v=2kHk8ZjxH64
Example of Hello World using PyQT http://pythoncentral.io/intro-to-pysidepyqt-basic-widgets-and-hello-world/
The wiki.qt.io says "PySide has included support for Python 3.2 since version 1.0.8." but it doesn't work for me.
Good lucky.

installed specific version of hdf5(1.8.16) mac

I want to install hdf5 with a specific version: 1.8.16, but with the command, brew install hdf5, I got the newest version, 1.8.17, can you help me, I checked out some similar solutions, it does work.
Download your OS-specific hdf5-1.8.16.tar.gz
hdf5-1.8.16.el_capitan.bottle.tar.gz
hdf5-1.8.16.mavericks.bottle.tar.gz
hdf5-1.8.16.yosemite.bottle.tar.gz
Extract
mv hdf5 /usr/local/Cellar/
brew link hdf5

How to install an external package to /usr/local without troubling Homebrew?

I'm trying to install a package called Geant4 by compiling from source (HomeBrew actually has the package but it's an old version and doesn't have support for Python which I need).
I want to put the Geant4 package in /usr/local/geant4 (perhaps this is not the proper place to put it in OSX?).
Now, the Homebrew FAQ has some instructions on how to install external stuff, but when I do brew diy, I get the error message:
Error: Couldn't determine build system
The command I should use to configure Geant4 is:
cd ~/my-build-directory
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/geant4 ~/Downloads/geant4.10.01.p01
brew diy makes a good effort to determine how to build a package, but it doesn't always get it right. In the case of custom packages, it's probably best to install them into $(brew --prefix)/Cellar/$package/$version, just as Homerew would -- that way, you can interact with the package using brew link, etc. You can also install it to /usr/local or anywhere you like, but mimicking Homebrew works really well.
In your case, you could probably install it with something like:
cd /my-build-directory
cmake -DCMAKE_INSTALL_PREFIX=$(brew --prefix)/Cellar/geant4/10.01.p01 ~/Downloads/geant4.10.01.p01
brew link geant4

fontforge building in brew, terminal cant find gcc error

This is my first time trying to compile source code in terminal (I installed gimp using macPorts but this could be part of the problem...?)
I want to install fontforge and I was following these instructions how to install fontforge.
I got this warning while installing brew:
Warning: The following *evil* dylibs exist in /usr/local/lib
They may break builds or worse. You should consider deleting them:
/usr/local/lib/libssl.0.9.8.dylib
I could not find usr/local/lib and the only libssl file was in opt/local/lib called libssl.1.0.0.dylib which is supposed to be hidden apparently...
I made it to the "brew install cairo --use-clang" step, then when I try the "brew install fontforge --use-gcc" step I get the following warning:
Warning: It appears you have MacPorts or Fink installed.
Software installed with other package managers causes known problems for
Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
==> Installing fontforge dependency: gettext
Error: GCC could not be found
when I check gcc version I get:
:~ me$ gcc --V
i686-apple-darwin11-llvm-gcc-4.2: no input files
Do I need to uninstall macports (then re-install gimp?)
I read gcc comes with xcode, I have xcode 4.3 (upgraded after this issue but didn't fix it) so do I have gcc or not? is there another way to check etc.
Can anyone tell me what I am doing wrong (what I broke etc)?
NOTE I also have flashbuilder which has a program called gcc as well (I dont know if this broke the other gcc...)

Resources