Windows compilation breaks on `jemalloc` integration
ErichDonGubler opened this issue · comments
To my surprise, this crate compiles with cargo build --no-default-features
on Windows 10! Woot, awk
on Windows! :D
Attempting to compile with the use_jemalloc
against x86_64-pc-windows-msvc
(the most common Windows target AFAIK), one gets a compile error of the form:
$ cargo check # `default` features enable `use_jemalloc`
<snip>
The following warnings were emitted during compilation:
warning: "jemalloc support for `x86_64-pc-windows-msvc` is untested"
error: failed to run custom build command for `tikv-jemalloc-sys v0.4.2+5.2.1-patched.2`
Caused by:
process didn't exit successfully: `<snip>\frawk\target\debug\build\tikv-jemalloc-sys-8070626b6b43d50a\build-script-build` (exit code: 101)
--- stdout
TARGET=x86_64-pc-windows-msvc
HOST=x86_64-pc-windows-msvc
NUM_JOBS=8
OUT_DIR="<snip>\\target\\debug\\build\\tikv-jemalloc-sys-1f5ef3a81eb3f627\\out"
BUILD_DIR="<snip>\\target\\debug\\build\\tikv-jemalloc-sys-1f5ef3a81eb3f627\\out\\build"
SRC_DIR="<snip>\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\tikv-jemalloc-sys-0.4.2+5.2.1-patched.2"
cargo:warning="jemalloc support for `x86_64-pc-windows-msvc` is untested"
cargo:rustc-cfg=prefixed
OPT_LEVEL = Some("0")
TARGET = Some("x86_64-pc-windows-msvc")
HOST = Some("x86_64-pc-windows-msvc")
CC_x86_64-pc-windows-msvc = None
CC_x86_64_pc_windows_msvc = None
HOST_CC = None
CC = None
CFLAGS_x86_64-pc-windows-msvc = None
CFLAGS_x86_64_pc_windows_msvc = None
HOST_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
CARGO_CFG_TARGET_FEATURE = Some("aes,avx,avx2,bmi1,bmi2,fma,fxsr,lzcnt,pclmulqdq,popcnt,rdrand,rdseed,sse,sse2,sse3,sse4.1,sse4.2,ssse3,xsave,xsavec,xsaveopt,xsaves")
DEBUG = Some("true")
CC="C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.12.25827\\bin\\HostX64\\x64\\cl.exe"
CFLAGS="-nologo -MD -Z7 -Brepro -W4"
JEMALLOC_REPO_DIR="jemalloc"
--with-jemalloc-prefix=_rjem_
running: "sh" "<snip>/frawk/target/debug/build/tikv-jemalloc-sys-1f5ef3a81eb3f627/out/build/configure" "--disable-cxx" "--with-jemalloc-prefix=_rjem_" "--with-private-namespace=_rjem_" "--host=x86_64-pc-win32" "--build=x86_64-pc-win32" "--prefix=<snip>\\frawk\\target\\debug\\build\\tikv-jemalloc-sys-1f5ef3a81eb3f627\\out"
checking for xsltproc... /usr/bin/xsltproc
checking for x86_64-pc-win32-gcc... C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\bin\HostX64\x64\cl.exe
checking whether the C compiler works... no
running: "tail" "-n" "100" "<snip>\\frawk\\target\\debug\\build\\tikv-jemalloc-sys-1f5ef3a81eb3f627\\out\\build\\config.log"
exe=''
exec_prefix='<snip>\frawk\target\debug\build\tikv-jemalloc-sys-1f5ef3a81eb3f627\out'
EXEEXT=''
EXTRA_CFLAGS=''
EXTRA_CXXFLAGS=''
EXTRA_LDFLAGS=''
GREP=''
HAVE_CXX14=''
host_alias='x86_64-pc-win32'
host_cpu=''
host_os=''
host_vendor=''
host='x86_64-pc-win32'
htmldir='${docdir}'
importlib=''
includedir='${prefix}/include'
INCLUDEDIR='<snip>frawktargetdebugbuildtikv-jemalloc-sys-1f5ef3a81eb3f627out/include'
infodir='${datarootdir}/info'
INSTALL_DATA=''
INSTALL_PROGRAM=''
INSTALL_SCRIPT=''
install_suffix=''
je_=''
JEMALLOC_CPREFIX=''
JEMALLOC_PREFIX=''
jemalloc_version_bugfix=''
jemalloc_version_gid=''
jemalloc_version_major=''
jemalloc_version_minor=''
jemalloc_version_nrev=''
jemalloc_version=''
LD_PRELOAD_VAR=''
LD=''
LDFLAGS='-nologo -MD -Z7 -Brepro -W4'
LDTARGET=''
libdir='${exec_prefix}/lib'
LIBDIR='<snip>frawktargetdebugbuildtikv-jemalloc-sys-1f5ef3a81eb3f627out/lib'
libdl=''
libexecdir='${exec_prefix}/libexec'
LIBOBJS=''
libprefix=''
LIBS=''
link_whole_archive=''
LM=''
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
LTLIBOBJS=''
mandir='${datarootdir}/man'
MANDIR='<snip>frawk\target\debug\build\tikv-jemalloc-sys-1f5ef3a81eb3f627\out/share/man'
MKLIB=''
NM=''
o=''
OBJEXT=''
objroot=''
oldincludedir='/usr/include'
PACKAGE_BUGREPORT=''
PACKAGE_NAME=''
PACKAGE_STRING=''
PACKAGE_TARNAME=''
PACKAGE_URL=''
PACKAGE_VERSION=''
PATH_SEPARATOR=':'
pdfdir='${docdir}'
PIC_CFLAGS=''
PREFIX='<snip>\frawk\target\debug\build\tikv-jemalloc-sys-1f5ef3a81eb3f627\out'
prefix='<snip>\frawk\target\debug\build\tikv-jemalloc-sys-1f5ef3a81eb3f627\out'
private_namespace=''
program_transform_name='s,x,x,'
psdir='${docdir}'
RANLIB=''
rev='2'
RPATH_EXTRA=''
RPATH=''
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
SHELL='/bin/sh'
so=''
SOREV=''
SPECIFIED_CFLAGS='-nologo -MD -Z7 -Brepro -W4'
SPECIFIED_CXXFLAGS=''
srcroot=''
sysconfdir='${prefix}/etc'
target_alias=''
TEST_LD_MODE=''
XSLROOT=''
XSLTPROC='/usr/bin/xsltproc'
## ----------- ##
## confdefs.h. ##
## ----------- ##
/* confdefs.h */
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
configure: exit 77
--- stderr
configure: error: in `<snip>/frawk/target/debug/build/tikv-jemalloc-sys-1f5ef3a81eb3f627/out/build':
configure: error: C compiler cannot create executables
See `config.log' for more details
thread 'main' panicked at 'command did not execute successfully: "sh" "<snip>/frawk/target/debug/build/tikv-jemalloc-sys-1f5ef3a81eb3f627/out/build/configure" "--disable-cxx" "--with-jemalloc-prefix=_rjem_" "--with-private-namespace=_rjem_" "--host=x86_64-pc-win32" "--build=x86_64-pc-win32" "--prefix=C:\\Users\\K0RYU\\workspace\\frawk\\target\\debug\\build\\tikv-jemalloc-sys-1f5ef3a81eb3f627\\out"
expected success, got: exit code: 77', C:\Users\K0RYU\.cargo\registry\src\github.com-1ecc6299db9ec823\tikv-jemalloc-sys-0.4.2+5.2.1-patched.2\build.rs:333:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed
Basically, jemalloc
isn't something we should expect to compile on Windows right now. I think this is unfortunate, given that it's currently impossible to define a feature that only is default
for a specific platform.
Thanks for this info! I pointed to your notes here in the README until I make more progress on this. I would also not be surprised if configuring LLVM (also removed with --no-default-features
) was different on Windows.
I'll keep this issue open for now as I should probably get around to testing frawk on Windows. The fact that it builds is a good sign that I may not have a ton to fix on this front.
As for having better defaults, I think the standard move here is to sidestep platform-specific configurations entirely by publishing pre-built binaries or packages on language package registries. Both of those are on the roadmap, but LLVM support remains a troublesome blocker on that front (see #53 #33)
The problem seems to be that sh
is not valid on Windows - I guess this should be reported to the tikv-jemalloc-sys
maintainer(s).