Skip to content

Fix gettext dynamic linkage breaking binary builds due to missing dylib #1076

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

Merged
merged 1 commit into from
Aug 15, 2020

Conversation

ychin
Copy link
Member

@ychin ychin commented Aug 15, 2020

Currently, all the external libraries MacVim links against are dynamically linked, but so far they are all system libraries or bundled in /usr/lib, so all users have them installed. When gettext dependency was added to the Travis build to add localization support, it relied on an installed libintl.dylib library, usually in /usr/local/lib. This means users who don't have it installed and open the distributed binary will see MacVim immediately crash due to a missing dylib.

Instead, statically link against libintl.a instead. This is tricky because clang stubbornly prefers dynamic libs over static ones if both exist and you use the "-l" argument. Instead, you have to pass full path to the static lib for it to link against it. Modify configure.ac to do so, but because of the full path requirement, it's hard to get AC_TRY_LINK to work with it, so just manually check for the library's existence and use that. Hacky but works.

Also, add a check to Travis CI build to make sure we didn't accidentally introduce third-party dynacmic linkage to the build.

  • Add a new test to use objdump to dump out the dependencies, and check that we don't have any external third-party linkage (basically any dynamic links other than the pre-installed /usr/lib). Have to also check for existence of objdump because xcode 7 / macOS 10.11 doesn't have it installed.
  • Split the beginning sanity checks to a separate fold group called "smoketest". Also, don't unset errexit until that part is done, so that we will immediately fail out of the job if the smoketest fails. Unsetting errexit is only useful in the later regular tests that could be a little flaky.

Fix #1073

Currently, all the external libraries MacVim links against are
dynamically linked, but so far they are all system libraries or bundled
in /usr/lib, so all users have them installed. When gettext dependency
was added to the Travis build to add localization support, it relied on
an installed libintl.dylib library, usually in /usr/local/lib. This
means users who don't have it installed and open the distributed binary
will see MacVim immediately crash due to a missing dylib.

Instead, statically link against libintl.a instead. This is tricky
because clang stubbornly prefers dynamic libs over static ones if both
exist and you use the "-l" argument. Instead, you have to pass full path
to the static lib for it to link against it. Modify configure.ac to do
so, but because of the full path requirement, it's hard to get
AC_TRY_LINK to work with it, so just manually check for the library's
existence and use that. Hacky but works.

Also, add a check to Travis CI build to make sure we didn't accidentally
introduce third-party dynacmic linkage to the build.
- Add a new test to use objdump to dump out the dependencies, and check
  that we don't have any external third-party linkage (basically any
  dynamic links other than the pre-installed /usr/lib). Have to also
  check for existence of objdump because xcode 7 / macOS 10.11 doesn't
  have it installed.
- Split the beginning sanity checks to a separate fold group called
  "smoketest". Also, don't unset errexit until that part is done, so
  that we will immediately fail out of the job if the smoketest fails.
  Unsetting errexit is only useful in the later regular tests that could
  be a little flaky.

Fix macvim-dev#1073
@ychin ychin merged commit d9b71eb into macvim-dev:master Aug 15, 2020
@ychin ychin deleted the fix-gettext-dynamic-linkage branch August 15, 2020 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MacVim stopped working after update to v. 8.2.1424 (gettext)
1 participant