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

Weakened off what "static linking" means when building for OS X. #169

Merged
merged 1 commit into from
May 4, 2016
Merged

Weakened off what "static linking" means when building for OS X. #169

merged 1 commit into from
May 4, 2016

Conversation

bobsummerwill
Copy link
Contributor

Apple explicitly does not support statically linked binaries (i.e., for the executable itself) on OS X.
See https://developer.apple.com/library/mac/qa/qa1118/_index.html for more info.
But it does support static linkage of the external libraries being used by that executable, which is almost as good.
This is part of ethereum/webthree-umbrella#495, where we are adding support for static builds to the codebase.

For OS X we currently only have partially-static library linkage too. We would need to build the following from source to have .a files to link against instead of their dylibs which we get from Homebrew:

  • jsoncpp
  • json-rpc-cpp
  • leveldb
  • miniupnp
  • gmp

Two further libraries (curl and zlib) ship as dylibs with the platform but again we could build from source and statically link these too.

RelWithDebugInfo for a statically linked OS X binary is 13MB.

@bobsummerwill
Copy link
Contributor Author

CC @rainbeam.

@@ -89,7 +82,7 @@ See https://developer.apple.com/library/mac/qa/qa1118/_index.html for more info.
if(MSVC)
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
else()
set(CMAKE_FIND_LIBRARY_SUFFIXES .a )
set(CMAKE_FIND_LIBRARY_SUFFIXES .a .dylib)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment connecting .dylib to osx.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how the precedence works here. Will it prioritise .a over .dylib where both are present?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears to do that, yes.

@rainbreak
Copy link
Contributor

Makes sense. Work with what the platform gives you. I really don't know much about OSX though so no idea on distribution implications of static linking.

Is that 13MB binary stripped?

Apple explicitly does not support statically linked binaries (i.e., for the executable itself) on OS X.
See https://developer.apple.com/library/mac/qa/qa1118/_index.html for more info.
But it does support static linkage of the external libraries being used by that executable, which is almost as good.
This is part of ethereum/webthree-umbrella#495, where we are adding support for static builds to the codebase.

For OS X we currently only have partially-static library linkage too.   We would need to build the following from source to have .a files to link against instead of their dylibs which we get from Homebrew:

- jsoncpp
- json-rpc-cpp
- leveldb
- miniupnp
- gmp

Two further libraries (curl and zlib) ship as dylibs with the platform but again we could build from source and statically link these too.

RelWithDebugInfo for a statically linked OS X binary is 13MB.
@bobsummerwill
Copy link
Contributor Author

Updated as per comments. Got OK from Greg with those caveats. Merging.

@bobsummerwill bobsummerwill merged commit baa520c into ethereum:develop May 4, 2016
@bobsummerwill
Copy link
Contributor Author

@rainbeam - "Is that 13MB binary stripped?"

I think so, though I am not 100% sure. It's certainly massively smaller than it was, but I suspect it will go smaller again when we have all the libraries statically linked. I'll really dig into the linker settings for static linking when all these other more immediate issues are resolved.

Trying to do WIndows static build now.

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

Successfully merging this pull request may close these issues.

2 participants