Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac OS: unable to build libprotobuf with libc++ and deployment target 10.7 #3156

Closed
JakubBednar opened this issue May 30, 2017 · 5 comments
Closed
Assignees

Comments

@JakubBednar
Copy link

Hello,

I am trying to build libprotobuf for mac os x 10.7 using SDK for 10.9 with libc++. Here are my results so far:

  1. Specifying CXXFLAGS="-mmacosx-version-min=10.9 -isysroot <path to 10.9 sdk>" ends with correct protobuf libraries linking only libc++

  2. Specifying CXXFLAGS="-mmacosx-version-min=10.7 -isysroot <path to 10.9 sdk>" ends with incorrect protobuf libraries linking only libstdc++

  3. Specifying CXXFLAGS="-mmacosx-version-min=10.7 -isysroot <path to 10.9 sdk> -stdlib=libc++" ends with compiler error when linking the libraries

  4. Specifying CXXFLAGS="-mmacosx-version-min=10.7 -isysroot <path to 10.9 sdk> -stdlib=libc++" and LIBS=-lc++ ends with incorrect protobuf libraries linking both libc++ and libstdc++

I have tried with old protobuf 2.5.0 as well as new 3.3.0. Is there a way how to force the buildsystem to link only with libc++ with macosx-version-min set to 10.7?

Thanks a lot,

Jakub

@thomasvl
Copy link
Contributor

thomasvl commented Jun 2, 2017

When setting flags, are you doing it on the configure or the make?

For ObjC, we've got a wrapper script we use to build the protoc to use, so you might be able to steal some ideas from there.

@JakubBednar
Copy link
Author

I was passing the options to configure. I am using the cpp version of protobuf source code packages so I can use configure directly without autogen.

I was trying to find a way how to tweak the linking during make, but was not able to. I think the problem is somewhere around the libtool wrapper you use for linking. It does not correctly propagate the -stdlib=libc++ option as I saw it being passed to compiler but not to linker.

@thomasvl
Copy link
Contributor

thomasvl commented Dec 11, 2017

@TeBoring sorry, I can't say I have any real experience sorting though the libtool/configure/automake side of things, I've done just the minimal work to get the conformance test building for ObjC.

I can help explain some of the macOS specific options the compiler can use, but getting them into the protobuf build is likely better handled by someone that knows that process.

@TeBoring
Copy link
Contributor

@JakubBednar Do you still have problem?
I found this issue may be useful: nodejs/node-gyp#469
Besides, have you tried defining LDFLAGS="-mmacosx-version-min=10.7 in option 2?

@TeBoring
Copy link
Contributor

Feel free to reopen if there is still problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants