1

My ultimate goal is to get python package graph_tool working on my system and also on ipynb if possible. I have already brew install graph-tool, as indicated here, but that's still insufficient.

So I follow conda instructions here, and I make decent progress, until I encounter a compiler issue with the configuration.

$ conda create -n py36env python=3.6.3 anaconda
(py36env) $ conda install -c conda-forge cgal 
... and so forth with the other required libraries

(py36env) Tams-MacBook-Pro:graph-tool-2.25 tamtam$ ./configure --prefix=/Users/tamtam/anaconda3/envs/py36env/ --with-python-module-path=/Users/tamtam/anaconda3/envs/py36env/lib/python3.6/site-packages
.
.
.
checking whether g++ supports C++14 features by default... no
checking whether g++ supports C++14 features with -std=gnu++14... no
checking whether g++ supports C++14 features with -std=gnu++1y... no
configure: error: *** A compiler with support for C++14 language features is required.

I'm not very familiar with compiler things, but I check my system as follows:

(py36env) Tams-MacBook-Pro:graph-tool-2.25 tamtam$ conda list | grep gcc
gcc                       4.8.5                         8

And outside of the conda env:

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/Users/tamtam/anaconda3/envs/py36env/bin/../libexec/gcc/x86_64-apple-darwin11.4.2/4.8.5/lto-wrapper
Target: x86_64-apple-darwin11.4.2
Configured with: ./configure --prefix=/Users/ray/mc-x64-3.5/conda-bld/gcc-4.8_1477649012852/
Thread model: posix
gcc version 4.8.5 (GCC)

And with Homebrew

$ brew list --versions | grep gcc
gcc 7.1.0 7.2.0
$ /usr/local/bin/gcc-7 --version
gcc-7 (Homebrew GCC 7.2.0) 7.2.0
$ echo $PATH
/Users/tamtam/anaconda3/bin:/Users/tamtam/anaconda/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin


So my questions are: EDITS INCLUDED
1) What's the difference between the conda gcc 4.8.5 and Homebrew gcc 7.2 on my system? I'm confused because they're each up-to-date packages.
EDIT: Nowhere online that I perused explicitly states this, but I am understanding (aka educated guess bc it's 3am and I need sleep) conda gcc 4.8.5 to just be equivalent to brew gcc 4.8.5, and that Anaconda is just way behind on developing an 'official' gcc supporting C++14. In the meantime I conda install -c salford_systems gcc-5 and ./configure seems to find itself a C++14 compiler. YAY (but this also led me to a new problem T.B.A.)
NOTE: I had also tried running the ./configure file with both conda gcc 4.8.5 and brew gcc 7.2.0 (switching of default gcc compiler guided here), but still same error of ./configure not finding C++14 compile (so ignore this)

2) I also have Xcode 8.3.3 that also comes with clang, which is what gcc is symlinked to... ?? No idea about the setup/relation

3) How can I adjust my system (for example, paths) so that the configuration process will detect a C++14 compiler? EDIT: resolved per 1)

bfontaine
  • 18,169
  • 13
  • 73
  • 107
tamtam
  • 641
  • 9
  • 24
  • Did you do any research yourself _before_ asking? The output is pretty self-descriptive, look up its compiler requirements and how to specify one to use. And if you have no idea how Brew and Anaconda operate and relate (hint: they're completely independent from each other, with no compatibility guarantees), this shows you didn't bother to even look up the basic info on them. Show some effort. – ivan_pozdeev Oct 24 '17 at 18:03
  • That said, you're not following the "conda instruction here", it instructs to compile `graph-tool` from source against Anaconda's Python. You've got to decide if you'd rather use `graph-tool` with Homebrew's of with Anaconda's ecosystem - which one is more fit for your needs. – ivan_pozdeev Oct 24 '17 at 19:14
  • Hi Ivan, did you read my question _before_ answering? I asked about `conda gcc 4.8.5` vs `brew gcc 7.2` specifically, not conda vs brew. And of course it'd be easy to choose one functioning `graph-tool` of either Anaconda or Homebrew, but like my question detailed, the Homebrew version is currently not working and I'm having trouble installing the Anaconda version. That is why I'm seeking help on SO, not your baseless criticism. – tamtam Oct 24 '17 at 22:01
  • And yes Ivan, I did do research beforehand. Particularly research effort that you did not see, and hence cannot judge. And even if much further research would have led me to my answer, it's not wrong to ask upon the knowledge of those more-experienced. (Did I mention I was a beginner?) Please help keep SO as a supportive platform. – tamtam Oct 24 '17 at 22:04
  • I can only see what you write in the question, I (still) cannot read minds. I've no idea why Homebrew's `graph-tool` is "insufficient" for you. `brew` should've installed all dependencies, so it should work, normally, and is the easy way out because you probably won't need to compile anything by hand. I did miss that you're compiling graph-tool in anaconda's environment - for that, I apologize. – ivan_pozdeev Oct 25 '17 at 03:46
  • Since you ask specifically about compilers, I'll be answering that though 'cuz SO is one-concern-per-question. – ivan_pozdeev Oct 25 '17 at 03:51
  • For that, please add the lines from the `configure` output that you omitted (specifically, I want to see the detected `gcc` and `g++`) and the output of `which gcc` and `which g++` in `py36env`. That should tell if anaconda's private compiler or the system's default compiler is being used. – ivan_pozdeev Oct 25 '17 at 03:51
  • You can [reply with a comment and refer to me with an @ sign](https://meta.stackexchange.com/questions/43019/how-do-comment-replies-work) when you're done - that will send me a notification. – ivan_pozdeev Oct 25 '17 at 03:56
  • hi @ivan_pozdeev, thanks for your additional help. I would much rather that Homebrew installation was functioning as well; I might pick it back up since I seem to have hit [a dead end] (https://stackoverflow.com/questions/46922619/configure-error-cgal-library-not-found) with Anaconda installation. Regarding the compiler issue with `./configure`, I managed to resolve it by conda installing gcc-5 (C++14 support is gcc 4.9.3+ I believe) from a non-official conda channel (see edit) - thanks though. – tamtam Oct 25 '17 at 14:27
  • I know this question is 2.5 years old, but FWIW: `graph-tool` is now available on conda-forge: `conda install -c conda-forge graph-tool`. Note: That package does not yet support graph-tool's drawing features, but hopefully that will change soon. – Stuart Berg Mar 10 '20 at 22:02

2 Answers2

1

(This solution is also included within the edits at the bottom of my question.)

Nowhere online that I perused explicitly states this, but I am understanding (aka educated guess bc it's 3am and I need sleep) conda gcc 4.8.5 to just be equivalent to brew gcc 4.8.5, and that Anaconda is just way behind on developing an 'official' gcc supporting C++14. In the meantime I conda install -c salford_systems gcc-5 and ./configure seems to find itself a C++14 compiler. YAY (but this also led me to a new problem)

NOTE: I had also tried running the ./configure file with both conda gcc 4.8.5 and brew gcc 7.2.0 (switching of default gcc compiler guided here), but still same error of ./configure not finding C++14 compile arises (so ignore this)

tamtam
  • 641
  • 9
  • 24
1

As a rule of thumb, if a product provides its own build tools (compiler, C headers, static libraries, include/library paths etc) instead of using the system's ones, you should use those when building things to use within its environment.

That's because, depending on include files, compiler, compiler version, compiler flags, predefined macros etc the same sources and libraries built with different toolchains can be binary incompatible. This goes double for C++ where there are no ABI standards at all. (In C, there are de facto ones for most platforms where there are competing compilers due to the need to do system calls.)

Now, what you have on your system:

  • The system's stock gcc (if any) is at /usr/bin (so includes are at /usr/include, static libraries at /usr/lib etc)
  • Homebrew's gcc 7.2 at /usr/local/bin (includes are probably at /usr/local/include)
  • Anaconda also has a gcc package that, if installed, would reside somewhere like /Users/<login>/anaconda3/envs/<env name>/bin

If an environment provides an own toolchain, it provides some way to make build scripts select that toolchain when building things. A common way is to set relevant environment variables (PATH, INCLUDE, LIB) - either directly or through some tool that the environment provides. Homebrew executables reside in /usr/local/bin which is always present in UNIX PATH as per the FHS; Anaconda adds itself to PATH whenever its environment is activated.


So, as you yourself guessed, since Anaconda provides its own gcc packages (thus enforces the compatibility of their output with its binary packages via package metadata - if there are known incompatibilities, the installation will fail due to requirement conflicts), you need to install one that meets graph-tool requirements -- which is gcc 5, available via gcc-5 package from salford_systems channel. Then specify --prefix as you already have.

You may need to install other dependencies, too, if you didn't already or you need optional features that they're required for.

ivan_pozdeev
  • 33,874
  • 19
  • 107
  • 152