Does installing gfortran with homebrew and with an installer create a conflict? - osx-mountain-lion

I was following an online tutorial to install some Python modules using homebrew and one step was to install gfortran with brew install gfortran. Later on, I tried using another third-party installation script to install some Python modules and after the fact I realized that part of what the script did was download and run http://r.research.att.com/tools/gcc-42-5666.3-darwin11.pkg. I don't know that much about gfortran, but looking at the brew formula for gfortran it appears that brew uses a different version from the att.com one. Will that lead to problems in the future? I did brew uninstall gfortran and brew install gfortran again, and so far it seems like things are the same (I tried recompiling the old code that I had compiled before), but I am not sure what all the att.com pkg did. (I have OS X 10.8.2 and XCode 4.2 if that matters).

It depends on where the other gfortran installer goes to. In general, no, it won't conflict. * Homebrew is designed to be compatible with third-party gfortran installs - it defines dependencies on a generic "fortran" compiler, and not on the specific gfortran Homebrew formula. Homebrew stays under /usr/local, sticking the main install in /usr/local/Cellar, and symlinking judiciously in to /usr/local/lib. Other installers that install to /usr/local will just prevent Homebrew from linking its own compiler in, but will work with other formulas that use a fortran compiler. (Assuming the gfortran build options are compatible.)
That particular gcc-42 installer you linked to installs to /usr, not to /usr/local.** And its binaries are suffixed with "-4.2"; that is, it installs cpp-4.2, g++-4.2, gfortran-4.2, and so on. So a) there's no direct conflict with the Homebrew gfortran, and b) it won't directly shadow the /usr/local/bin/gfortran installed by Homebrew.
Which compiler will get picked up by things you build with both these gfortrans installed will depend on how the build works, but most will be looking for plain gfortran and so will find the Homebrew one, unless you explicitly direct them to the AT&T-provided one. You don't specify how you're building things, but since you're using brew, I'm assuming it's via brew or command line tools, in which case I think they're all probably seeing the Homebrew gfortran and ignoring this one. Look at the verbose output from their build processes to find out for sure.
*Depending, of course on what you mean by "conflict".
**Side note: AFAIK there's no easy way to figure this out by looking at the package or an installation manager. I just did a find /usr before and after running that installer, and did a diff on the output:
$ diff usr_before_any_installs.txt usr_after_att_install.txt | grep '^[<>]'
> /usr/bin/c++-4.2
> /usr/bin/cpp-4.2
> /usr/bin/g++-4.2
> /usr/bin/gcc-4.2
> /usr/bin/gfortran-4.2
> /usr/bin/i686-apple-darwin11-cpp-4.2.1
> /usr/bin/i686-apple-darwin11-g++-4.2.1
> /usr/bin/i686-apple-darwin11-gcc-4.2.1
> /usr/bin/i686-apple-darwin11-gfortran-4.2.1
> /usr/include/gcc
> /usr/include/gcc/darwin
> /usr/include/gcc/darwin/4.2
...

Related

Mac OSX. Where can I download glibtool?

I am trying to setup watchman for the mac. As stated on the website, I need to install glibtool.
Can anyone provide a link to where I can download glibtool?
I need to be able to download it from its source and the only solution I can find is by using brew.
I do not want to use brew.
Thank you.
glibtool is "GNU Libtool". It is typically installed as libtool on most systems, but because macOS has its own libtool that has completely different functionality, it is usually installed as glibtool on macOS.
If you can't directly use homebrew to install it, you can duplicate the steps in its recipe, which you can find here: https://github.com/Homebrew/homebrew-core/blob/master/Formula/libtool.rb
For the sake of keeping this answer "working" even if homebrew goes away, the homepage for libtool is https://www.gnu.org/software/libtool/ and you can follow the instructions there for information on how to build and install it.
I've covered similar issues to Wez's answer from a MacPorts perspective; I'll go ahead and assume you can't use that either.
The latest stable version at this time is 2.4.6. Typical best practice is to make a directory, e.g., build in the top level of the source. Add the prefix: g, with --program-prefix=g, the top level installation directory --prefix=PREFIX, or specify more fine-grained installation directories options for bin, include, lib, and share directories.
> mkdir build
> cd build
> ../configure --prefix=/my/install/path --program-prefix=g
> make; make install
You now have glibtool and glibtoolize in $PREFIX/bin.

GTK3 compilation won't find GLib2.0, which I actually compiled. What am I missing?

The last days I struggled with libraries (GLib2.52.2 & GTK3.22.15), while I tried to compile them on Ubuntu 16.04 LTS (fresh installation).
The GLib2.52.2 just compiled without errors after installing the needed dependencies.
My problem is following:
when I want to start compilation of GTK3.22.15
$ ./configure --prefix=/usr --with-pcre=system && make -j 6
I get this error message:
configure: error: Package requirements (glib-2.0 >= 2.49.4 atk >= 2.15.1 pango >= 1.37.3 cairo >= 1.14.0 cairo-gobject >= 1.14.0 gdk-pixbuf-2.0 >= 2.30.0) were not met:
Requested 'glib-2.0 >= 2.49.4' but version of GLib is 2.48.2
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables BASE_DEPENDENCIES_CFLAGS
and BASE_DEPENDENCIES_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
SOLVED EDIT
I got a suggestion from AskUbuntu to compile everything in /usr/local to prevent conflicts, in some cases with official repository updates.
$ ./configure --prefix=/usr/local --with-pcre=system && make -j 6
Did solve my problem under these conditions. I didn't touch anything more, referring to the other so said "not matching" dependencies, to compile GTK3 (3.22.15) after recompiling GLib2.0 (2.52.2) in /usr/local.
Requested 'glib-2.0 >= 2.49.4' but version of GLib is 2.48.2
When compiling libraries for Gnome or Gtk, you frequently have to update other libraries too. If you download gtk3 from the ubuntu repositories (use the synaptic package manager to search for gtk3 or gtk+-3.0), you will see that you will not only download gtk3, but a pile of other libraries gtk3 needs. In case of using the repositories (recommended!) the system will take care of everything.
I'm not an Ubuntu user, but I am interested in the behind-the-scenes part, so I frequently compile libraries, and I have to do this manually. So, to install a new version of gtk3, I have to first compile and update glib. After doing so, I might also have to update Pango, ATK, and several other libraries first. If you like losing time with such stuff, go for it! Else consider using the repositories.

What is the best way to install pkg-config on Mingw in 2014?

What is a good way at this moment (October 2014) to install pkg-config on Windows in a (no HTTPS) MinGW / MinGW-w64 environment? (See also this question from 2009.)
If there is a binary package that does not pull in GTK+, that would be great, but I haven't found one. Building from source is fine if that's the way to go.
On the Mingw FAQ it says: (This is from 2009 the latest, judging from a comment at the bottom of the page.)
How do I get pkg-config installed?
The difficulty in getting pkg-config installed is due its circular depency on glib. To install pkg-config, you should first install the GTK-runtime, the installer is found at (dead link) https://sourceforge.net/project/showfiles.php?group_id=121075. The pkg-config binary can be obtained from (new link, but does not mention pkg-config) https://www.gtk.org/download/windows.php. Place pkg-config.exe in your MinGW bin directory.
There are other pkg-config projects that don't have the circular dependency issue. They include:
(dead link) pkgconf
pkg-config-lite
I've quickly looked at pkg-config-lite, but it looks like it was last updated in 2012. Also, I think pkg-config now includes its own version of Glib to break the circular dependency, so it should be possible to build without Glib.
I've done searches for "mingw pkg-config". Any suggestions welcome.
The way to go seems to be MSYS2 and MinGW-w64. Download MSYS2, on 32-bit Windows run msys32\autorebase.bat (this should not be needed much longer), then:
pacman -Syu # to update the system packages
(these errors are not fatal), then
pacman -Ssq pkg-config # to list pkg-config packages
# for 64 bit: ------
pacman -S mingw-w64-x86_64-pkg-config
# for 32 bit: ----
pacman -S mingw-w64-i686-pkg-config
On https://sourceforge.net/p/mingw/mailman/message/31908633/ there are some instructions from earlier this year:
The FAQ pkg-config information did not work for me:
these did:
https://github.com/texane/stlink/issues/169
Download these three glib, pkg-config, pkg-config-dev archives and
extract contents to C:\MinGW
(These are all dead links – see also another SO question regarding win32builder.gnome.org:)
http://win32builder.gnome.org/packages/3.6/glib_2.34.3-1_win32.zip
http://win32builder.gnome.org/packages/3.6/pkg-config_0.28-1_win32.zip
http://win32builder.gnome.org/packages/3.6/pkg-config-dev_0.28-1_win32.zip
I keep this unaccepted in case someone has a better answer.
There is also pkg-config-lite:
Install mingw-w64
Install pkg-config-lite
Set PKG_CONFIG_PATH to the directory containing your *.pc files (i.e. c:\mingw64\mingw64\lib\pkgconfig)

Using Homebrew with alternate GCC

I've installed gcc-4.6 using the homebrew-alternatives gcc formula, but I can't seem to get it to use that GCC to install other formulas. Specifically Open-MPI and boost.
Does anyone know how to make Homebrew use this new compiler?
Thanks!
It looks like the latest versions of Homebrew now support the HOMEBREW_CC and HOMEBREW_CXX environment variables.
So now you can do the following:
$ HOMEBREW_CC=gcc-4.2 HOMEBREW_CXX=g++-4.2 brew install ice
Homebrew can't adapt to other versions of gcc using command line options. You can easily override the older compiler, though, if you edit the open-mpi and boost formula. For example, you can add a few commands after the "def install" in open-mpi.rb:
def install
# Force compilation with gcc-4.6
ENV['CC'] = '/usr/local/bin/gcc-4.6'
ENV['LD'] = '/usr/local/bin/gcc-4.6'
ENV['CXX'] = '/usr/local/bin/g++-4.6'
# Compiler complains about link compatibility with FORTRAN otherwise
ENV.delete('CFLAGS')
ENV.delete('CXXFLAGS')
That worked for me on Lion. Good luck.
These answers are all fairly old now. It seems that recent versions of homebrew have a '--cc' option that enables you to select the c compiler to use. For example
brew install --cc=gcc-6 <package-name>
will install using the brew version of gcc
From their wiki it sounds like they don't support other compilers:
Installing a custom version of GCC or autotools into the $PATH has the potential to break lots of compiles. So we stick to the Apple-provided compilers.

How to install gcc-4.1 on Ubuntu 10.10

1) I need gcc-4.1 for Matlab mex usage, but I can't get it installed fully with apt-get install:
The following packages have unmet dependencies:
libstdc++6-4.1-dev : Depends: gcc-4.1-base (= 4.1.2-27ubuntu1) but 4.1.2-29ubuntu1 is to be installed
Depends: g++-4.1 (= 4.1.2-27ubuntu1) but it is not going to be installed
E: Broken packages
2) I now only have gcc-4.1-base and -multilib installed. When compiling mex file:
/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status
Something is wrong with libstdc++6-4.1-dev.
So any easier fix than compiling by myself?
Thanks
I assume you use x64 version Ubuntu and your Matlab version is also 64bit. There are two ways that may solve your problem mentioned in 2):
Open mexopts.sh (located in yourhome/.matlab/MATLAB VERSION/ directory),
and comment CLIBS="CLIBS -lstdc++" for glnxa64.
Check whether libstdc++.so. exists in /usr/lib directory. If not, create a symbolic link /usr/lib/libstdc++.so to MATLABROOT/sys/os/glnxa64/libstdc++.so.6.0.xx (xx is a number that may change with matlab version).
I wouldn't compile it myself. I remember how long that takes (it's one the longest parts of building any Linux system)...
So I presume you don't have a fully functional GCC right now? I got this to install from apt-get in Ubuntu 10.10 x64...
Okay, so you have broken dependencies, eh? I know this is not elegant, but try downloading the deb files manually (http://packages.ubuntu.com/maverick/gcc-4.1 for 10.10 or http://packages.ubuntu.com/lucid/gcc-4.1 for 10.04), save them to a folder, cd into the folder from Terminal, and run this for each package:
dpkg -i package.deb
There is a more elegant way to do this, but I just don't know it...

Resources