10XGenomics/lz4-rs

lz4-sys failing build in Windows

Closed this issue · 2 comments

Hi, I've been using lz4-rs for a cross-platform project. The project runs fine on Linux. I'm on my way to make it compatible for Windows.

Compiling lz4-sys crate fails on Windows(x86_64-pc-windows-gnu) with the following message:

C:\path\to\project>cargo build
   Compiling lz4-sys v1.9.2
error: failed to run custom build command for `lz4-sys v1.9.2`

Caused by:
  process didn't exit successfully: `C:\path\to\project\target\debug\build\lz4-sys-eda498a4f8e49e77\build-script-build` (exit code: 1)
--- stdout
TARGET = Some("x86_64-pc-windows-gnu")
HOST = Some("x86_64-pc-windows-gnu")
CC_x86_64-pc-windows-gnu = None
CC_x86_64_pc_windows_gnu = None
HOST_CC = None
CC = None
CFLAGS_x86_64-pc-windows-gnu = None
CFLAGS_x86_64_pc_windows_gnu = None
HOST_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
running: "gcc.exe" "-O3" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-o" "C:\\path\\to\\project\\target\\debug\\build\\lz4-sys-74730fdcc35cca62\\out\\liblz4/lib/lz4.o" "-c" "liblz4/lib/lz4.c"
exit code: 0
running: "gcc.exe" "-O3" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-o" "C:\\path\\to\\project\\target\\debug\\build\\lz4-sys-74730fdcc35cca62\\out\\liblz4/lib/lz4frame.o" "-c" "liblz4/lib/lz4frame.c"
cargo:warning=during RTL pass: final
cargo:warning=liblz4/lib/lz4frame.c: In function 'LZ4F_compressBlockHC_continue':
cargo:warning=liblz4/lib/lz4frame.c:795:1: internal compiler error: in based_loc_descr, at dwarf2out.c:14264
cargo:warning= }
cargo:warning= ^
cargo:warning=libbacktrace could not find executable to open
cargo:warning=Please submit a full bug report,
cargo:warning=with preprocessed source if appropriate.
cargo:warning=See <https://sourceforge.net/projects/mingw-w64> for instructions.
exit code: 1

--- stderr


error occurred: Command "gcc.exe" "-O3" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-o" "C:\\path\\to\\project\\target\\debug\\build\\lz4-sys-74730fdcc35cca62\\out\\liblz4/lib/lz4frame.o" "-c" "liblz4/lib/lz4frame.c" with args "gcc.exe" did not execute successfully (status code exit code: 1).



warning: build failed, waiting for other jobs to finish...
error: build failed

After this, I tried manually fetching the source for lz4-sys from this repo. Compiling it using gcc throws the same message.

C:\path\to\libs\lz4-sys>gcc -O3 -ffunction-sections -fdata-sections -g -fno-omit-frame-pointer -m64 -Wall -Wextra -o lz4frame.o -c lz4frame.c
during RTL pass: final
lz4frame.c: In function 'LZ4F_compressBlockHC_continue':
lz4frame.c:795:1: internal compiler error: in based_loc_descr, at dwarf2out.c:14264
 }
 ^
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://sourceforge.net/projects/mingw-w64> for instructions.

With verbose flag (if it helps):

C:\path\to\libs\lz4-sys>gcc -O3 -ffunction-sections -fdata-sections -g -fno-omit-frame-pointer -m64 -Wall -Wextra -o lz4frame.o -c lz4frame.c --verbose
Using built-in specs.
COLLECT_GCC=D:\Core\lib\mingw\tools\install\mingw64\bin\gcc.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-8.1.0/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64 --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-pkgversion='x86_64-posix-seh-rev0, Built by MinGW-W64 project' --with-bugurl=https://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS=' -I/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' LDFLAGS='-pipe -fno-ident -L/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64/opt/lib -L/c/mingw810/prerequisites/x86_64-zlib-static/lib -L/c/mingw810/prerequisites/x86_64-w64-mingw32-static/lib '
Thread model: posix
gcc version 8.1.0 (x86_64-posix-seh-rev0, Built by MinGW-W64 project)
COLLECT_GCC_OPTIONS='-O3' '-ffunction-sections' '-fdata-sections' '-g' '-fno-omit-frame-pointer' '-m64' '-Wall' '-Wextra' '-o' 'lz4frame.o' '-c' '-v' '-mtune=core2' '-march=nocona'
 D:/Core/lib/mingw/tools/install/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/cc1.exe -quiet -v -iprefix D:/Core/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/ -D_REENTRANT lz4frame.c -quiet -dumpbase lz4frame.c -m64 -mtune=core2 -march=nocona -auxbase-strip lz4frame.o -g -O3 -Wall -Wextra -version -ffunction-sections -fdata-sections -fno-omit-frame-pointer -o C:\Users\UTKARS~1\AppData\Local\Temp\cc3WERQo.s
GNU C17 (x86_64-posix-seh-rev0, Built by MinGW-W64 project) version 8.1.0 (x86_64-w64-mingw32)
        compiled by GNU C version 8.1.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.18-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "D:/Core/lib/mingw/tools/install/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.1.0/include"
ignoring nonexistent directory "C:/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../include"
ignoring duplicate directory "D:/Core/lib/mingw/tools/install/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed"
ignoring duplicate directory "D:/Core/lib/mingw/tools/install/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/include"
ignoring nonexistent directory "C:/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
 D:/Core/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include
 D:/Core/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed
 D:/Core/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/include
End of search list.
GNU C17 (x86_64-posix-seh-rev0, Built by MinGW-W64 project) version 8.1.0 (x86_64-w64-mingw32)
        compiled by GNU C version 8.1.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.18-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 985ce7ae6dd3a696cd146ca9896b0035
during RTL pass: final
lz4frame.c: In function 'LZ4F_compressBlockHC_continue':
lz4frame.c:795:1: internal compiler error: in based_loc_descr, at dwarf2out.c:14264
 }
 ^
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://sourceforge.net/projects/mingw-w64> for instructions.

Further searching for a way to make it work, I came across https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49878

Surprisingly removing -fno-omit-frame-pointer does help and the compilation is successful.

C:\path\to\libs\lz4-sys>gcc -O3 -ffunction-sections -fdata-sections -g -m64 -Wall -Wextra -o lz4frame.o -c lz4frame.c --verbose
Using built-in specs.
COLLECT_GCC=D:\Core\lib\mingw\tools\install\mingw64\bin\gcc.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-8.1.0/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64 --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-pkgversion='x86_64-posix-seh-rev0, Built by MinGW-W64 project' --with-bugurl=https://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS=' -I/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' LDFLAGS='-pipe -fno-ident -L/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64/opt/lib -L/c/mingw810/prerequisites/x86_64-zlib-static/lib -L/c/mingw810/prerequisites/x86_64-w64-mingw32-static/lib '
Thread model: posix
gcc version 8.1.0 (x86_64-posix-seh-rev0, Built by MinGW-W64 project)
COLLECT_GCC_OPTIONS='-O3' '-ffunction-sections' '-fdata-sections' '-g' '-m64' '-Wall' '-Wextra' '-o' 'lz4frame.o' '-c' '-v' '-mtune=core2' '-march=nocona'
 D:/Core/lib/mingw/tools/install/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/cc1.exe -quiet -v -iprefix D:/Core/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/ -D_REENTRANT lz4frame.c -quiet -dumpbase lz4frame.c -m64 -mtune=core2 -march=nocona -auxbase-strip lz4frame.o -g -O3 -Wall -Wextra -version -ffunction-sections -fdata-sections -o C:\Users\UTKARS~1\AppData\Local\Temp\ccOaxb3O.s
GNU C17 (x86_64-posix-seh-rev0, Built by MinGW-W64 project) version 8.1.0 (x86_64-w64-mingw32)
        compiled by GNU C version 8.1.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.18-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "D:/Core/lib/mingw/tools/install/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.1.0/include"
ignoring nonexistent directory "C:/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../include"
ignoring duplicate directory "D:/Core/lib/mingw/tools/install/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed"
ignoring duplicate directory "D:/Core/lib/mingw/tools/install/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/include"
ignoring nonexistent directory "C:/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
 D:/Core/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include
 D:/Core/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed
 D:/Core/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/include
End of search list.
GNU C17 (x86_64-posix-seh-rev0, Built by MinGW-W64 project) version 8.1.0 (x86_64-w64-mingw32)
        compiled by GNU C version 8.1.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.18-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 985ce7ae6dd3a696cd146ca9896b0035
COLLECT_GCC_OPTIONS='-O3' '-ffunction-sections' '-fdata-sections' '-g' '-m64' '-Wall' '-Wextra' '-o' 'lz4frame.o' '-c' '-v' '-mtune=core2' '-march=nocona'
 D:/Core/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/as.exe -v --64 -o lz4frame.o C:\Users\UTKARS~1\AppData\Local\Temp\ccOaxb3O.s
GNU assembler version 2.30 (x86_64-w64-mingw32) using BFD version (GNU Binutils) 2.30
COMPILER_PATH=D:/Core/lib/mingw/tools/install/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/;D:/Core/lib/mingw/tools/install/mingw64/bin/../libexec/gcc/;D:/Core/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/
LIBRARY_PATH=D:/Core/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/;D:/Core/lib/mingw/tools/install/mingw64/bin/../lib/gcc/;D:/Core/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/;D:/Core/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../lib/;D:/Core/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/;D:/Core/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../
COLLECT_GCC_OPTIONS='-O3' '-ffunction-sections' '-fdata-sections' '-g' '-m64' '-Wall' '-Wextra' '-o' 'lz4frame.o' '-c' '-v' '-mtune=core2' '-march=nocona'

I can see lzframe.o in the directory.

Now I'm not that well-versed with this gcc-option and I'm not sure if this is a solution to the problem or if I've simply overlooked the issue here.

I'm hoping this is the right place to open an issue following the change in project maintainers.

Thanks and cheers.

Try a newer gcc version?

Try a newer gcc version?

Damn, that helped. I was using the official MinGW that ships with gcc 8.1.0. Manually replaced it with v10.2.0 from http://winlibs.com/.

Still shows:

The code execution cannot proceed because libzmq-v141-mt-4_3_2.dll was not found. Reinstalling the program may fix this problem.

Which I think is a different problem. Posting here for brevity's sake.

Thanks.