-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
See #71, #72, #73. Our `xz` is picking up travis's `xz` installation and using its (incompatible) `liblzma` shared library. On the suggestion of @stuhood in pantsbuild/pants#5936, we statically link `xz` here to avoid ever having this problem ever again. Proof: *linux*: ``` > ldd ./xz-5.2.4-linux/xz-install/bin/xz linux-vdso.so.1 (0x00007ffc865cd000) libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f1fa385f000) libc.so.6 => /usr/lib/libc.so.6 (0x00007f1fa34a3000) /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f1fa3cb4000) ``` *osx*: ``` > otool -L ./xz-5.2.4-linux/xz-install/bin/xz ./xz-5.2.4-linux/xz-install/bin/xz: /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4) ```
- Loading branch information
1 parent
9c1ed1e
commit 59d7345
Showing
4 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/bin/bash | ||
|
||
source "$(git rev-parse --show-toplevel)/utils.v1.bash" | ||
|
||
set_strict_mode | ||
|
||
function package_xz { | ||
local -r installed_dir_abs="$1" | ||
|
||
with_pushd "$installed_dir_abs" \ | ||
create_gz_package 'xz' bin | ||
} | ||
|
||
function fetch_extract_xz_source_release { | ||
local -r archive_dirname="xz-${XZ_VERSION}" | ||
local -r archive_filename="${archive_dirname}.tar.gz" | ||
local -r release_url="https://tukaani.org/xz/${archive_filename}" | ||
|
||
local -r downloaded_archive="$(curl_file_with_fail "$release_url" "$archive_filename")" | ||
extract_for "$downloaded_archive" "$archive_dirname" | ||
} | ||
|
||
function build_xz { | ||
local -r install_dir_abs="$1" | ||
|
||
# We statically link the `xz` executable to avoid conflicts with any liblzma.so on the host | ||
# machine (see pantsbuild/pants#5639). | ||
./configure \ | ||
--enable-static --disable-shared \ | ||
--prefix="$install_dir_abs" | ||
|
||
make "-j${MAKE_JOBS}" | ||
|
||
make install | ||
} | ||
|
||
function fetch_build_xz { | ||
local -r install_dir_abs="$(mkdirp_absolute_path 'xz-install')" | ||
|
||
local -r xz_src_extracted_abs="$(fetch_extract_xz_source_release)" | ||
|
||
with_pushd >&2 "$xz_src_extracted_abs" \ | ||
build_xz "$install_dir_abs" | ||
|
||
package_xz "$install_dir_abs" | ||
} | ||
|
||
readonly TARGET_PLATFORM="$1" XZ_VERSION="$2" | ||
|
||
readonly MAKE_JOBS="${MAKE_JOBS:-2}" | ||
|
||
case "$TARGET_PLATFORM" in | ||
osx) | ||
with_pushd "$(mkdirp_absolute_path "xz-${XZ_VERSION}-osx")" \ | ||
fetch_build_xz | ||
;; | ||
linux) | ||
with_pushd "$(mkdirp_absolute_path "xz-${XZ_VERSION}-linux")" \ | ||
fetch_build_xz | ||
;; | ||
*) | ||
die "xz does not support building for '${TARGET_PLATFORM}'" | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
readonly result="$(./build-xz.sh linux 5.2.4)" | ||
|
||
cp "$result" ./xz.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/bin/bash | ||
|
||
source "$(git rev-parse --show-toplevel)/utils.v1.bash" | ||
|
||
set_strict_mode | ||
|
||
function package_xz { | ||
local -r installed_dir_abs="$1" | ||
|
||
with_pushd "$installed_dir_abs" \ | ||
create_gz_package 'xz' bin | ||
} | ||
|
||
function fetch_extract_xz_source_release { | ||
local -r archive_dirname="xz-${XZ_VERSION}" | ||
local -r archive_filename="${archive_dirname}.tar.gz" | ||
local -r release_url="https://tukaani.org/xz/${archive_filename}" | ||
|
||
local -r downloaded_archive="$(curl_file_with_fail "$release_url" "$archive_filename")" | ||
extract_for "$downloaded_archive" "$archive_dirname" | ||
} | ||
|
||
function build_xz { | ||
local -r install_dir_abs="$1" | ||
|
||
# We statically link the `xz` executable to avoid conflicts with any liblzma.so on the host | ||
# machine (see pantsbuild/pants#5639). | ||
./configure \ | ||
--enable-static --disable-shared \ | ||
--prefix="$install_dir_abs" | ||
|
||
make "-j${MAKE_JOBS}" | ||
|
||
make install | ||
} | ||
|
||
function fetch_build_xz { | ||
local -r install_dir_abs="$(mkdirp_absolute_path 'xz-install')" | ||
|
||
local -r xz_src_extracted_abs="$(fetch_extract_xz_source_release)" | ||
|
||
with_pushd >&2 "$xz_src_extracted_abs" \ | ||
build_xz "$install_dir_abs" | ||
|
||
package_xz "$install_dir_abs" | ||
} | ||
|
||
readonly TARGET_PLATFORM="$1" XZ_VERSION="$2" | ||
|
||
readonly MAKE_JOBS="${MAKE_JOBS:-2}" | ||
|
||
case "$TARGET_PLATFORM" in | ||
osx) | ||
with_pushd "$(mkdirp_absolute_path "xz-${XZ_VERSION}-osx")" \ | ||
fetch_build_xz | ||
;; | ||
linux) | ||
with_pushd "$(mkdirp_absolute_path "xz-${XZ_VERSION}-linux")" \ | ||
fetch_build_xz | ||
;; | ||
*) | ||
die "xz does not support building for '${TARGET_PLATFORM}'" | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
readonly result="$(./build-xz.sh linux 5.2.4)" | ||
|
||
cp "$result" ./xz.tar.gz |