I get errors when trying to use the "precompileRcppNT2" function in the RcppNT2 package - rcpp

I wanted to see if the use of SIMD instructions might speed up some of the code that I have. I loaded the RcppNT2 package and they recommend using the "precompileRcppNT2()" function to speed up the compilation process. In doing that, I get the following errors and was wondering is there was something I was missing is trying to use the package:
R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
The following object is masked from package:base:
setwd
libraries: c:/R/r_libs-3.3.2 C:/R/R-3.3.2/library
library & Java environment set from C:\Users\jh52822\Documents\.RProfile
> library(devtools)
> library(Rcpp)
> library(RcppNT2)
> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RcppNT2_0.1.0 Rcpp_0.12.7 devtools_1.12.0
loaded via a namespace (and not attached):
[1] withr_1.0.2 memoise_1.0.0 digest_0.6.10
> precompileRcppNT2()
Pre-compiling 'RcppNT2.h'...
In file included from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/include/functions/j0.hpp:5:0,
from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/functions.hpp:5,
from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/bessel.hpp:5,
from c:/R/r_libs-3.3.2/RcppNT2/include/RcppNT2.h:15:
c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/functions/scalar/j0.hpp: In member function 'nt2::ext::impl_j0_<void(boost::dispatch::meta::scalar_<boost::dispatch::meta::double_<Origin> >), boost::dispatch::tag::cpu_>::result_type nt2::ext::impl_j0_<void(boost::dispatch::meta::scalar_<boost::dispatch::meta::double_<Origin> >), boost::dispatch::tag::cpu_>::operator()(const A0&) const':
c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/functions/scalar/j0.hpp:60:14: error: '::_j0' has not been declared
return ::_j0(a0);
^
In file included from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/include/functions/j1.hpp:5:0,
from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/functions.hpp:6,
from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/bessel.hpp:5,
from c:/R/r_libs-3.3.2/RcppNT2/include/RcppNT2.h:15:
c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/functions/scalar/j1.hpp: In member function 'nt2::ext::impl_j1_<void(boost::dispatch::meta::scalar_<boost::dispatch::meta::double_<Origin> >), boost::dispatch::tag::cpu_>::result_type nt2::ext::impl_j1_<void(boost::dispatch::meta::scalar_<boost::dispatch::meta::double_<Origin> >), boost::dispatch::tag::cpu_>::operator()(const A0&) const':
c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/functions/scalar/j1.hpp:74:14: error: '::_j1' has not been declared
return ::_j1(a0);
^
In file included from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/include/functions/jni.hpp:5:0,
from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/functions.hpp:7,
from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/bessel.hpp:5,
from c:/R/r_libs-3.3.2/RcppNT2/include/RcppNT2.h:15:
c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/functions/scalar/jni.hpp: In member function 'nt2::ext::impl_jni_<void(boost::dispatch::meta::scalar_<boost::dispatch::meta::integer_<T> >, boost::dispatch::meta::scalar_<boost::dispatch::meta::double_<A1> >), boost::dispatch::tag::cpu_>::result_type nt2::ext::impl_jni_<void(boost::dispatch::meta::scalar_<boost::dispatch::meta::integer_<T> >, boost::dispatch::meta::scalar_<boost::dispatch::meta::double_<A1> >), boost::dispatch::tag::cpu_>::operator()(const A0&, const A1&) const':
c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/functions/scalar/jni.hpp:63:14: error: '::_jn' has not been declared
return ::_jn(a0, a1);
^
In file included from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/include/functions/y0.hpp:5:0,
from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/functions.hpp:8,
from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/bessel.hpp:5,
from c:/R/r_libs-3.3.2/RcppNT2/include/RcppNT2.h:15:
c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/functions/scalar/y0.hpp: In member function 'nt2::ext::impl_y0_<void(boost::dispatch::meta::scalar_<boost::dispatch::meta::double_<Origin> >), boost::dispatch::tag::cpu_>::result_type nt2::ext::impl_y0_<void(boost::dispatch::meta::scalar_<boost::dispatch::meta::double_<Origin> >), boost::dispatch::tag::cpu_>::operator()(const A0&) const':
c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/functions/scalar/y0.hpp:69:14: error: '::_y0' has not been declared
return ::_y0(a0);
^
In file included from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/include/functions/yni.hpp:5:0,
from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/functions.hpp:10,
from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/bessel.hpp:5,
from c:/R/r_libs-3.3.2/RcppNT2/include/RcppNT2.h:15:
c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/functions/scalar/yni.hpp: In member function 'nt2::ext::impl_yni_<void(boost::dispatch::meta::scalar_<boost::dispatch::meta::integer_<T> >, boost::dispatch::meta::scalar_<boost::dispatch::meta::double_<A1> >), boost::dispatch::tag::cpu_>::result_type nt2::ext::impl_yni_<void(boost::dispatch::meta::scalar_<boost::dispatch::meta::integer_<T> >, boost::dispatch::meta::scalar_<boost::dispatch::meta::double_<A1> >), boost::dispatch::tag::cpu_>::operator()(const A0&, const A1&) const':
c:/R/r_libs-3.3.2/RcppNT2/include/nt2/bessel/functions/scalar/yni.hpp:69:14: error: '::_yn' has not been declared
return ::_yn(a0, a1);
^
In file included from c:/R/r_libs-3.3.2/RcppNT2/include/boost/simd/ieee/include/functions/scalar/nextafter.hpp:5:0,
from c:/R/r_libs-3.3.2/RcppNT2/include/boost/simd/include/functions/scalar/nextafter.hpp:4,
from c:/R/r_libs-3.3.2/RcppNT2/include/boost/simd/ieee/functions/scalar/next.hpp:15,
from c:/R/r_libs-3.3.2/RcppNT2/include/boost/simd/ieee/include/functions/next.hpp:5,
from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/ieee/functions/next.hpp:12,
from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/ieee/include/functions/next.hpp:4,
from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/ieee/functions.hpp:27,
from c:/R/r_libs-3.3.2/RcppNT2/include/nt2/ieee/ieee.hpp:5,
from c:/R/r_libs-3.3.2/RcppNT2/include/RcppNT2.h:26:
c:/R/r_libs-3.3.2/RcppNT2/include/boost/simd/ieee/functions/scalar/nextafter.hpp: In member function 'boost::simd::ext::impl_nextafter_<void(boost::dispatch::meta::scalar_<boost::dispatch::meta::double_<Origin> >, boost::dispatch::meta::scalar_<boost::dispatch::meta::double_<Origin> >), boost::dispatch::tag::cpu_>::result_type boost::simd::ext::impl_nextafter_<void(boost::dispatch::meta::scalar_<boost::dispatch::meta::double_<Origin> >, boost::dispatch::meta::scalar_<boost::dispatch::meta::double_<Origin> >), boost::dispatch::tag::cpu_>::operator()(const A0&, const A0&) const':
c:/R/r_libs-3.3.2/RcppNT2/include/boost/simd/ieee/functions/scalar/nextafter.hpp:73:14: error: '::_nextafter' has not been declared
return ::_nextafter(a0, a1);
^
Error: Failed to compile 'RcppNT2.h'
In addition: Warning message:
running command 'c:/Rtools/mingw_64/bin/g++ -x c++-header c:/R/r_libs-3.3.2/RcppNT2/include/RcppNT2.h -Ic:/R/r_libs-3.3.2/RcppNT2/include -I c:/R/r_libs-3.3.2/BH/include -IC:/R/R-3.3.2/include -std=c++11 -O2 -Wall -mtune=core2' had status 1
Any help or suggestions would be appreciated.

Looks your MinGW version does not support the raw bessel and nextafter function or the version of NT2 used by RCpp is not packing the math config header that should take care of this.
Not sure how RCpp is precompiled but it should be done so that on MinGW BOOST_SIMD_HAS_YN is defiend and BOOST_SIMD_HAS__YN is undefined.

Related

How can I change the CONFIG_ARCH_OPTIONAL_KERNEL_RWX value? by changing arch/Kconfig file directly?

I had asked a quesion at kernelnewbies email list and later I thought I found the answer (I thought I can put it in my defconfig). But then later found it was my mistake. So I still have the question and I ask it here to get answer.
This is what I see when I search “KERNEL_RWX” during “make menuconfig” for arm64 kernel(5-10.0-rc5).
The Kconfig file says CONFIG_STRICT_KERNEL_RWX is for setting text and rodata read-only.
Symbol: ARCH_OPTIONAL_KERNEL_RWX [=n]
Type : bool
Defined at arch/Kconfig:928
Symbol: ARCH_OPTIONAL_KERNEL_RWX_DEFAULT [=n]
Type : bool
Defined at arch/Kconfig:931
Symbol: STRICT_KERNEL_RWX [=y]
Type : bool
Defined at arch/Kconfig:937
Prompt: Make kernel text and rodata read-only
Depends on: ARCH_HAS_STRICT_KERNEL_RWX [=y]
Visible if: ARCH_HAS_STRICT_KERNEL_RWX [=y] && ARCH_OPTIONAL_KERNEL_RWX [=n]
Location:
(1) -> General architecture-dependent options
I wanted to try setting STRICT_KERNEL_RWX to =n. The 'Visible if' descriptionn says this option is visible when ARCH_OPTIONAL_KERNEL_RWX is =y which is now =n. (The STRICT_KERNEL_RWX menu didn't appear as a configurable menu in the menuconfig at this time). This is the lines in arch/Kconfig.
config ARCH_OPTIONAL_KERNEL_RWX
def_bool n
So I modified to ARCH_OPTIONAL_KERNEL_RWX=y in arch/Kconfig line 928. (BTW, This is question : is it correct to modify this Kconfig file directly? I’m not sure at the moment)
Then I could see the STRICT_KERNEL_RWX menu in the menuconfig and I set it to =n as I wanted.
But when I build the kernel, I see this errors.
ckim#ckim-ubuntu:~/ProjX/LinuxDevDrv/kernel-release-RD-INFRA-2020.11.30$ makeit
CALL scripts/atomic/check-atomics.sh
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
CC arch/arm64/mm/mmu.o
arch/arm64/mm/mmu.c: In function 'parse_rodata':
arch/arm64/mm/mmu.c:595:28: error: 'rodata_enabled' undeclared (first use in this function)
595 | int ret = strtobool(arg, &rodata_enabled);
| ^~~~~~~~~~~~~~
arch/arm64/mm/mmu.c:595:28: note: each undeclared identifier is reported only once for each function it appears in
arch/arm64/mm/mmu.c: In function 'map_entry_trampoline':
arch/arm64/mm/mmu.c:614:18: error: 'rodata_enabled' undeclared (first use in this function)
614 | pgprot_t prot = rodata_enabled ? PAGE_KERNEL_ROX : PAGE_KERNEL_EXEC;
| ^~~~~~~~~~~~~~
arch/arm64/mm/mmu.c: In function 'map_kernel':
arch/arm64/mm/mmu.c:669:23: error: 'rodata_enabled' undeclared (first use in this function)
669 | pgprot_t text_prot = rodata_enabled ? PAGE_KERNEL_ROX : PAGE_KERNEL_EXEC;
| ^~~~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:283: arch/arm64/mm/mmu.o] Error 1
make[1]: *** [scripts/Makefile.build:500: arch/arm64/mm] Error 2
make: *** [Makefile:1799: arch/arm64] Error 2
variable “rodata_enabled” is defined in init/main.c as below.
#if defined(CONFIG_STRICT_KERNEL_RWX) || defined(CONFIG_STRICT_MODULE_RWX)
bool rodata_enabled __ro_after_init = true;
static int __init set_debug_rodata(char *str)
{
return strtobool(str, &rodata_enabled);
}
__setup("rodata=", set_debug_rodata);
#endif
But now that CONFIG_STRICT_KERNEL_RWX=n, the above lines are not compiled here (CONFIG_STRICT_MODULE_RWX=n too). However, arch/arm64/mm/mmu.c code is still using rodata_enabled. Is this a bug of the code? Or am I missing something?
I can modify init/main.c and include/linux/init.h so that this rodata_enabled and related functions be defined regardless of these CONFIG values and make the errors go away, but I’m curious if this a kind of kernel bug raising compiler error.
So again my question is how should I change ARCH_OPTIONAL_KERNEL_RWX value? I tried setting it in my defconfig file but when I do make xxx_defonfig, the .config file shows still ARCH_OPTIONAL_KERNEL_RWX=n. Should I edit the arch/Kconfig file really?

How to deal with crates exporting symbols with identical names

I'd like to use both just-argon2 and sodiumoxide which are bindings to Argon2 and libsodium respectively. The first I will use for password hashing, the second for encryption and more.
However, because libsodium itself also includes the Argon2 code, I get the following linker error when building:
error: linking with `link.exe` failed: exit code: 1169
|
= note: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Preview\\VC\\Tools\\MSVC\\14.29.30132\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "/NXCOMPAT" "/LIBPATH:<omitted>\\rust-ms\\tools\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "<omitted>\\target\\debug\\deps\\sw_password_vault.sw_password_vault.cvsxie8m-cgu.0.rcgu.o" "<omitted>\\target\\debug\\deps\\sw_password_vault.sw_password_vault.cvsxie8m-cgu.1.rcgu.o" "<omitted>\\target\\debug\\deps\\sw_password_vault.sw_password_vault.cvsxie8m-cgu.10.rcgu.o" "<omitted>\\target\\debug\\deps\\sw_password_vault.sw_password_vault.cvsxie8m-cgu.11.rcgu.o" "<omitted>\\target\\debug\\deps\\sw_password_vault.sw_password_vault.cvsxie8m-cgu.12.rcgu.o" "<omitted>\\target\\debug\\deps\\sw_password_vault.sw_password_vault.cvsxie8m-cgu.13.rcgu.o" "<omitted>\\target\\debug\\deps\\sw_password_vault.sw_password_vault.cvsxie8m-cgu.14.rcgu.o" "<omitted>\\target\\debug\\deps\\sw_password_vault.sw_password_vault.cvsxie8m-cgu.15.rcgu.o" "<omitted>\\target\\debug\\deps\\sw_password_vault.sw_password_vault.cvsxie8m-cgu.2.rcgu.o" "<omitted>\\target\\debug\\deps\\sw_password_vault.sw_password_vault.cvsxie8m-cgu.3.rcgu.o" "<omitted>\\target\\debug\\deps\\sw_password_vault.sw_password_vault.cvsxie8m-cgu.4.rcgu.o" "<omitted>\\target\\debug\\deps\\sw_password_vault.sw_password_vault.cvsxie8m-cgu.5.rcgu.o" "<omitted>\\target\\debug\\deps\\sw_password_vault.sw_password_vault.cvsxie8m-cgu.6.rcgu.o" "<omitted>\\target\\debug\\deps\\sw_password_vault.sw_password_vault.cvsxie8m-cgu.7.rcgu.o" "<omitted>\\target\\debug\\deps\\sw_password_vault.sw_password_vault.cvsxie8m-cgu.8.rcgu.o" "<omitted>\\target\\debug\\deps\\sw_password_vault.sw_password_vault.cvsxie8m-cgu.9.rcgu.o" "/OUT:<omitted>\\target\\debug\\deps\\sw_password_vault.exe" "<omitted>\\target\\debug\\deps\\sw_password_vault.2501tt6qpnxmq6dq.rcgu.o" "/OPT:REF,NOICF" "/DEBUG" "/NATVIS:<omitted>\\rust-ms\\tools\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:<omitted>\\rust-ms\\tools\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:<omitted>\\rust-ms\\tools\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:<omitted>\\rust-ms\\tools\\lib\\rustlib\\etc\\libstd.natvis" "/LIBPATH:<omitted>\\target\\debug\\deps" "/LIBPATH:<omitted>\\target\\debug\\build\\just-argon2-fba8d38863f06c3e\\out" "/LIBPATH:C:\\Users\\Steven\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\libsodium-sys-0.2.7\\msvc/x64/Debug/v142/" "/LIBPATH:<omitted>\\rust-ms\\tools\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "<omitted>\\target\\debug\\deps\\libargon2-47416e342f12fc80.rlib" "<omitted>\\target\\debug\\deps\\libbitflags-033856bffcb41e1a.rlib" "<omitted>\\target\\debug\\deps\\libsodiumoxide-ae3f70995957a7e5.rlib" "<omitted>\\target\\debug\\deps\\libserde-02c238cdfdb411bb.rlib" "<omitted>\\target\\debug\\deps\\libed25519-a72dcd735d2405a2.rlib" "<omitted>\\target\\debug\\deps\\libsignature-cb8ca284112f3bdb.rlib" "<omitted>\\target\\debug\\deps\\liblibsodium_sys-90db65a5d41df800.rlib" "<omitted>\\target\\debug\\deps\\liblibc-db8e81727092f722.rlib" "<omitted>\\rust-ms\\tools\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-7d8f1d3120dc2b31.rlib" "<omitted>\\lib\\libpanic_unwind-00b4871c13b6f72d.rlib" "<omitted>\\lib\\libstd_detect-38300272c9518b1b.rlib" "<omitted>\\lib\\librustc_demangle-008ea074760d3d54.rlib" "<omitted>\\lib\\libhashbrown-5d102da67e495133.rlib" "<omitted>\\lib\\librustc_std_workspace_alloc-108ed3dcf248b873.rlib" "<omitted>\\lib\\libunwind-bc9246c93f49e49a.rlib" "<omitted>\\lib\\libcfg_if-7ca234fdcd728c26.rlib" "<omitted>\\lib\\liblibc-e328514fb4ed0383.rlib" "<omitted>\\lib\\liballoc-5d0a4c6a1ffa6373.rlib" "<omitted>\\lib\\librustc_std_workspace_core-d379e9227cab087f.rlib" "<omitted>\\lib\\libcore-825774e96423c2c5.rlib" "<omitted>\\lib\\libcompiler_builtins-d5d1908505fa83bc.rlib" "advapi32.lib" "ws2_32.lib" "userenv.lib" "msvcrt.lib"
= note: liblibsodium_sys-90db65a5d41df800.rlib(blake2b-ref.obj) : error LNK2005: blake2b_init already defined in libargon2-47416e342f12fc80.rlib(blake2b.o)
liblibsodium_sys-90db65a5d41df800.rlib(blake2b-ref.obj) : error LNK2005: blake2b_init_key already defined in libargon2-47416e342f12fc80.rlib(blake2b.o)
liblibsodium_sys-90db65a5d41df800.rlib(blake2b-ref.obj) : error LNK2005: blake2b_init_param already defined in libargon2-47416e342f12fc80.rlib(blake2b.o)
liblibsodium_sys-90db65a5d41df800.rlib(blake2b-ref.obj) : error LNK2005: blake2b_update already defined in libargon2-47416e342f12fc80.rlib(blake2b.o)
liblibsodium_sys-90db65a5d41df800.rlib(blake2b-ref.obj) : error LNK2005: blake2b_final already defined in libargon2-47416e342f12fc80.rlib(blake2b.o)
liblibsodium_sys-90db65a5d41df800.rlib(blake2b-ref.obj) : error LNK2005: blake2b already defined in libargon2-47416e342f12fc80.rlib(blake2b.o)
Creating library C:\dev\Rust\SWPasswordVault\target\debug\deps\sw_password_vault.lib and object C:\dev\Rust\SWPasswordVault\target\debug\deps\sw_password_vault.exp
LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
C:\dev\Rust\SWPasswordVault\target\debug\deps\sw_password_vault.exe : fatal error LNK1169: one or more multiply defined symbols found
Both libraries export the same blake2b_* symbols, which are used by the Argon2 implementations, so the names clash.
Now you may be wondering: why not just use the libsodium pwhash API, which uses Argon2 internally (hence the linker error)? Because I want to use parallel Argon2, which is not exposed by libsodium, as it hardcodes the degree of parallelism to 1.
Apparently, the blake2b_* symbols are marked as ARGON2_LOCAL, so they are not exported, but I guess that this does not matter since they still exist for the linker.
One solution could be to use a pure Rust implementation of Argon2 such as rust-argon2, but I tested that one and unfortunately it is a lot slower.
How can I still use both libraries together? Do I have to make a separate library crate using just just-argon2 and export the functions provided by the just-argon2 crate or something like that, or would that not work / is there a better way? EDIT: this does not work.
Minimum non-compiling program:
use sodiumoxide;
use argon2;
fn main() { sodiumoxide::init(); }
While composing this program I noticed that when I swap the use statements it compiles fine, but it crashes at runtime:
use argon2;
use sodiumoxide;
fn main() {
sodiumoxide::init().expect("Could not init libsodium");
let password = "pass";
let salt = sodiumoxide::crypto::pwhash::gen_salt().0;
let mut key_bytes = [0u8; 32];
// INSECURE cost parameters
argon2::id_hash_raw(1, 1 << 10 /*1 MiB*/, 1,
Some(password.as_bytes()), Some(&salt), &mut key_bytes)
.unwrap_or_else(|err| panic!("Error hashing: {:?}", err));
}
This crashes with a STATUS_STACK_BUFFER_OVERRUN Windows exception (__fastfail(FAST_FAIL_STACK_COOKIE_CHECK_FAILURE)), while it works fine when not using any sodiumoxide functions (and an all-zero salt, for example). Apparently the different exports clash or something?
By the way: I'm very new to Rust so it's safe to say I don't know all the ins and outs of it.

How do I fix this libgcrypt cross-compilation error?

I'm trying to cross compile GPG for an ElinOS on a board with an imx6. I have a problem when I compile libgcrypt. First, here's what I do:
export PATH=/opt/elinos/cdk/arm/v7hf/glibc/bin:$PATH
./configure --host=arm-unknown-linux-gnueabihf --build=i686-pc-linux-gnu
make all
The configuration part shows no errors or warning, but the make displays this:
hwf-arm.c:31:3: error: #error Module build for wrong CPU.
# error Module build for wrong CPU.
^
hwf-arm.c: In function 'get_hwcap':
hwf-arm.c:126:26: error: 'AT_HWCAP' undeclared (first use in this function)
if (auxv.a_type == AT_HWCAP)
^
hwf-arm.c:126:26: note: each undeclared identifier is reported only once for each function it appears in
hwf-arm.c:132:26: error: 'AT_HWCAP2' undeclared (first use in this function)
if (auxv.a_type == AT_HWCAP2)
^
In file included from hwf-arm.c:27:0:
hwf-arm.c: In function 'detect_arm_at_hwcap':
hwf-arm.c:159:23: error: 'arm_features' undeclared (first use in this function)
for (i = 0; i < DIM(arm_features); i++)
^
g10lib.h:96:24: note: in definition of macro 'DIM'
#define DIM(v) (sizeof(v)/sizeof((v)[0]))
^
hwf-arm.c: In function 'detect_arm_proc_cpuinfo':
hwf-arm.c:250:23: error: 'arm_features' undeclared (first use in this function)
for (i = 0; i < DIM(arm_features); i++)
^
g10lib.h:96:24: note: in definition of macro 'DIM'
#define DIM(v) (sizeof(v)/sizeof((v)[0]))
The first error leads me to this part of the code :
#if !defined (__arm__) && !defined (__aarch64__)
# error Module build for wrong CPU.
#endif
Any idea where this comes from? It looks like a configuration problem, but I'm not sure where to look now.
In the config.log file, CC was setup correctly: CC='arm-unknown-linux-gnueabihf-gcc'.
Yet I needed to specify it in the make command. So instead of simply using make all, which didn't work, I had to use make all CC=arm-unknown-linux-gnueabihf-gcc.

nim linker error while linking to libsodium

I'm on windows 7 (64bit).
My nim version is:Nim Compiler Version 0.12.0 (2015-12-15) [Windows: i386]
I tried to build libsodium (https://github.com/jedisct1/libsodium) with this nim wrapper (https://github.com/judofyr/sodium.nim)
I've compiled libsodium with VS2013 -> Release Win32
I see the libsodium.lib
i've placed the nim wrapper next to it.
So it looks like this:
\libsodium-1.0.2\Build\Release\Win32\nimwrapper.nim
\libsodium-1.0.2\Build\Release\Win32\libsodium.lib
now i tried to compile the wrapper with
nim c nimwrapper.nim
now i see the following error message:
C:\Users\hello\Downloads\libsodium-1.0.2\Build\Release\Win32>nim c nimwrapper.nim
Hint: system [Processing]
Hint: nimwrapper [Processing]
Hint: strutils [Processing]
Hint: parseutils [Processing]
CC: nimwrapper
c:\users\hello\downloads\libsodium-1.0.2\build\release\win32\nimcache\nimwrapper.c: In function 'nimwrapperInit000':
c:\users\hello\downloads\libsodium-1.0.2\build\release\win32\nimcache\nimwrapper.c:449:2: error: incompatible type for argument 1 of 'HEX24_108328'
LOC2 = HEX24_108328(sig_108406);
^
In file included from c:\users\hello\downloads\libsodium-1.0.2\build\release\win32\nimcache\nimwrapper.c:9:0:
c:\users\hello\downloads\libsodium-1.0.2\build\release\win32\nimcache\nimwrapper.c:330:27: note: expected 'struct Signature108092 *' but argument is of type '
Signature108092'
N_NIMCALL(NimStringDesc*, HEX24_108328)(Signature108092* sig) {
^
C:\Nim\lib/nimbase.h:168:57: note: in definition of macro 'N_NIMCALL'
# define N_NIMCALL(rettype, name) rettype __fastcall name
^
Hint: [Link]
gcc.exe: error: c:\users\hello\downloads\libsodium-1.0.2\build\release\win32\nimcache\nimwrapper.o: No such file or directory
Error: execution of an external program failed: 'gcc.exe -o c:\users\hello\downloads\libsodium-1.0.2\build\release\win32\nimwrapper.exe c:\users\hello\do
wnloads\libsodium-1.0.2\build\release\win32\nimcache\stdlib_parseutils.o c:\users\hello\downloads\libsodium-1.0.2\build\release\win32\nimcache\stdlib_strutils
.o c:\users\hello\downloads\libsodium-1.0.2\build\release\win32\nimcache\stdlib_system.o c:\users\hello\downloads\libsodium-1.0.2\build\release\win32\nimcac
he\nimwrapper.o -lsodium '
C:\Users\hello\Downloads\libsodium-1.0.2\Build\Release\Win32>
Any idea?
I get the same error on Linux, submitted it as a bug: https://github.com/nim-lang/Nim/issues/3962

node-gyp fedora 21 build node-libtorrent won t work

I'm running fedora 21 OS, with enabled "Development tools and creative suite" module.
Linux maboiteaspam 3.17.8-300.fc21.x86_64 #1 SMP Thu Jan 8 23:32:49 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
I've specifically installed rb_libtorrent-devel via yum
Paquets installés
Nom : rb_libtorrent-devel
Architecture : x86_64
Version : 1.0.2
Révision : 1.fc21
Taille : 3.8 M
Dépôt : installed
Depuis le dépôt : fedora
Résumé : Development files for rb_libtorrent
URL : http://www.rasterbar.com/products/libtorrent/
Licence : BSD and zlib and Boost
Description : The rb_libtorrent-devel package contains libraries and header files for
: developing applications that use rb_libtorrent.
:
: The various source and header files included in this package are licensed
: under the revised BSD, zlib/libpng, and Boost Public licenses. See the various
: COPYING files in the included documentation for the full text of these
: licenses, as well as the comments blocks in the source code for which license
: a given source or header file is released under.
I'm running node and node-gyp,
maboiteaspam [14:07:20] ~ node -v
v0.10.35
maboiteaspam [14:07:23] ~ node-gyp -v
v1.0.2
When i try to install node-libtorrent, which can be found here https://github.com/fanatid/node-libtorrent,
npm i fanatid/node-libtorrent
I'm facing error messages like:
make: Entering directory '/home/maboiteaspam/Bureau/the-public-network/node_modules/node-libtorrent/build'
CXX(target) Release/obj.target/libtorrent/src/module.o
CXX(target) Release/obj.target/libtorrent/src/add_torrent_params.o
../src/add_torrent_params.cpp: In function ‘libtorrent::add_torrent_params nodelt::add_torrent_params_from_object(v8::Local<v8::Object>)’:
../src/add_torrent_params.cpp:48:21: erreur: no match for ‘operator=’ (operand types are ‘std::vector<char>’ and ‘std::vector<char>*’)
p.resume_data =& rd;
^
../src/add_torrent_params.cpp:48:21: note: candidate is:
In file included from /usr/include/c++/4.9.2/vector:69:0,
from /usr/include/libtorrent/add_torrent_params.hpp:37,
from ../src/add_torrent_params.cpp:4:
/usr/include/c++/4.9.2/bits/vector.tcc:167:5: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = char; _Alloc = std::allocator<char>]
vector<_Tp, _Alloc>::
^
/usr/include/c++/4.9.2/bits/vector.tcc:167:5: note: no known conversion for argument 1 from ‘std::vector<char>*’ to ‘const std::vector<char>&’
../src/add_torrent_params.cpp:57:25: erreur: no match for ‘operator=’ (operand types are ‘std::vector<unsigned char>’ and ‘std::vector<unsigned char>*’)
p.file_priorities =& fp;
^
../src/add_torrent_params.cpp:57:25: note: candidate is:
In file included from /usr/include/c++/4.9.2/vector:69:0,
from /usr/include/libtorrent/add_torrent_params.hpp:37,
from ../src/add_torrent_params.cpp:4:
/usr/include/c++/4.9.2/bits/vector.tcc:167:5: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = unsigned char; _Alloc = std::allocator<unsigned char>]
vector<_Tp, _Alloc>::
^
/usr/include/c++/4.9.2/bits/vector.tcc:167:5: note: no known conversion for argument 1 from ‘std::vector<unsigned char>*’ to ‘const std::vector<unsigned char>&’
libtorrent.target.mk:100: recipe for target 'Release/obj.target/libtorrent/src/add_torrent_params.o' failed
make: *** [Release/obj.target/libtorrent/src/add_torrent_params.o] Error 1
make: Leaving directory '/home/maboiteaspam/Bureau/the-public-network/node_modules/node-libtorrent/build'
How can I overcome those problems and use rb libtorrent via the node bindings ?

Resources