I have experienced the following problem during the process of building my package. I tried to search for a solution but was unsuccessful. In order to make the error reproducible, I present a minimal package that could generate the same error.
I started a package with the name mypkg, then I use usethis::use_rcpp and usethis::use_rcpp_armadillo. After that I add the following script in \src folder (which is copied from internet)
#include <RcppArmadillo.h>
// [[Rcpp::depends(RcppArmadillo)]]
// [[Rcpp::export]]
arma::vec getEigenValues(arma::mat M) {
return arma::eig_sym(M);
}
After that, I add an R shell to export the function using Roxygen. So far the package can be successfully documented and built.
Then I continue to add features of Rstan by using rstantools::use_rstan, and follow the steps on Step by step guide for creating a package that depends on RStan, and create lm.stan and lm_stan.R as instructed. Then I built the package again but it throws out an error. Here are the results of executing
.Last.error.trace
1. devtools:::document()
2. withr::with_envvar(r_env_vars(), roxygen2::roxygenise(pkg$path, ...
3. base:::force(code)
4. roxygen2::roxygenise(pkg$path, roclets, load_code = load_code)
5. roxygen2:::load_code(base_path)
6. pkgload::load_all(path, helpers = FALSE, attach_testthat = FALSE)
7. pkgbuild::compile_dll(path, quiet = quiet)
8. pkgbuild:::install_min(path, dest = install_dir, components = "libs", ...
9. pkgbuild:::rcmd_build_tools("INSTALL", c(path, paste("--library=", ...
10. pkgbuild:::with_build_tools(callr::rcmd_safe(..., env = env, ...
11. withr::with_path(rtools_path(), code)
12. base:::force(code)
13. callr::rcmd_safe(..., env = env, spinner = FALSE, show = FALSE, ...
14. callr:::run_r(options)
15. base:::with(options, with_envvar(env, do.call(processx::run, ...
16. base:::with.default(options, with_envvar(env, do.call(processx::run, ...
17. base:::eval(substitute(expr), data, enclos = parent.frame())
18. base:::eval(substitute(expr), data, enclos = parent.frame())
19. callr:::with_envvar(env, do.call(processx::run, c(list(bin, args = real_cmdargs, ...
20. base:::force(code)
21. base:::do.call(processx::run, c(list(bin, args = real_cmdargs, ...
22. (function (command = NULL, args = character(), error_on_status = TRUE, ...
23. throw(new_process_error(res, call = sys.call(), echo = echo, ...
x System command 'Rcmd.exe' failed, exit status: 1, stdout + stderr (last 10 lines):
E> In file included from C:/Users/Jasper/Documents/R/win-library/3.6/rstan/include/rstan/rstaninc.hpp:3:0,
E> from stanExports_lm.h:20,
E> from stanExports_lm.cc:5:
E> C:/Users/Jasper/Documents/R/win-library/3.6/rstan/include/rstan/stan_fit.hpp:11:28: fatal error: stan/version.hpp: No such file or directory
E> #include <stan/version.hpp>
E> ^
E> compilation terminated.
E> make: *** [C:/PROGRA~1/R/R-36~1.2/etc/x64/Makeconf:213: stanExports_lm.o] Error 1
E> ERROR: compilation failed for package 'mypkg'
E> * removing 'C:/Users/Jasper/AppData/Local/Temp/RtmpwXHySZ/devtools_install_1d18454066b0/mypkg'
Could anyone suggest what the problem is? Here is my makevars file
CXX_STD = CXX11
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
However, when I follow the steps of the guide to create a package just with Rstan, it could be successfully built, but not when I also want to use RcppArmadillo.
Thank you very much for your kind help!!
Related
I create an automate deployment script that will mint 2million SPL tokens to an address, the mint is owned by the program PDA as shown in Solana explorer:
Bellow is the last step in the deployment script:
export async function mint2e6Tokens(provider: anchor.AnchorProvider, tokenAccount: PublicKey, mint: PublicKey): Promise<void> {
// get the token account could be PDA
const programKeypair = await createKeypairFromFile(PROGRAM_KEYPAIR_PATH);
/** Load from PDA */
let mint_tokens_tx = new Transaction().add(
createMintToInstruction(
mint,
tokenAccount,
programKeypair.publicKey, // -> I DOUBLE CHECKED, THIS IS 6Z24B3qCrWfWvDo1f2HgxmnBSGhqQes1sHobqMtMxfbP
2e6,
[],
TOKEN_PROGRAM_ID
)
);
// We sign with our programId instead of the wallet because this is a PDA
// Program Derived Adress
await provider.sendAndConfirm(mint_tokens_tx, [programKeypair]);
}
When I run in LocalNet, it works:
Migrating to LocalNet...
RUNNING CUSTOM SCRIPT ====>>>
Payper: EsgJ9ihTEZskWyWpMMPuGVisy5ay76YWgetgTLb3jRmj
Using program 6Z24B3qCrWfWvDo1f2HgxmnBSGhqQes1sHobqMtMxfbP
Program: 6Z24B3qCrWfWvDo1f2HgxmnBSGhqQes1sHobqMtMxfbP
Mint: AVPgrT1y6ZfjGWPyLCWEPZdogRgmEMbrdRbcHNSfAPzF
Campaign: FcAmyEgZsXUKLB6hKufDmLuSBzMzVtPmRPm7vZLStK4U
31999500
However when I switch to DevNet, it always give me error
Migrating to DevNet...
RUNNING CUSTOM SCRIPT ====>>>
Payper: EsgJ9ihTEZskWyWpMMPuGVisy5ay76YWgetgTLb3jRmj
Using program 6Z24B3qCrWfWvDo1f2HgxmnBSGhqQes1sHobqMtMxfbP
Program: 6Z24B3qCrWfWvDo1f2HgxmnBSGhqQes1sHobqMtMxfbP
Mint: AVPgrT1y6ZfjGWPyLCWEPZdogRgmEMbrdRbcHNSfAPzF
Campaign: FcAmyEgZsXUKLB6hKufDmLuSBzMzVtPmRPm7vZLStK4U
SendTransactionError: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: custom program error: 0x3
at Connection.sendEncodedTransaction (/code/beens/node_modules/#solana/web3.js/src/connection.ts:4248:13)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Connection.sendRawTransaction (/code/beens/node_modules/#solana/web3.js/src/connection.ts:4210:20)
at async sendAndConfirmRawTransaction (/code/beens/node_modules/#project-serum/anchor/src/provider.ts:288:21)
at async AnchorProvider.sendAndConfirm (/code/beens/node_modules/#project-serum/anchor/src/provider.ts:148:14) {
logs: [
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]',
'Program log: Instruction: MintTo',
'Program log: Error: Account not associated with this Mint',
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2809 of 200000 compute units',
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA failed: custom program error: 0x3'
]
}
Why the authority is right, but Solana complain that Error: Account not associated with this Mint?
It turns out that my versions for Solana, Anchor and Rust are not compatible with DevNet and / or testnet.
I upgrade solana to main net recommended version and it works. One more things to mention that don't forget to run "solana program close --buffers" before trying. My current settings are:
root#d4c64206ce03:/code# solana --version
solana-cli 1.10.31 (src:77a40cd8; feat:4192065167)
root#d4c64206ce03:/code# rustc --version
rustc 1.63.0 (4b91a6ea7 2022-08-08)
root#d4c64206ce03:/code# anchor --version
anchor-cli 0.25.0
I'm trying to deploy a NixOS VM while storing its configuration on a private GitLab repository.
My configuration.nix looks like this (simplified to only include the relevant bits):
{ pkgs, ... }:
let
repo = pkgs.fetchFromGitLab { owner = "hectorj"; repo = "nix-fleet"; };
in {
imports = [
./hardware-configuration.nix
"${repo}/my-server-name/host.nix"
];
}
but it is giving me this error:
error: infinite recursion encountered
at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:496:28:
495| builtins.addErrorContext (context name)
496| (args.${name} or config._module.args.${name})
| ^
497| ) (lib.functionArgs f);
I do not understand where the recursion is happening.
It doesn't seem like its even fetching the repo, as I can put any non-existing names in the args and get the same error.
I saw https://nixos.org/guides/installing-nixos-on-a-raspberry-pi.html doing something similar without issue:
imports = ["${fetchTarball "https://github.com/NixOS/nixos-hardware/archive/936e4649098d6a5e0762058cb7687be1b2d90550.tar.gz" }/raspberry-pi/4"];
And I can use that line on my VM and it will build fine.
What am I missing?
The recursion is as follows
Compute the configuration
Compute the config fixpoint of all modules
Find all modules
Compute "${repo}/my-server-name/host.nix"
Compute repo (pkgs.fetch...)
Compute pkgs
Compute config._module.args.pkgs (Nixpkgs can be configured by NixOS options)
Compute the configuration (= 1)
You can break the recursion at 6 by using builtins.fetchTarball instead.
Alternatively, you can break it around 7, by using a different "pkgs".
If you're using configuration.nix as part of a larger expression, you may be able to pass an invoked Nixpkgs to NixOS via specialArgs.pkgs2 = import nixpkgs { ... }. This creates a pkgs2 module argument that can't be configured by NixOS itself.
Otherwise, you could define pkgs2 in a let binding.
{ pkgs, ... }:
let
# pkgs2: An independent Nixpkgs that can be constructed before the NixOS
# imports are resolved.
pkgs2 = import <nixpkgs> {};
repo = pkgs2.fetchFromGitLab { owner = "hectorj"; repo = "nix-fleet"; };
in {
imports = [
./hardware-configuration.nix
"${repo}/my-server-name/host.nix"
];
}
Deploying my NixOps machines takes alot of time, as packages need to build. I want to do the building regularly on my trusted private Hydra instance.
My current approach involves this release.nix file, but it doesn't work out so well.
{ nixpkgs ? <nixpkgs>, onlySystem ? true, extraModules ? [] }:
let
nixos = import "${nixpkgs}/nixos";
buildEnv = conf: (nixos {
configuration = conf;
});
buildTarget = m: let build = buildEnv (buildConf m); in
if onlySystem then build.system else build.vm;
buildConf = module: { ... }:
{
imports = [ module ] ++ extraModules;
};
in
{
machine1 = buildTarget ./machine1/configuration.nix;
machine2 = buildTarget ./machine2/configuration.nix
machine3 = buildTarget ./machine3/configuration.nix
machine4 = buildTarget ./machine4/configuration.nix
}
I don't really understand this code, as I copied it from here.
This builds fine if I run nix-build release.nix locally, but on hydra I never get a full build. Sometimes builds don't dequeue (they just don't get build), sometimes they fail with various error messages. As nothing of the hydra problems are reproducible (beside the fact, that I never get a full build), I wonder what the best practice for building a NixOps deployment is.
Please note, that I have unfree packages in my deployment. The option nixpkgs.config.allowUnfree = true; is set on the hydra server.
This is not a question about my hydra failures, but about what would be a good way to build a NixOps deployment with Hydra CI.
As far as I know, there is no way to make this super easy. Your code looks ok, but my method is a slightly different. I only build the toplevel attribute and I construct the NixOS configuration differently.
I build NixOS 'installations' from inside Nix using something like:
let
modules = [ ./configuration.nix ];
nixosSystem = import (pkgs.path + "/nixos/lib/eval-config.nix") {
inherit (pkgs) system;
inherit modules;
};
in
nixosSystem.config.system.build.toplevel
I want to build a Yeoman generator that needs to unzip a file.
From their documentation, it seems this process is done using this.registerTransformStream(...). It says it accept any gulp plugin, so I tried gulp-unzip (link)
Here's my code:
// index.js
...
writing: function() {
var source = this.templatePath('zip'); // the folder where the zipped file is
var destination = this.destinationRoot();
this.fs.copy(source, destination);
this.registerTransformStream(unzip() );
}
...
The result seems promising, first it shows all the file list then I get Error: write after end error.
Here's the dump:
create license.txt
create readme.html
create config.php
...
...
events.js:141
throw er; // Unhandled 'error' event
^
Error: write after end
at writeAfterEnd (C:\Users\myname\Documents\project\generator-test\node_modules\gulp-unzip\node_modules\readable-stream\lib\_stream_writable.js:144:12)
at Transform.Writable.write (C:\Users\myname\Documents\project\generator-test\node_modules\gulp-unzip\node_modules\readable-stream\lib\_stream_writable.js:192:5)
at DestroyableTransform.ondata (C:\Users\myname\Documents\project\generator-test\node_modules\through2\node_modules\readable-stream\lib\_stream_readable.js:531:20)
at emitOne (events.js:77:13)
at DestroyableTransform.emit (events.js:169:7)
at readableAddChunk (C:\Users\myname\Documents\project\generator-test\node_modules\through2\node_modules\readable-stream\lib\_stream_readable.js:198:18)
at DestroyableTransform.Readable.push (C:\Users\myname\Documents\project\generator-test\node_modules\through2\node_modules\readable-stream\lib\_stream_readable.js:157:10)
at DestroyableTransform.Transform.push (C:\Users\myname\Documents\project\generator-test\node_modules\through2\node_modules\readable-stream\lib\_stream_transform.js:123:32)
at DestroyableTransform._transform (C:\Users\myname\Documents\project\generator-test\node_modules\mem-fs-editor\lib\actions\commit.js:34:12)
at DestroyableTransform.Transform._read (C:\Users\myname\Documents\project\generator-test\node_modules\through2\node_modules\readable-stream\lib\_stream_transform.js:159:10)
The destination folder is empty after this. It seems the stream is trying to write the unzipped file but failed.
Does anyone solved this problem before? Or is there alternative way by just using the built-in fs?
Thanks a lot
I am trying to compile the hello world program of ROS tutorials to beaglebone black using bitbake. I am using an Ubuntu PC and have setup the workspace as mentioned in the user manual provided in vmayoral github link
I have modified the local.conf file in the /build/conf folder and contents look like this
DL_DIR = "${OEBASE}/sources"
BBFILES = "${OEBASE}/openembedded/recipes/*/*.bb"
ASSUME_PROVIDED += "help2man-native"
PREFERRED_PROVIDERS = "virtual/qte:qte virtual/libqpe:libqpe-opie"
PREFERRED_PROVIDERS += " virtual/libsdl:libsdl-x11"
PREFERRED_PROVIDERS += " virtual/${TARGET_PREFIX}gcc-initial:gcc-cross-initial"
PREFERRED_PROVIDERS += " virtual/${TARGET_PREFIX}gcc-intermediate:gcc-cross-intermediate"
PREFERRED_PROVIDERS += " virtual/${TARGET_PREFIX}gcc:gcc-cross"
PREFERRED_PROVIDERS += " virtual/${TARGET_PREFIX}g++:gcc-cross"
MACHINE = "beaglebone"
DISTRO = "angstrom-2008.1"
IMAGE_FSTYPES = "jffs2 tar"
BBINCLUDELOGS = "yes"
The bitbake recipe as below
DESCRIPTION = "Beginner_tutorials, talker/listener ROS package"
SECTION = "devel"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://package.xml;;beginline=16;endline=16;md5=05c8b019cf5b0834bc5e547a1 4f26ca3"
DEPENDS = "roscpp catkin rospy std-msgs"
RDEPENDS = "roscpp rospy std-msgs"
SRC_URI = "git://github.com/vmayoral/beginner_tutorials.git"
SRCREV = "${AUTOREV}"
PV = "1.0.0+gitr${SRCPV}"
S = "${WORKDIR}/git"
inherit catkin
When I run bitbake test.bb from oe/build folder I get this following error
ERROR: Traceback (most recent call last):File /home/srijit/oe/bitbake/lib/bb/cookerdata.py", line 175 in wrapped return func(fn, *args)File "/home/srijit/oe/bitbake/lib/bb/cookerdata.py", line 185, in parse_config_filereturn bb.parse.handle(fn, data, include) File "/home/srijit/oe/bitbake/lib/bb/parse/__init__.py", line 107, in handle return h['handle'](fn, data, include)File "/home/srijit/oe/bitbake/lib/bb/parse/parse_py/ConfHandler.py", line 145, in handle feeder(lineno, s, abs_fn, statements) File "/home/srijit/oe/bitbake/lib/bb/parse/parse_py/ConfHandler.py", line 182, in feederraise ParseError("unparsed line: '%s'" % s, fn, lineno);ParseError: ParseError at home/srijit/oe/openembedded/conf/bitbake.conf:377: unparsed line: 'IMAGE_EXTRA_SPACE = 10240' ERROR: Unable to parse conf/bitbake.conf: ParseError at /home/srijit/oe/openembedded/conf/bitbake.conf:377: unparsed line: 'IMAGE_EXTRA_SPACE = 10240'
I dont know what to do
Thanks for the help in advance
As I did more search on google.. I found here that we can't use the latest bitbake with openembedded-classic. So tried with bitbake 1.10 and this error went away.. But I have a new error now. It is
Unknown Event: <bb.event.NoProvider instance at 0x7f05e40ee248>
ERROR: Nothing PROVIDES 'mobile-unit.bb'
Command execution failed: Traceback (most recent call last):
File "/home/srijit/oe/bitbake/lib/bb/command.py", line 88, in runAsyncCommand commandmethod(self.cmds_async, self, options)
File "/home/srijit/oe/bitbake/lib/bb/command.py", line 174, in buildTargets command.cooker.buildTargets(pkgs_to_build, task)
File "/home/srijit/oe/bitbake/lib/bb/cooker.py", line 782, in buildTargets
taskdata.add_provider(localdata, self.status, k)
File "/home/srijit/oe/bitbake/lib/bb/taskdata.py", line 354, in add_provider
self.add_provider_internal(cfgData, dataCache, item)
File "/home/srijit/oe/bitbake/lib/bb/taskdata.py", line 383, in add_provider_internal
raise bb.providers.NoProvider(item)
NoProvider: mobile-unit.bb
Finally I solved the issue.. thought it will be helpful for somebody else. I think the main issue was my immaturity in understanding the ROS meta-ros layer and how it work and that the overall (mis)direction in installing ROS in BBB. I was trying to compile the beagle-ros for the Angstrom distribution that came with BBB. That was the problem.
Actually I downloaded the lates Angstrom distribution source in my Ubuntu PC and compiled for BBB as described here. Few tweaks here and there
Then we have to flash that Angstrom distribution to an SD Card and boot BBB from that.
Then you follow the instructions here to compile the beagle-ros layer and ros packages using the same bitbake setup as you compiled for Angstrom as discussed here and here
Now copy the compiled ipk files to BBB and install it using opkg and now you can run them on BBB