Struggling to compile gdal with hdf4 support - bash

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

Related

updating octave: linking the installation

I have OSX 10.10.5 with Octave 3.4.0 running (installed, who knows how, I did it a million different ways through port, file extraction, ftp, homebrew…). I tried to update my Programme (brew install octave or sudo port install octave) and Terminal spits out:
Warning: octave-3.8.2 already installed, it's just not linked
Okay, great. So I have a better programme somewhere installed. What now? How on earth am I supposed to “just link” the newer installation?
If you install octave with Homebrew and it doesn't link it it should tell you why. You can force Homebrew to link octave with
$ brew link --overwrite octave
You can also add the --dry-run option to check and see what Homebrew will do to link octave
$ brew link --overwrite --dry-run octave
A possible reason for Homebrew not linking octave is that you've installed it by another method, MacPorts for instance. It is not recommended that you use both Homebrew and MacPorts on the same system.

Installing Caffe (deep learning) issues

I have been able to install Caffe but I had a lot of issues and that's because I didn't follow the instructions very well.
I have a Mac OSx and I'm reading the OSx guide for installation.
In this point:
when I type hdf5 opencv I get:
"hdf5: command not found"
I've tried to install hdf5 by Homebrew and MacPorts but I'm still getting:
"hdf5: command not found"
Does anyone have any clue?
Thank you very much.
according to the answer of #mattias, my binaries in /usr/local/hdf5 are:
hdf5 is not a command or anything else. The documentation is just bad, it has to be:
brew tap homebrew/science hdf5 opencv
So, what I mean is, we have to install hdf5 and then link it to Caffe. But executing hdf5 is not what the guide meant.
You can install hdf5 from source. I just tested on OS X 10.9.5.
wget http://www.hdfgroup.org/ftp/HDF5/current/src/hdf5-1.8.14.tar
Unpack,
tar zxfv hdf5-1.8.14.tar
Enter directory
cd hdf5-1.8.14
And then,
./configure --prefix=/usr/local/hdf5 # or where you want it
make
sudo make install
Then you have it installed in /usr/local/hdf5.
Good luck!

tesseract install mac os

I am trying to install tesseract on my mac using homeBrew. When I try installing, everything seems to be good but I get the following error/message:
Warning: Could not link leptonica. Unlinking...
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link leptonica'
When I try running a tesseract function, I get the following error:
Tesseract Open Source OCR Engine v3.02.02 with Leptonica
Error in pixReadStreamPng: function not present
Error in pixReadStream: png: no pix returned
Error in pixRead: pix not read
Unsupported image type.
I have image magick installed and the command I used to install tesseract was:
brew install tesseract
Can anyone please tell me what I can do to get tesseract working? Thank you!
EDIT
When I run brew link leptonica, I get the following error:
Could not symlink file: /usr/local/Cellar/leptonica/1.69/bin/yuvtest
Target /usr/local/bin/yuvtest already exists. You may need to delete it.
Now, as of September 2019, there are no longer any optional install flags available
brew options tesseract
yield nothing. But,
brew info tesseract
yields the following key info:
This formula contains only the "eng", "osd", and "snum" language data files.
If you need all the other supported languages, `brew install tesseract-lang`.
Therefore, to get all of the languages installed, you need to now install a separate library called tesseract-lang.
Updated installation:
brew install tesseract
brew install tesseract-lang
Hope this helps.
old in case this is useful:
Now, as of January 2019, Tesseract installs fine via homebrew, as long as you have xquartz installed first, brew cask install xquartz. Then you can do the following: brew install tesseract --with-all-languages --with-serial-num-pack --with-training-tools
After installing / removing and re-installing tesseract i found the solution for the same problem you have. On your terminal logs, while installing tesseract, you will see:
Error: The brew link step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/convertfilestopdf
Target /usr/local/bin/convertfilestopdf
already exists.
You may want to remove it:
rm '/usr/local/bin/convertfilestopdf'
To force the link and overwrite all conflicting files:
brew link --overwrite leptonica
To list all files that would be deleted:
brew link --overwrite --dry-run leptonica
What i did was running: brew link --overwrite leptonica
"Linking /usr/local/Cellar/leptonica/1.71_1... 45 symlinks created"
Everything should work perfectly.
Hope this can be a help for you
It sounds a bit silly, but have you tried deleting yuvtest? I just tried it myself - the file is automatically generated by brew link leptonica. As for why it isn't working, is it possible you had some version of leptonica/tesseract installed previously? Another reasonable guess at a fix would be
brew uninstall tesseract; brew install tesseract
So far as I know, image magick being installed shouldn't matter for tesseract. They don't have anything in common.
Tesseract is now dependent on Leptonica being installed.
The error messages you are seeing relate to these files:
Leptonica is configured to handle image I/O using these external libraries: libjpeg, libtiff, libpng, libz, libgif, libwebp.
These libraries are easy to obtain. For example, using the debian package manager:
sudo apt-get install
where = {libpng12-dev, libjpeg62-dev, libtiff4-dev}.
Source: Leptonica unofficial documentation
I found that homebrew would install some but not all of the libraries.

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...)

How can I force Homebrew to install 64-bit PostgreSQL on OSX SL? Specifically the libpg.dylib file

I have been trying to install the Ruby PG gem, but kept getting the "Failed to build gem native extension." error.
After sifting through a lot of google results, I tried nearly every recommendation I came across, all without luck. However, I believe I've tracked down the source of the problem ... Homebrew.
Homebrew installed PostgreSQL 9.0.4, but only with the 32-bit libraries. As I am running Snow Leopard (10.6.8) with XCode 3.26, I need the 64-bit libraries in order to compile everything without library mismatch errors. But I cannot seem to find out how to force Homebrew to install them, even with ARCHFLAGS and ENV set to "-arch x86_64".
Suggestions, please :)
p.s. I found out that I only had 32-bit libraries installed by running:
file /usr/local/Cellar/postgresql/9.0.4/lib/libpq.5.3.dylib
which returned:
/usr/local/Cellar/postgresql/9.0.4/lib/libpq.5.3.dylib: Mach-O dynamically linked shared library i386
Update: re-installed Homebrew, which installed postgresql/9.1.1 and 64-bit shared libraries.
But another problem emerged, while installing the PG gem. For some reason it was looking for ginstall in /opt/local/bin. As I had removed MacPorts, that directory was also removed. I did find this solution:
mkdir -p /opt/local/bin/
sudo ln -s /usr/bin/install /opt/local/bin/ginstall
And now everything seems to be working ....
So it looks like my first install, using Homebrew, must have been done with regular Leopard.
Removing the Homebrew "Cell" directory and all of its contents, running the install script again, then doing "brew install" and "brew update" with all needed packages, got me the latest version of PostgreSQL, with 64-bit developer library.
And creating the above symbolic link fixed any left over errors from the MacPorts removal.
Now all is well :)

Resources