Skip to content

Commit e05fdc3

Browse files
committed
Fix gettext dynamic linkage breaking binary builds due to missing dylib
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
1 parent 98523ad commit e05fdc3

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

.travis.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,13 @@ script:
6161
grep -q -- "-DDYNAMIC_RUBY_DLL=\\\\\"${vi_cv_dll_name_ruby}\\\\\"" src/auto/config.mk
6262
fi
6363
- echo -en "travis_fold:end:configure\\r\\033[0K"
64+
6465
- echo -e "\\033[33;1mBuilding MacVim\\033[0m" && echo -en "travis_fold:start:build\\r\\033[0K"
6566
- make -j${NPROC}
6667
- echo -en "travis_fold:end:build\\r\\033[0K"
67-
- set +o errexit
6868
- ${VIMCMD} --version
69-
- echo -e "\\033[33;1mTesting MacVim\\033[0m" && echo -en "travis_fold:start:test\\r\\033[0K"
69+
70+
- echo -e "\\033[33;1mSmoketest\\033[0m" && echo -en "travis_fold:start:smoketest\\r\\033[0K"
7071
# Smoketest scripting languages
7172
- |
7273
macvim_excmd() {
@@ -84,7 +85,20 @@ script:
8485
if [[ -n "${HAS_GETTEXT}" ]]; then
8586
${VIMCMD} -es -c 'lang es_ES' -c 'redir @a' -c 'version' -c 'put a' -c 'print' -c 'qa!' | grep Enlazado
8687
fi
87-
# Run standard test suites
88+
# Make sure there isn't any dynamic linkage to third-party dependencies in the built binary, as we should only use
89+
# static linkage to avoid dependency hell. First, sanity check that we have some dylib linkage to make sure objdump is
90+
# working properly, then test that all those dylib's are in /usr/lib which is bundled with macOS and not third-party.
91+
- |
92+
if (which objdump > /dev/null); then
93+
objdump -p ${VIMCMD} | grep -q dylib &&
94+
! (objdump -p ${VIMCMD} | grep dylib | grep -v "name /usr/lib/")
95+
fi
96+
- echo -en "travis_fold:end:smoketest\\r\\033[0K"
97+
98+
# Run standard test suites.
99+
# Disable errexit so flaky tests won't immediately exit to allow us to see all the errors.
100+
- set +o errexit
101+
- echo -e "\\033[33;1mTesting MacVim\\033[0m" && echo -en "travis_fold:start:test\\r\\033[0K"
88102
- make test
89103
- make -C runtime/doc vimtags VIMEXE=../../src/MacVim/build/Release/MacVim.app/Contents/bin/vim
90104
- echo -en "travis_fold:end:test\\r\\033[0K"

0 commit comments

Comments
 (0)