I am working with clash (haskell -> verilog) compilation the demo project at https://github.com/mheinzel/clash-yosys-demo provides both a nix branch and one using stack.
running
time clash -v --verilog src/Top.hs -outputdir build
takes
~ 1m if I run it inside a nix shell, compared to
~ 2s if I use the version I installed with stack install --resolver lts-12.12 clash-ghc
I am very much a Nix beginner and using Nixpkgs, so can anyone give me pointers where to look at why my Nix environment version is so much slower? It seems the linking of used libraries is taking ages (this is what I got from using -v, the verbose flag).
Related
I'm trying to get the .NET source code, not the TypeScript source code. I've googled for quite a while and tried to dig through the main source code repository for documentation on this. Not finding answers.
It doesn't exist. CDK is written in TypeScript and then converted to other languages at release using their jsii tool.
You can generate the .NET code using jsii yourself if that's what you're after. The CDK github documentation explains how to do this:
Packing involves generating CDK code in the various target languages and packaging them up to be published to their respective package managers. Once in a while, these will need to be generated either to test the experience of a new feature, or reproduce a packaging failure.
To package a specific module, say the #aws-cdk/aws-ec2 module:
$ cd <root-of-cdk-repo>
$ docker run --rm --net=host -it -v $PWD:$PWD -w $PWD jsii/superchain
docker$ cd packages/#aws-cdk/aws-ec2
docker$ ../../../scripts/foreach.sh --up yarn run package
docker$ exit
I'm running Julia on the raspberry pi 4. For what I'm doing, I need Julia 1.5 and thankfully there is a docker image of it here: https://github.com/Julia-Embedded/jlcross
My challenge is that, because this is a work-in-progress development I find myself adding packages here and there as I work. What is the best way to persistently save the updated environment?
Here are my problems:
I'm having a hard time wrapping my mind around volumes that will save packages from Julia's package manager and keep them around the next time I run the container
It seems kludgy to commit my docker container somehow every time I install a package.
Is there a consensus on the best way or maybe there's another way to do what I'm trying to do?
You can persist the state of downloaded & precompiled packages by mounting a dedicated volume into /home/your_user/.julia inside the container:
$ docker run --mount source=dot-julia,target=/home/your_user/.julia [OTHER_OPTIONS]
Depending on how (and by which user) julia is run inside the container, you might have to adjust the target path above to point to the first entry in Julia's DEPOT_PATH.
You can control this path by setting it yourself via the JULIA_DEPOT_PATH environment variable. Alternatively, you can check whether it is in a nonstandard location by running the following command in a Julia REPL in the container:
julia> println(first(DEPOT_PATH))
/home/francois/.julia
You can manage the package and their versions via a Julia Project.toml file.
This file can keep both the list of your dependencies.
Here is a sample Julia session:
julia> using Pkg
julia> pkg"generate MyProject"
Generating project MyProject:
MyProject\Project.toml
MyProject\src/MyProject.jl
julia> cd("MyProject")
julia> pkg"activate ."
Activating environment at `C:\Users\pszufe\myp\MyProject\Project.toml`
julia> pkg"add DataFrames"
Now the last step is to provide package version information to your Project.toml file. We start by checking the version number that "works good":
julia> pkg"st DataFrames"
Project MyProject v0.1.0
Status `C:\Users\pszufe\myp\MyProject\Project.toml`
[a93c6f00] DataFrames v0.21.7
Now you want to edit Project.toml file [compat] to fix that version number to always be v0.21.7:
name = "MyProject"
uuid = "5fe874ab-e862-465c-89f9-b6882972cba7"
authors = ["pszufe <pszufe#******.com>"]
version = "0.1.0"
[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
[compat]
DataFrames = "= 0.21.7"
Note that in the last line the equality operator is twice to fix the exact version number see also https://julialang.github.io/Pkg.jl/v1/compatibility/.
Now in order to reuse that structure (e.g. different docker, moving between systems etc.) all you do is
cd("MyProject")
using Pkg
pkg"activate ."
pkg"instantiate"
Additional note
Also have a look at the JULIA_DEPOT_PATH variable (https://docs.julialang.org/en/v1/manual/environment-variables/).
When moving installations between dockers here and there it might be also sometimes convenient to have control where all your packages are actually installed. For an example you might want to copy JULIA_DEPOT_PATH folder between 2 dockers having the same Julia installations to avoid the time spent in installing packages or you could be building the Docker image having no internet connection etc.
In my Dockerfile I simply install the packages just like you would do with pip:
FROM jupyter/datascience-notebook
RUN julia -e 'using Pkg; Pkg.add.(["CSV", "DataFrames", "DataFramesMeta", "Gadfly"])'
Here I start with a base datascience notebook which includes Julia, and then call Julia from the commandline instructing it to execute the code needed to install the packages. Only downside for now is that package precompilation is triggered each time I load the container in VS Code.
If I need new packages, I simply add them to the list.
I'm using the Busted framework to test my lua programs. I have newest busted version
user ~ $ busted --version
2.0.rc12-0
I ran this program (its called etl)
goto statement
::statement::
error loading module 'etl' from file './etl.lua':
./etl.lua:6: '=' expected near 'statement'
edit: I'm pretty sure that busted is referencing lua 5.1 or 5.2, but I only have lua 5.3.3 on my system. So how do I get busted to recognize 5.3.3?
proof I only have lua 5.3.3 on my system
me ~ $ luaver list
==> Installed versions:
==> lua-5.3.3
Update: I had some different versions of lua hidden in another folder that luaver didn't recognize. I deleted those and then busted gave me this every time I tried to run it:
/usr/local/bin/busted: 3: exec: /usr/bin/lua5.1: not found
Then I went to to the busted file in /usr/local/bin/busted and it was like this
#!/bin/sh
exec '/usr/bin/lua5.1' -e 'package.path="/home/sam/.luarocks/share/lua/5.1/?.lua;/home/sam/.luarocks/share/lua/5.1/?/init.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;"..package.path; package.cpath="/home/sam/.luarocks/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/?.so;"..package.cpath' -e 'local k,l,_=pcall(require,"luarocks.loader") _=k and l.add_context("busted","2.0.rc12-1")' '/usr/local/lib/luarocks/rocks/busted/2.0.rc12-1/bin/busted' "$#"
so i need to change all that shit to lua5.3. My lua 5.3 is in /usr/local/bin.
Do I just take that file and start cutting out the 5.1 stuff and replacing it with 5.3 stuff?
I have the Math extension installed in my MediaWiki 1.19. After I updated Ubuntu Server from 12.04 to 14.04 something seems to have messed it up and it has stopped working. Basically I get the following error when I try to display anything between the <math> and </math> tags:
Failed to parse (PNG conversion failed; check for correct installation
of latex and dvipng (or dvips + gs + convert))
I have tried the common troubleshooting that one can find online regarding this issue, and have recompiled texvc to check if that fixed the issue. The texvc executable in the extensions/Math/math directory seems to do its job when invoked from the command line. I have obviously checked that all the other executables (latex, dvipng, etc.) work as they should.
When I try to render math from my wiki, the corresponding *.tex file is created in images/tmp with the correct latex code in it, but nothing else happens.
The problem seems to be related to texvc having trouble invoking latex and dvipng.
What could be causing this issue and how can I fix it?
Well, I figured it out. Basically, any shell command is passed by a security filter. So in practice, texvc is executed by Mediawiki through bin/ulimit4.sh:
#!/bin/bash
ulimit -t $1 -v $2 -f $3
eval "$4"
where $4 is the actual texvc command being run and $2 is the amount of memory allowed for this process. The memory that comes by default is 102400 KB (exactly 100MB), which seems to be insufficient for this process to run. The amount of memory can be set in LocalSettings.php with the variable $wgMaxShellMemory. In my case I set it to 300MB, $wgMaxShellMemory = 307200;, which seems to be enough.
Why this small process of generating a png needs so much memory I do not know.
The reason why this stopped working after updating to Ubuntu 14.04 probably has to do with some newly shipped version of either latex, dvipng, convert, etc. requiring more memory than it did with the version that came with Ubuntu 12.04.
I just downloaded Erlang using apt-get onto Ubuntu 10.10. How do I run the examples that come with Erlang (the examples you can get through apt-get install erlang-examples). I tried going to the directory where they were stored and compiling ball.erl, but I got this error:
ball.bea#: error writing file
error
The directory where those examples are stored isn't writeable by normal users. To compile a .erl file, the compiler needs to be able to write out the compiled .beam file.
One way around this is to copy the files to a directory you can write to and compile them there:
$ mkdir erlex
$ cd erlex
$ cp /usr/lib/erlang/lib/gs-1.5.11/examples/src/* .
$ erlc *.erl
You need the erlang-dev package installed for that to work.
You can run the ball example like so:
$ erl -s ball
ball here is the module name, and the Erlang emulator defaults to calling the start/0 function in that module, which is correct in this case.
You don't actually have to compile these examples, however. The Ubuntu erlang-examples package ships with them already compiled:
$ cd /usr/lib/erlang/lib/gs-1.5.11/examples/ebin
$ erl -s ball
After closing the GUI window in each, say q(). to get out of the emulator. This may seem weird to you until you realize that everything about Erlang is designed with long uptimes in mind. The mere fact that the last process the emulator was running has stopped isn't enough reason for the BEAM emulator to shut itself down. Something else might be started in that same emulator later, after all.