Can't compile on OS X Lion

146 views
Skip to first unread message

Eric Fredine

unread,
Dec 11, 2012, 1:44:28 PM12/11/12
to milk-...@googlegroups.com
I've been trying to install Milk on my OS X Lion machine and having trouble compiling.  I tried to resolve it by installing gcc version 4.7 from macports, but the compiler is still reporting an error.  

g++: error: unrecognized command line option '-stdlib=libc++'

Suggestions?

Thanks,
Eric

Luis Pedro Coelho

unread,
Dec 12, 2012, 4:36:41 AM12/12/12
to milk-...@googlegroups.com
Hi,

You can try removing the following lines from setup.py:

if platform.system() == 'Darwin':
compiler_args.append('-stdlib=libc++')

It's very hard to keep track of all the flags that are needed for all
platforms.

HTH
Luis

On 12/11/2012 06:44 PM, Eric Fredine wrote:
> I've been trying to install Milk on my OS X Lion machine and having
> trouble compiling. I tried to resolve it by installing gcc version 4.7
> from macports, but the compiler is still reporting an error.
>
> *g++: error: unrecognized command line option '-stdlib=libc++'*
>
> Suggestions?
>
> Thanks,
> Eric
>

Stephanie Rickett

unread,
Jan 8, 2013, 8:26:17 AM1/8/13
to milk-...@googlegroups.com
Eric,

Did you ever get this to work?

Stephanie Rickett

unread,
Jan 8, 2013, 9:59:29 AM1/8/13
to milk-...@googlegroups.com
You should try it replacing stdlib with std.

On Tuesday, December 11, 2012 1:44:28 PM UTC-5, Eric Fredine wrote:

Luis Pedro Coelho

unread,
Jan 8, 2013, 10:15:50 AM1/8/13
to milk-...@googlegroups.com
On a related note,

As part of a discussion of https://github.com/luispedro/milk/issues/8

I generated a trial package, which includes eigen as part of the source

http://luispedro.org/raw/milk-0.5-git.tar.gz

If someone confirms to me that this works on Mac OS, I will release it
on PyPI

Thanks
Luis

On 01/08/2013 02:59 PM, Stephanie Rickett wrote:
> You should try it replacing stdlib with std.
>
> On Tuesday, December 11, 2012 1:44:28 PM UTC-5, Eric Fredine wrote:
>
> I've been trying to install Milk on my OS X Lion machine and having
> trouble compiling. I tried to resolve it by installing gcc version
> 4.7 from macports, but the compiler is still reporting an error.
>
> *g++: error: unrecognized command line option '-stdlib=libc++'*
>
> Suggestions?
>
> Thanks,
> Eric
>

Norman Vine

unread,
Jan 8, 2013, 1:47:20 PM1/8/13
to milk-...@googlegroups.com
On Jan 8, 2013, at 10:15 AM, Luis Pedro Coelho <lu...@luispedro.org> wrote:

On a related note,

As part of a discussion of https://github.com/luispedro/milk/issues/8

I generated a trial package, which includes eigen as part of the source

http://luispedro.org/raw/milk-0.5-git.tar.gz

If someone confirms to me that this works on Mac OS, I will release it on PyPI


Compiled and installed but had a few errors running the tests

OSX 10.8.2




In [7]: from milk import tests

In [8]: tests.run()
EE...............E...........

----------------------------------------------------------------------
Ran 132 tests in 39.908s

FAILED (errors=15)

In [13]: milksets.milksets_version
Out[13]: <module 'milksets.milksets_version' from '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/milksets-0.1.3_git-py2.7.egg/milksets/milksets_version.pyc'>

gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)


Thanks for your great software :-)

Norman


Norman Vine

unread,
Jan 8, 2013, 9:27:07 PM1/8/13
to milk-...@googlegroups.com
My previous post were the results from running inside the milk build directory

running after 'setup.py install' things are much better

eg  imports don't fail



In [1]: from milk import tests
 
In [2]: tests.run()

…….


======================================================================
FAIL: milk.tests.test_svm.test_platt_correction_class
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/milk-0.5_git-py2.7-macosx-10.8-x86_64.egg/milk/tests/test_svm.py", line 136, in test_platt_correction_class
    assert model.B == B
AssertionError
 
----------------------------------------------------------------------
Ran 132 tests in 54.648s
 
FAILED (failures=1)
 
In [3]:


Mike Hughes

unread,
Jan 17, 2013, 1:42:34 AM1/17/13
to milk-...@googlegroups.com
I'm having similar trouble as Eric. Lots of trouble building and installing on OS X Lion, but I finally found a partial workaround.

When I try to compile milk out-of-the-box, I get this error:


unrecognized command line option '-stdlib=libc++'

This extra compiler argument doesn't seem to be supported by my version of g++ distributed with Xcode, which links to llvm-g++-4.2.  I also tried gcc47 (via macports), but it also doesn't recognize that option.

However, I found that another compiler, clang++, *does* support this option.  So I dug into /usr/bin/, unlinked g++ to the llvm compiler, and instead linked it to clang++. (NOTE: make sure you change this back if you try this).

This let me build *most* everything, but failed on lasso:

error: unable to open output file 'build/temp.macosx-10.5-i386-2.7/milk/supervised/_lasso.o': 'Error opening output file 'build/temp.macosx-10.5-i386-2.7/milk/supervised/_lasso.o''

Since I don't need lasso soon (I just need milk for kmeans), I just went ahead and commented it out in the setup.py.  Everything now builds fine and I can successfully import milk.unsupervised

However, this is a bit unsatisfactory... anybody have advice about better ways to get an OS X compiler to recognize libc++?

Ian Mulvany

unread,
Mar 6, 2013, 12:13:37 PM3/6/13
to milk-...@googlegroups.com
I've just tried the suggestion of switching the compiler, and I've tried against the bare git repo, as well as the modified version of milk linked to in this thread, and I had no success. The fatal error is:

#include "eigen3/Eigen/Dense"
         ^
1 error generated.
milk/supervised/_lasso.cpp:10:10: fatal error: 'eigen3/Eigen/Dense' file not found
#include "eigen3/Eigen/Dense"

Ian Mulvany

unread,
Mar 6, 2013, 12:15:41 PM3/6/13
to milk-...@googlegroups.com
In addition I have tried installing on ubuntu via Vagrant as a VM and I get the following error:

error: Command "g++ -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -I/usr/lib/python2.6/dist-packages/numpy/core/include -I/usr/include/python2.6 -c milk/supervised/_perceptron.cpp -o build/temp.linux-i686-2.6/milk/supervised/_perceptron.o -std=c++0x" failed with exit status 1

libeigen3-dev seems unavailalbe and I am only able to install libeigen2-dev, I don't know if this is related.


On Thursday, January 17, 2013 6:42:34 AM UTC, Mike Hughes wrote:

Luis Pedro Coelho

unread,
Mar 7, 2013, 1:21:40 PM3/7/13
to milk-...@googlegroups.com
I have fixed an important issue in the git version.

Unfortunately, I lost my access to PyPI so I cannot upload it :( Once this gets sorted out, I will upload it immediately.

In the meanwhile, you can try downloading from github:

https://github.com/luispedro/milk/archive/release-0.5.2.tar.gz

HTH
Luis

PS: PyPI had a password reset [http://mechanicalcat.net/richard/log/Python/PyPI_password_related_security_changes]. Unfortunately, my account was still linked to my old CMU email. I have asked for a reset, but am waiting for response.
> --
> You received this message because you are subscribed to the Google Groups "milk users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to milk-users+...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Reply all
Reply to author
Forward
0 new messages