crystal-lang / distribution-scripts

40 stars 24 forks source link

Omnibus: build libyaml with --disable-shared #95

Closed straight-shoota closed 3 years ago

straight-shoota commented 3 years ago

Removing the dynamic library forces the compiler to pick the static library, removing libyaml as a runtime dependency for shards.

Resolves https://github.com/crystal-lang/crystal/issues/5994

CI run at https://app.circleci.com/pipelines/github/crystal-lang/crystal/5733/workflows/94b82b64-c487-4364-b9f7-424fa591e8ab

straight-shoota commented 3 years ago

Maintenance build is 🟢

The artifact is available at https://60431-6887813-gh.circle-artifacts.com/0/build/crystal-ci-darwin-static-dev-1-darwin-x86_64.tar.gz Shards binary does not have dynamic dependency on libyaml. Since I don't have a mac I jerry-rigged strings embedded/bin/shards | grep dylib to verify, but that should be good 😆 But I wouldn't mind if someone can validate on macos with otool -L.

/cc @kevinsjoberg

bcardiff commented 3 years ago
% otool -L ~/Downloads/crystal-1.0.0-1/embedded/bin/shards 
/Users/bcardiff/Downloads/crystal-1.0.0-1/embedded/bin/shards:
    /opt/crystal/embedded/lib/libyaml-0.2.dylib (compatibility version 3.0.0, current version 3.4.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0)
    /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)

vs

% otool -L ~/Downloads/crystal-ci-darwin-static-dev-1/embedded/bin/shards 
/Users/bcardiff/Downloads/crystal-ci-darwin-static-dev-1/embedded/bin/shards:
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0)
    /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)

The embedded/lib/libyaml-0.2.dylib and embedded/lib/libyaml.dylib files are gone. So 👍

hovsater commented 3 years ago

LGTM. As @bcardiff is saying, running otool -L on the binary does not list libyaml anymore. 👍