You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We at extendr/libR-sys are attempting to build a library for interop between R and rust.
When building for Windows, we have to link libclang coming from msys.
The build pipeline is complicated, but it runs successfully when targeting 64-bit, meaning libclang.dll from mingw64 works fine.
Unfortunately, the build fails when targeting 32-bit.
The failure is reproducible on a variety of machines (including GH Action).
The frustrating part is the problem arises when libclang.dll is linked, and the error message is "The specified procedure could not be found" (OS error 127). We do not invoke any methods from libclang at this point.
Using WinDbg we were able to find what appears to be the issue here: libclang loads a bunch of other libraries, but the loading process terminates after referencing zlib1 (see attached log).
The inclusion of zlib1 triggers an unhandled exception, which can be identified as the source of "The specified procedure could not be found" (at least this is our best guess).
Have latest version of R installed (32 bit is required, 64 bit is optional);
Have rust installed;
Have msys installed;
rust has to have pc-windows-gnu target installed:
a. rustup target add i686-pc-windows-gnu
rust should have default toolchain set to nightly-gnu:
a. rustup default nightly-gnu
msys2 should have the following packages:
a. mingw32/mingw-w64-i686-clang mingw-w64-i686-toolchain
The environment should have following variables configured (depending on how msys is installed):
a. PATH should include references to \msys\mingw32\bin, \msys\usr\bin
b. R_HOME should be set to the R path (e.g. C:\Program Files\R\R-4.0.3\)
c. LIBCLANG_PATH to msys\mingw32\bin
Navigate into project directory, run cargo build --target=i686-pc-windows-gnu;
Observe rust package pulling and compilation right until it hits libR-sys, where it fails with the mentioned above error (see bellow attached output of the compilation process).
Additional Context: Operating System, Screenshots
cargo build --target=i686-pc-windows-gnu
Compiling winapi-i686-pc-windows-gnu v0.4.0
Compiling winapi v0.3.9
Compiling memchr v2.3.4
Compiling cc v1.0.66
Compiling glob v0.3.0
Compiling libc v0.2.81
Compiling version_check v0.9.2
Compiling lazy_static v1.4.0
Compiling bitflags v1.2.1
Compiling log v0.4.11
Compiling proc-macro2 v1.0.24
Compiling quick-error v1.2.3
Compiling unicode-xid v0.2.1
Compiling unicode-width v0.1.8
Compiling regex-syntax v0.6.21
Compiling winapi-build v0.1.1
Compiling cfg-if v0.1.10
Compiling bindgen v0.53.3
Compiling vec_map v0.8.2
Compiling strsim v0.8.0
Compiling winapi v0.2.8
Compiling shlex v0.1.1
Compiling peeking_take_while v0.1.2
Compiling rustc-hash v1.1.0
Compiling lazycell v1.3.0
Compiling thread_local v1.0.1
Compiling nom v5.1.2
Compiling humantime v1.3.0
Compiling textwrap v0.11.0
Compiling clang-sys v0.29.3
Compiling kernel32-sys v0.2.2
Compiling which v3.1.1
Compiling aho-corasick v0.7.15
Compiling quote v1.0.7
Compiling libloading v0.5.2
Compiling regex v1.4.2
Compiling cexpr v0.4.0
Compiling winapi-util v0.1.5
Compiling atty v0.2.14
Compiling clap v2.33.3
Compiling termcolor v1.1.2
Compiling env_logger v0.7.1
Compiling libR-sys v0.1.10 (C:\Users\[redacted]\source\repos\libR-sys)
error: failed to run custom build command for `libR-sys v0.1.10 (C:\Users\[redacted]\source\repos\libR-sys)`
Caused by:
process didn't exit successfully: `C:\Users\[redacted]\source\repos\libR-sys\target\debug\build\libR-sys-d03d281092f3c42b\build-script-build` (exit code: 101)
--- stdout
cargo:rustc-env=R_HOME=C:\Program Files\R\R-4.0.3\
cargo:r_home=C:\Program Files\R\R-4.0.3\
cargo:rustc-link-search=C:\Program Files\R\R-4.0.3\bin\i386
cargo:rustc-link-lib=dylib=R
cargo:rerun-if-changed=build.rs
cargo:rerun-if-changed=wrapper.h
--- stderr
thread 'main' panicked at 'Unable to find libclang: "the `libclang` shared library at C:\\tools\\msys64\\mingw32\\bin\\libclang.dll could not be opened: The specified procedure could not be found. (os error 127)"', C:\Users\[redacted]\.cargo\registry\src\github.com-1285ae84e5963aae\bindgen-0.53.3\src/lib.rs:1956:31
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
If applicable, add screenshots to help explain your problem.
UPD01: Fixing incorrect error message used in the title/text
The text was updated successfully, but these errors were encountered:
Ilia-Kosenkov
changed the title
"Entry point not found" when linking to 32-bit version of libclang
"The specified procedure could not be found" when linking to 32-bit version of libclangDec 13, 2020
Describe the issue
We at
extendr/libR-sys
are attempting to build a library for interop betweenR
andrust
.When building for Windows, we have to link
libclang
coming frommsys
.The build pipeline is complicated, but it runs successfully when targeting
64-bit
, meaninglibclang.dll
frommingw64
works fine.Unfortunately, the build fails when targeting
32-bit
.The failure is reproducible on a variety of machines (including GH Action).
The frustrating part is the problem arises when
libclang.dll
is linked, and the error message is "The specified procedure could not be found" (OS error 127). We do not invoke any methods fromlibclang
at this point.Using
WinDbg
we were able to find what appears to be the issue here:libclang
loads a bunch of other libraries, but the loading process terminates after referencingzlib1
(see attached log).The inclusion of
zlib1
triggers an unhandled exception, which can be identified as the source of "The specified procedure could not be found" (at least this is our best guess).WinDbg log
Steps to Reproduce the Problem
R
installed (32 bit is required, 64 bit is optional);rust
installed;msys
installed;rust
has to havepc-windows-gnu
target installed:a.
rustup target add i686-pc-windows-gnu
rust
should have default toolchain set tonightly-gnu
:a.
rustup default nightly-gnu
msys2
should have the following packages:a.
mingw32/mingw-w64-i686-clang mingw-w64-i686-toolchain
msys
is installed):a.
PATH
should include references to\msys\mingw32\bin
,\msys\usr\bin
b.
R_HOME
should be set to theR
path (e.g.C:\Program Files\R\R-4.0.3\
)c.
LIBCLANG_PATH
tomsys\mingw32\bin
github.com/extendr/libR-sys
;cargo build --target=i686-pc-windows-gnu
;rust
package pulling and compilation right until it hitslibR-sys
, where it fails with the mentioned above error (see bellow attached output of the compilation process).Additional Context: Operating System, Screenshots
cargo build --target=i686-pc-windows-gnu
Windows 10 Pro x64 1909/18363.1198
msys2 20201109.0.0
installed from Chocolateyrustup 1.23.1 (3df2264a9 2020-11-30)
rustc 1.50.0-nightly (3d6705aa5 2020-12-07)
R 4.0.3
extednr/libR-sys/#9
UPD01: Fixing incorrect error message used in the title/text
The text was updated successfully, but these errors were encountered: