help with g++6 install on mac

849 views
Skip to first unread message

Bob Carpenter

unread,
Aug 13, 2016, 1:16:07 PM8/13/16
to stan...@googlegroups.com
I'm trying to address the issue Ben brought up about
log(int) not compiling, but am failing to get g++6 installed
through brew.

I suspect I can solve the issue by adding an explicit type
override for integers in

stan/math/prim/scal/fun/log.hpp

but I can't test, because I can't get g++6 installed.

When I run "brew doctor" I get a slew of errors relating to
Anaconda, which I can paste if that'll help.


Here's what I tried and what happened.

~/cmdstan/stan/lib/stan_math(develop)$ brew install gcc6
==> Installing gcc6 from homebrew/versions
==> Installing dependencies for homebrew/versions/gcc6: gmp, mpfr, libmpc, isl014
==> Installing homebrew/versions/gcc6 dependency: gmp
==> Downloading https://homebrew.bintray.com/bottles/gmp-6.1.1.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring gmp-6.1.1.yosemite.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/info/gmp.info
/usr/local/share/info is not writable.

You can try again using:
brew link gmp
==> Summary
đŸș /usr/local/Cellar/gmp/6.1.1: 17 files, 3.2M
==> Installing homebrew/versions/gcc6 dependency: mpfr
==> Downloading https://homebrew.bintray.com/bottles/mpfr-3.1.4.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring mpfr-3.1.4.yosemite.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/info/mpfr.info
/usr/local/share/info is not writable.

You can try again using:
brew link mpfr
==> Summary
đŸș /usr/local/Cellar/mpfr/3.1.4: 25 files, 3.6M
==> Installing homebrew/versions/gcc6 dependency: libmpc
==> Downloading https://homebrew.bintray.com/bottles/libmpc-1.0.3.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libmpc-1.0.3.yosemite.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/info/mpc.info
/usr/local/share/info is not writable.

You can try again using:
brew link libmpc
==> Summary
đŸș /usr/local/Cellar/libmpc/1.0.3: 11 files, 350K
==> Installing homebrew/versions/gcc6 dependency: isl014
==> Downloading https://homebrew.bintray.com/bottles-versions/isl014-0.14.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring isl014-0.14.yosemite.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.

Conflicts with isl in main repository.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

LDFLAGS: -L/usr/local/opt/isl014/lib
CPPFLAGS: -I/usr/local/opt/isl014/include

==> Summary
đŸș /usr/local/Cellar/isl014/0.14: 69 files, 3.2M
==> Installing homebrew/versions/gcc6
==> Downloading https://homebrew.bintray.com/bottles-versions/gcc6-6.1.0.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring gcc6-6.1.0.yosemite.bottle.tar.gz
đŸș /usr/local/Cellar/gcc6/6.1.0: 1,434 files, 281.8M



********* I switched my make/local to new g++-6 file **************

~/cmdstan/stan/lib/stan_math(develop)$ ./runTests.py -j4 test/unit/math/prim/scal/fun/log_test.cpp
------------------------------------------------------------
make -j4 test/unit/math/prim/scal/fun/log_test
dyld: Library not loaded: /usr/local/lib/libgmp.10.dylib
Referenced from: /usr/local/opt/isl014/lib/libisl.13.dylib
Reason: image not found
g++-6: internal compiler error: Trace/BPT trap: 5 (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://github.com/Homebrew/homebrew-versions/issues> for instructions.
/usr/local/bin/g++-6 -I . -isystem lib/eigen_3.2.8 -isystem lib/boost_1.60.0 -isystemlib/cvodes_2.8.2/include -Wall -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DNO_FPRINTF_OUTPUT -pipe -Wno-unused-function -c -O0 -DGTEST_USE_OWN_TR1_TUPLE -isystem lib/gtest_1.7.0/include -isystem lib/gtest_1.7.0 test/unit/math/prim/scal/fun/log_test.cpp -o test/unit/math/prim/scal/fun/log_test.o
dyld: Library not loaded: /usr/local/lib/libgmp.10.dylib
Referenced from: /usr/local/opt/isl014/lib/libisl.13.dylib
Reason: image not found
g++-6: internal compiler error: Trace/BPT trap: 5 (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://github.com/Homebrew/homebrew-versions/issues> for instructions.
make: *** [test/unit/math/prim/scal/fun/log_test.o] Error 4
rm test/unit/math/prim/scal/fun/log_test.o
make -j4 test/unit/math/prim/scal/fun/log_test failed
exit now (08/13/16 19:08:02 CEST)
~/cmdstan/stan/lib/stan_math(develop)$ /usr/local/bin/g++-6 --version
g++-6 (Homebrew gcc6 6.1.0) 6.1.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


~/cmdstan/stan/lib/stan_math(develop)$ brew link libmpc
Linking /usr/local/Cellar/libmpc/1.0.3...
Error: Could not symlink share/info/mpc.info
/usr/local/share/info is not writable.


~/cmdstan/stan/lib/stan_math(develop)$ sudo brew link libmpc
Password:
Error: Cowardly refusing to 'sudo brew link'
You can use brew with sudo, but only if the brew executable is owned by root.
However, this is both not recommended and completely unsupported so do so at
your own risk.

~/cmdstan/stan/lib/stan_math(develop)$ chmod +w /usr/local/share/info

~/cmdstan/stan/lib/stan_math(develop)$ sudo brew link libmpc
Error: Cowardly refusing to 'sudo brew link'
You can use brew with sudo, but only if the brew executable is owned by root.
However, this is both not recommended and completely unsupported so do so at
your own risk.

~/cmdstan/stan/lib/stan_math(develop)$ brew link libmpc
Linking /usr/local/Cellar/libmpc/1.0.3...
Error: Could not symlink share/info/mpc.info
/usr/local/share/info is not writable.

~/cmdstan/stan/lib/stan_math(develop)$ ls -l /usr/local/share/info
total 2360
-rw-r--r-- 1 root wheel 1378 Jan 6 2015 dir
-rw-r--r-- 1 root wheel 112428 Jan 6 2015 info-stnd.info
-rw-r--r-- 1 root wheel 92477 Jan 6 2015 info.info
-rw-r--r-- 1 root wheel 15945 Jan 6 2015 texinfo.info
-rw-r--r-- 1 root wheel 300140 Jan 6 2015 texinfo.info-1
-rw-r--r-- 1 root wheel 302196 Jan 6 2015 texinfo.info-2
-rw-r--r-- 1 root wheel 370485 Jan 6 2015 texinfo.info-3
~/cmdstan/stan/lib/stan_math(develop)$

Any help greatly appreciated.

- Bob

Daniel Lee

unread,
Aug 13, 2016, 1:25:02 PM8/13/16
to stan...@googlegroups.com
I'm in the same boat. I can't get g++-6 installed.

I've asked Ben to set up the Linux box in his office with it installed. Once that's set up, we should be able to ssh into it and test.


Daniel
> --
> You received this message because you are subscribed to the Google Groups "stan development mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to stan-dev+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Bob Carpenter

unread,
Aug 13, 2016, 1:28:07 PM8/13/16
to stan...@googlegroups.com
I've promised myself that the next project I work on
after Stan will not be something users have to install
on arbitrary platforms and won't be something where other
packages control dependencies! This user-centric software
in C++ is crazy-making.

- Bob

Michael Betancourt

unread,
Aug 13, 2016, 1:28:50 PM8/13/16
to stan...@googlegroups.com
I always had trouble installing compilers from brew, but MacPorts always worked really well.

Sebastian Weber

unread,
Aug 13, 2016, 1:31:39 PM8/13/16
to stan development mailing list
I am a MacPorts user and installing gcc 6 went flawless with it. You guys want to try MAcPorts or should I run some test on some branch for you?

On Saturday, August 13, 2016 at 7:25:02 PM UTC+2, Daniel Lee wrote:
> I'm in the same boat. I can't get g++-6 installed.
>
> I've asked Ben to set up the Linux box in his office with it installed. Once that's set up, we should be able to ssh into it and test.
>
>
> Daniel
>
>
> > On Aug 13, 2016, at 1:15 PM, Bob Carpenter
> >

Jiqiang Guo

unread,
Aug 13, 2016, 2:13:56 PM8/13/16
to stan...@googlegroups.com
It worked for me to try installing gcc-6 using brew.  It looks it's the file/folder permission messed up.  Maybe the following would hep.

$ brew doctor

Jiqiang 

> > To unsubscribe from this group and stop receiving emails from it, send an email to stan-dev+unsubscribe@googlegroups.com.

> > For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "stan development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-dev+unsubscribe@googlegroups.com.

Ben Goodrich

unread,
Aug 13, 2016, 2:50:10 PM8/13/16
to stan development mailing list
On Saturday, August 13, 2016 at 1:25:02 PM UTC-4, Daniel Lee wrote:
I've asked Ben to set up the Linux box in his office with it installed. Once that's set up, we should be able to ssh into it and test.

It is set up, but it seems to be blocking ssh connections from outside Columbia. I'll test the branch.

Ben

Bob Carpenter

unread,
Aug 13, 2016, 5:29:08 PM8/13/16
to stan...@googlegroups.com
OK, an hour later and 50% of my notebook's power consumed,
macports installed g++6.

I can tickle the issue Ben raised with this unit test
in stan-dev/math:

#include <stan/math.hpp>
#include <boost/math/special_functions/fpclassify.hpp>
#include <gtest/gtest.h>

TEST(MathFunctions, log_compiles) {
using std::log;
using stan::math::log;
double y = log(3);
double z = log(3.0);
}

Everything works if you comment out the "using std::log;" line.

I was also able to recreate the problem compiling a model
in CmdStan using g++-6, but now I have no idea why. And g++-6
takes a long long long long time to compile things.

- Bob

Bob Carpenter

unread,
Aug 13, 2016, 5:47:08 PM8/13/16
to stan...@googlegroups.com
Thanks for all the help everyone. I just love our lists!

I can get everything to work by adding a definition
for stan::math::log(int):

namespace stan {
namespace math {

inline double log(int x) {
return std::log(static_cast<double>(x));
}

...

I think that may be OK everywhere because there are no
specializations for log(int) anywhere in std:: and it'll
be more specific than any other function, so it should be OK.
I'll run all of our tests and see if it works.

Does anyone see any other problems with doing this (for
both log and the other problematic functions for integers).
I still can't see why sqrt() isn't a problem, as it looks
just the same as log() in terms of how it's handled in C++11:

http://www.cplusplus.com/reference/cmath/log/
http://www.cplusplus.com/reference/cmath/sqrt/

The second set of C++ tabs under C++11 show that they're
both specialized to int. But for some reason, like Ben,
I don't see a problem with sqrt() and don't need the
overload for int in stan::math to make everything compile.

- Bob
Reply all
Reply to author
Forward
0 new messages