Homebrew / legacy-homebrew

πŸ’€ The former home of Homebrew/homebrew (deprecated)
https://brew.sh
27k stars 11.36k forks source link

MongoDB failed to build on OS X 10.9 #22771

Closed hipertracker closed 10 years ago

hipertracker commented 10 years ago

MongoDB does not compile on OS X 10.9 (13A584)

$ uname -a
Darwin mbp7i.local 13.0.0 Darwin Kernel Version 13.0.0: Fri Sep 13 23:35:55 PDT 2013; root:xnu-2422.1.72~1/RELEASE_X86_64 x86_64

$ brew install mongodb
==> Downloading http://downloads.mongodb.org/src/mongodb-src-r2.4.6.tar.gz
Already downloaded: /Library/Caches/Homebrew/mongodb-2.4.6.tar.gz
==> scons install --prefix=/usr/local/Cellar/mongodb/2.4.6 -j8 --64
#include <tr1/unordered_set>
         ^
1 error generated.
scons: *** [build/darwin/64/mongo/db/auth/auth_external_state_d.o] Error 1
scons: building terminated because of errors.

READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting

These open issues may also help:
    https://github.com/mxcl/homebrew/issues/22696
MikeMcQuaid commented 10 years ago

I'd suggest reporting it to them directly.

mistydemeo commented 10 years ago

This is a C++11 issue; similar issues filed as #22612 and #22259. The tr1 prefix on the headers is not supported in libc++, which is the C++ stdlib used by default in 10.9. (For more details, see #22612)

chrisnicola commented 10 years ago

This is probably terrible advice but I managed to get it going by using apple-gcc42 and linking it to gcc/g++. Proceed at your own risk though I have no clue what I'm doing.

mistydemeo commented 10 years ago

You shouldn't need to do that. --use-gcc or --cc=gcc-4.2 will select that compiler during a build, if it's installed.

RobertWHurst commented 10 years ago

Well thats great... apple-gcc42 is unavailable.

technowar commented 10 years ago

Is there any solution for this?

chrisnicola commented 10 years ago

@mistydemeo yeah should have mentioned I'm on Mavericks right now which removed gcc entirely. On Mountain Lion I believe you're right that's all you need to do.

mistydemeo commented 10 years ago

This is being tracked upstream, but I'm nervous about their proposed fix so I added some more detail: https://jira.mongodb.org/browse/SERVER-10644

mistydemeo commented 10 years ago

According to the mongodb developers:

The work to support libc++ and clang is complete, but it all took place on master after the 2.4 branch was created, and it is extremely unlikely that we would backport that work to the 2.4 branch.

They suggest patching locally, or building using libstdc++ on 10.9. mongodb is not expected to be libc++-compatible until 2.6 comes out.

MikeMcQuaid commented 10 years ago

If we can apply patches locally, great.

mistydemeo commented 10 years ago

They didn't provide any information and I don't know how extensive it would be, so using libstdc++ might be the simplest path here.

MikeMcQuaid commented 10 years ago

I guess we can look at the files with errors on GitHub and keep backporting patches until it works. I can take a look if you'd rather?

GusGA commented 10 years ago

Hi Everyone, I found a Solution to this problem.

Just Modify the SystemVersion.plist located in/System/Library/CoreServices/SystemVersion.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>ProductBuildVersion</key>
        <string>13A598</string>
        <key>ProductCopyright</key>
        <string>1983-2013 Apple Inc.</string>
        <key>ProductName</key>
        <string>Mac OS X</string>
        <key>ProductUserVisibleVersion</key>
        <string>10.9</string> 
        <key>ProductVersion</key>
        <string>10.9</string>
</dict>
</plist>

Change

        <key>ProductUserVisibleVersion</key>
        <string>10.8</string>
        <key>ProductVersion</key>
        <string>10.8</string> 

I found this cheat solution here

jacknagel commented 10 years ago

Please don't do that, modifying system files is never a good idea.

emilford commented 10 years ago

@jacknagel @mistydemeo Any other suggestions for a temporary resolution? I'm running into the same issue w/ installing mongodb on Mavericks GM.

MikeMcQuaid commented 10 years ago

@emilford report it to them directly, use GCC, use a 10.8 bottle.

emilford commented 10 years ago

@mikemcquaid Can you explain how exactly to do that? Not exactly sure. I tried brew install --use-gcc mongo but same issue.

MikeMcQuaid commented 10 years ago

Then your options are: report it to them directly, use a 10.8 bottle.

mistydemeo commented 10 years ago

@mikemcquaid We should probably force mongodb to use libstdc++ for now. The devs are going to fix it but it's evidently going to take awhile.

MikeMcQuaid commented 10 years ago

@mistydemeo Fair enough, go for it.

mistydemeo commented 10 years ago

Pushed a fix, can you please retry?

CreativExit commented 10 years ago

Hi, i have Mavericks 10.9 GM and make this:

Found this file make 2 backup of this file. Change 1 file from 10.9 to 10.8 save and drop the file to CoreServices folder. When install mongodb Drop the another backup file contain the original data and DONE.

Warning is own your risk.

/System/Library/CoreServices/SystemVersion.plist

mistydemeo commented 10 years ago

@CreativExit Please don't do that, it will cause problems in the future.

I pushed a fix for the mongodb problem yesterday. Did you test it before doing that?

CreativExit commented 10 years ago

No… I don’t see the Fix Comment.

Thanks

Christian Gonzalez Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Tuesday, October 15, 2013 at 11:28 AM, Misty De Meo wrote:

@CreativExit (https://github.com/CreativExit) Please don't do that, it will cause problems in the future. I pushed a fix for the mongodb problem yesterday. Did you test it before doing that?

β€” Reply to this email directly or view it on GitHub (https://github.com/mxcl/homebrew/issues/22771#issuecomment-26344517).

vincepri commented 10 years ago

@mistydemeo I have tried after you published the patch, still not compiling. https://gist.github.com/vinceprignano/6991157

mistydemeo commented 10 years ago

It looks like the -stdlib= switch is not being passed along despite being in CXXFLAGS.

mistydemeo commented 10 years ago

@manphiz Is it dangerous to pass along -stdlib= in general to LDFLAGS? It looks like it's simply ignored by clang, while it does what we expect in clang++.

romaninsh commented 10 years ago

I've tried executing "python /usr/local/bin/scons install --prefix=/usr/local/Cellar/mongodb/2.4.6 -j8 --64" manually and it seems to ignore CXXFLAGS.

If I execute g++ manually, then it works:

$ g++ -o build/darwin/64/mongo/db/auth/auth_server_parameters.o -c -Wnon-virtual-dtor -Woverloaded-virtual -fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -O3 -m64 -DBOOST_ALL_NO_LIB -D_SCONS -DMONGO_EXPOSE_MACROS -DSUPPORT_UTF8 -D_FILE_OFFSET_BITS=64 -DMONGO_HAVE_HEADER_UNISTD_H -DMONGO_HAVE_EXECINFO_BACKTRACE -Ibuild/darwin/64/third_party/libstemmer_c/include -Isrc/third_party/libstemmer_c/include -Ibuild/darwin/64/third_party/s2 -Isrc/third_party/s2 -Ibuild/darwin/64/third_party/boost -Isrc/third_party/boost -Ibuild/darwin/64/third_party/pcre-8.30 -Isrc/third_party/pcre-8.30 -Ibuild/darwin/64 -Isrc -Ibuild/darwin/64/mongo -Isrc/mongo -I/usr/64/include -Ibuild/darwin/64/third_party/s2 -Isrc/third_party/s2 -Ibuild/darwin/64/third_party/snappy -Isrc/third_party/snappy -Ibuild/darwin/64/third_party/v8/include -Isrc/third_party/v8/include src/mongo/db/auth/auth_server_parameters.cpp -stdlib=libstdc++

I am not familiar with the build process, but please suggest where could this

romaninsh commented 10 years ago

https://gist.github.com/romaninsh/6995173

mistydemeo commented 10 years ago

Hm.

We may need superenv to force the flags, even if scons doesn't pass them along.

romaninsh commented 10 years ago

File SConstruct, line 718:

env.Append( CXXFLAGS=["-Wnon-virtual-dtor", "-Woverloaded-virtual"] )

seems to override CXXFLAGS. If I change it to:

env.Append( CXXFLAGS=["-Wnon-virtual-dtor", "-Woverloaded-virtual", "-stdlib=libstdc++"] )

then build seems to work. Looks like we would need a patch.

romaninsh commented 10 years ago

Quote: "As for CC, CXX, CFLAGS and etc, you'll have to patch scripts/build_environment.py for that as it drops all environment in importEnvironment()." from http://comments.gmane.org/gmane.linux.gentoo.devhelp/104

also http://wiki.gentoo.org/wiki/SCons#Missing_CC.2C_CFLAGS.2C_LDFLAGS

romaninsh commented 10 years ago

I've got it to build on GM version of Mavericks with command-line tools only. This patch adds -stdlib=libstdc++ into CXXFLAGS but only for 10.9.

I apologize if i did anything wrong, my first time contributing.

romaninsh commented 10 years ago

I have updated my pull request to use apple-gcc42, and now it builds and installs successfully.

MikeMcQuaid commented 10 years ago

I don't really understand why this needs GCC on 10.9 but not 10.8?

Sent from my iPhone; please excuse brevity and typos.

On 15 Oct 2013, at 20:13, Romans Malinovskis notifications@github.com wrote:

I have updated my pull request to use apple-gcc42, and now it builds and installs successfully.

β€” Reply to this email directly or view it on GitHub.

romaninsh commented 10 years ago

Because after using technique suggested here: https://jira.mongodb.org/browse/SERVER-10644 it still fails to link at the late stages: https://gist.github.com/romaninsh/6997201

mistydemeo commented 10 years ago

It might not be passing along the correct stdlib selection at the link stage.

manphiz commented 10 years ago

As my comment in your commit, you want to append to $CXX.

On Oct 15, 2013 12:26 PM, "Misty De Meo" notifications@github.com wrote:

It might not be passing along the correct stdlib selection at the link stage.

β€” Reply to this email directly or view it on GitHub.

romaninsh commented 10 years ago

So that's the line: https://github.com/romaninsh/mongo/blob/v2.4/SConstruct#L719, i'll try it later today.

romaninsh commented 10 years ago

@mistydemeo you were right. I've just got successful build with clang: https://gist.github.com/romaninsh/7006395. Will submit a pull request shortly.

romaninsh commented 10 years ago

https://github.com/mxcl/homebrew/pull/23308 - here is pull request.

throrin19 commented 10 years ago

i've an error on brew install mongodb on final Maverick :

==> Downloading http://downloads.mongodb.org/src/mongodb-src-r2.4.6.tar.gz
Already downloaded: /Library/Caches/Homebrew/mongodb-2.4.6.tar.gz
==> Downloading patches
######################################################################## 100,0%
==> Patching
patching file src/third_party/v8/SConscript
==> scons install --prefix=/usr/local/Cellar/mongodb/2.4.6 -j8 --64
1 error generated.
scons: *** [build/darwin/64/mongo/db/auth/auth_server_parameters.o] Error 1
1 error generated.
scons: *** [build/darwin/64/mongo/db/auth/authorization_manager.o] Error 1
scons: building terminated because of errors.

READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting

These open issues may also help:
    https://github.com/mxcl/homebrew/issues/23519
MikeMcQuaid commented 10 years ago

Try again, these issues should be fixed.

throrin19 commented 10 years ago

it's not fixed, i try again just now and i've the same error

vincepri commented 10 years ago

Have you run brew update and brew doctor before trying again?

Vincenzo Prignano Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Thursday, October 24, 2013 at 10:27 AM, Benjamin Besse wrote:

it's not fixed, i try again just now and i've the same error

β€” Reply to this email directly or view it on GitHub (https://github.com/mxcl/homebrew/issues/22771#issuecomment-26974503).

throrin19 commented 10 years ago

thanks, i miss update brew. Sorry

kingink commented 10 years ago

I am still having an issue with installing mogodb on Mavericks, although it really looks like a scons issue not mongodb

➜ ~ brew install mongodb ==> Downloading http://downloads.mongodb.org/src/mongodb-src-r2.4.7.tar.gz Already downloaded: /Library/Caches/Homebrew/mongodb-2.4.7.tar.gz ==> Downloading patches ######################################################################## 100.0% ==> Patching patching file src/third_party/v8/SConscript ==> scons install --prefix=/usr/local/Cellar/mongodb/2.4.7 -j4 --64 --cc=/usr/bin/clang --cxx=/usr/bin/clang++ -stdlib=libstdc++ Traceback (most recent call last): File "/usr/local/share/python/scons", line 188, in import SCons.Script ImportError: No module named SCons.Script

READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting

These open issues may also help: https://github.com/mxcl/homebrew/issues/23519

bbuenz commented 10 years ago

I also still have an issue even though I updated ==> scons install --prefix=/usr/local/Cellar/mongodb/2.4.8 -j4 --64 --cc=/usr/bi platform(self) File "/usr/local/Cellar/scons/2.3.0/libexec/scons-local/SCons/Platform/init.py", line 129: return self.generate(_args, *_kw) File "/usr/local/Cellar/scons/2.3.0/libexec/scons-local/SCons/Platform/darwin.py", line 59: f = open(file, 'r')

doublesharp commented 10 years ago

I am also still having issues despite updating:

/Users/username
> brew update
Already up-to-date.

/Users/username
> brew install mongodb
==> Downloading http://downloads.mongodb.org/src/mongodb-src-r2.4.8.tar.gz
Already downloaded: /Library/Caches/Homebrew/mongodb-2.4.8.tar.gz
==> Downloading patches
######################################################################## 100.0%
==> Patching
patching file src/third_party/v8/SConscript
==> scons install --prefix=/usr/local/Cellar/mongodb/2.4.8 -j8 --64 --cc=/usr/bin/clang --cxx=/usr/bin/clang++ -stdlib=libstdc++
Failed to execute: scons

READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting

These open issues may also help:
    https://github.com/mxcl/homebrew/issues/23519
doublesharp commented 10 years ago

I was able to get this working on my system by removing the brew installed version of (older) python, scons, sqlite and then reinstalling all but python followed by mongodb.

> brew remove python scons

/Users/username
> brew remove --force sqlite
Uninstalling sqlite...

/Users/username
> brew cleanup

/Users/username
> brew install sqlite
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/sqlite-3.8.1.mavericks.bottle.tar.gz
Already downloaded: /Library/Caches/Homebrew/sqlite-3.8.1.mavericks.bottle.tar.gz
==> Pouring sqlite-3.8.1.mavericks.bottle.tar.gz
==> Caveats
This formula is keg-only: so it was not symlinked into /usr/local.

Mac OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.

OS X provides an older sqlite3.

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/sqlite/lib
    CPPFLAGS: -I/usr/local/opt/sqlite/include

==> Summary
[]  /usr/local/Cellar/sqlite/3.8.1: 9 files, 2.0M

/Users/username
> brew install scons
==> Downloading http://downloads.sourceforge.net/scons/scons-2.3.0.tar.gz
Already downloaded: /Library/Caches/Homebrew/scons-2.3.0.tar.gz
==> /usr/bin/python setup.py install --prefix=/usr/local/Cellar/scons/2.3.0 --standalone-lib --install-lib=/usr/local/Cellar/scons/2.3.0/libexec/scons-local --install-scripts=/usr/local/Cellar/scons/2.3.
[]  /usr/local/Cellar/scons/2.3.0: 395 files, 4.2M, built in 2 seconds

/Users/username
> brew install mongodb
==> Downloading http://downloads.mongodb.org/src/mongodb-src-r2.4.8.tar.gz
Already downloaded: /Library/Caches/Homebrew/mongodb-2.4.8.tar.gz
==> Downloading patches
######################################################################## 100.0%
==> Patching
patching file src/third_party/v8/SConscript
==> scons install --prefix=/usr/local/Cellar/mongodb/2.4.8 -j8 --64 --cc=/usr/bin/clang --cxx=/usr/bin/clang++ -stdlib=libstdc++
==> Caveats
To have launchd start mongodb at login:
    ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents
Then to load mongodb now:
    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
Or, if you don't want/need launchctl, you can just run:
    mongod
==> Summary
[]  /usr/local/Cellar/mongodb/2.4.8: 18 files, 271M, built in 4.5 minutes