I followed this manual in order to visualize my QISKit v0.4.8 quantum circuit by means of the latex_drawer() function (in newer versions of QISKit the function is circuit_drawer()). However, I got the following error when running the code:
! LaTeX Error: File `qcircuit.sty' not found.
Is qcircuit.sty a part of QISKit? What is the best way to fix the issue?
By the way, this is the function that I use to produce the image of a circuit:
def circuit_image(circuit, basis="u1,u2,u3,cx"):
filename = 'circuit'
tmpdir = 'tmp'
if not os.path.exists(tmpdir):
os.makedirs(tmpdir)
filename_tex = filename + ".tex"
filename_pdf = filename + ".pdf"
latex_drawer(circuit, os.path.join(tmpdir, filename_tex), basis=basis)
os.system("pdflatex -output-directory {} {}".format(tmpdir, filename_tex))
images = pdf2image.convert_from_path(os.path.join(tmpdir, filename_pdf))
shutil.rmtree(tmpdir)
return images[0]
qcircuit is a third-party LaTeX package that is not part of QISKit. If your LaTeX distribution does not come with this package, you can install it by yourself.
For example, for Ubuntu 14.04.5 LTS do the following:
Download the zip-file
Unpack it to /usr/share/texlive/texmf-dist/tex/latex
Run sudo texhash
For more information on installing LaTeX packages, see the following pages:
Best way to install packages for TeXLive in Ubuntu?
How to install LaTeX packages for Tex Live?
Related
I am including opencv with custom build parameters in my Yocto image. For that I have an opencv_4.1.0.bbappend recipe, in which I set custom options, specifically FFMPEG. The recipe goes something like this:
DEPENDS += "ffmpeg libpng"
EXTRA_OECMAKE_append += "-DWITH_FFMPEG=ON -DWITH_GTK=OFF" # and some other options
During configure I get cmake errors and can't seem to figure out, how to satisfy the header dependencies. The errors go like this (I assume this is the reason for do_configure to fail):
CheckIncludeFile.c:1:10: fatal error: /home/janos/dev/yocto/build/tmp/work/core2-64-poky-linux/opencv/4.1.0-r0/recipe-sysroot/usr/include/libpng/png.h: No such file or directory
1 | #include </home/janos/dev/yocto/build/tmp/work/core2-64-poky-linux/opencv/4.1.0-r0/recipe-sysroot/usr/include/libpng/png.h>
CheckIncludeFile.c:1:10: fatal error: sys/videoio.h: No such file or directory
1 | #include <sys/videoio.h>
Focusing on the missing png.h header first, I am tempted to depend libpng-dev, as I also would apt install it. But there is no package for it.
When I search oe-pkgdata-util list-pkg-files -p libpng, I can find the header in a libpng-dev package:
...
libpng-dev:
/usr/bin/libpng-config
/usr/bin/libpng16-config
/usr/include/libpng16/png.h
/usr/include/libpng16/pngconf.h
/usr/include/libpng16/pnglibconf.h
/usr/include/png.h
...
...
I can also find it in libpng-src and also ffmpeg-src package (oe-pkgdata-util find-path "*png.h" was my friend). But all of these -dev and -src packages I cannot depend on in DEPENDS.
How can I get my recipe to know those headers?
Target machine is raspberrypi4-64, on which the recipe is configuring and compiling well - it fails when I build for qemux86-64, which I use for testing. Namely, my test command is MACHINE="qemux86-64" bitbake opencv.
It doesn't really answer the question which I though was the question - but this is how the opencv recipe is easily configured:
PACKAGECONFIG = "python3 libav libv4l v4l"
Looking into the opencv 4.1.0 recipe (opencv_4.1.0.bb), I could see that FFMPEG gets enabled with the libav configurable option.
As a result of depending FFMEPG, I had to whitelist "commercial" licenses in my local.conf file:
LICENSE_FLAGS_WHITELIST = "commercial"
Looking into ./build/tmp/work/aarch64-poky-linux/opencv/4.1.0-r0/temp/log.do_configure shows that opencv is correctly configured without GUI, with v4l/v4l2:, FFMPEG, python3, etc.
And so python3 in the resulting image:
import cv2
print(cv2.getBuildInformation())
I am trying to find the boost libraries (cmake) inside the Yocto SDK with extended environment on krogoth.
The default cmake Find_
find_package(Boost REQUIRED)
The standard error message
Unable to find the requested Boost libraries.
Unable to find the Boost header files. Please set BOOST_ROOT to the root
directory containing Boost or BOOST_INCLUDEDIR to the directory containing
Boost's headers.
Call Stack (most recent call first):
CMakeLists.txt:3 (find_package)
The following is a snippet from my conf/local.conf
IMAGE_INSTALL_append = " boost-dev"
IMAGE_INSTALL_append = " boost"
IMAGE_INSTALL_append = " kernel-devsrc"
MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "kernel-module-hello"
KERNEL_MODULE_AUTO_lOAD += "hello-md"
LCHAIN_HOST_TASK_append = "${SDK_EXTRA_TOOLS}"
SDK_EXTRA_TOOLS = " nativesdk-cmake
I am using the native cmake
auke#xenialxerus:~/workspace/beaglebone-dev/build$ which cmake
/home/auke/workspace/beaglebone-dev/poky-sdk/tmp/sysroots/x86_64-linux/usr/bin/
since I:
source environment-setup-cortexa8hf-neon-poky-linux-gnueabi
looking for the usual headers in:
find ./tmp/sysroots/beaglebone/usr/include/boost/
..
/tmp/sysroots/beaglebone/usr/include/boost/vmd/list/to_seq.hpp
./tmp/sysroots/beaglebone/usr/include/boost/vmd/list/to_tuple.hpp
./tmp/sysroots/beaglebone/usr/include/boost/vmd/to_list.hpp
./tmp/sysroots/beaglebone/usr/include/boost/vmd/empty.hpp
./tmp/sysroots/beaglebone/usr/include/boost/vmd/is_list.hpp
./tmp/sysroots/beaglebone/usr/include/boost/vmd/size.hpp
./tmp/sysroots/beaglebone/usr/include/boost/vmd/get_type.hpp
./tmp/sysroots/beaglebone/usr/include/boost/vmd/assert_is_identifier.hpp
./tmp/sysroots/beaglebone/usr/include/boost/vmd/is_number.hpp
..
just like the binaries:
./tmp/sysroots/beaglebone/usr/lib/libboost_system-mt.a
./tmp/sysroots/beaglebone/usr/lib/libboost_iostreams.so.1.60.0
./tmp/sysroots/beaglebone/usr/lib/libboost_serialization-mt.a
./tmp/sysroots/beaglebone/usr/lib/libboost_date_time-mt.a
./tmp/sysroots/beaglebone/usr/lib/libboost_date_time.a
./tmp/sysroots/beaglebone/usr/lib/libboost_thread.so
./tmp/sysroots/beaglebone/usr/lib/libboost_signals-mt.a
./tmp/sysroots/beaglebone/usr/lib/libboost_date_time-mt.so
./tmp/sysroots/beaglebone/usr/lib/libboost_graph-mt.a
./tmp/sysroots/beaglebone/usr/lib/libboost_iostreams.so
./tmp/sysroots/beaglebone/usr/lib/libboost_regex.so
./tmp/sysroots/beaglebone/usr/lib/libboost_wserialization.so.1
Is there something that i might have overlooked?
regards Auke
You should use
bitbake -c populate_sdk <image_name> to generate the SDK based on your image;
As an alternative to locating and downloading a toolchain installer,
you can build the toolchain installer one of two ways if you have a
Build Directory:
*Use bitbake meta-toolchain. This method requires you to still install
the target sysroot by installing and extracting it separately. For
information on how to install the sysroot, see the "Extracting the
Root Filesystem" section.
*Use bitbake -c populate_sdk. This method has significant
advantages over the previous method because it results in a toolchain
installer that contains the sysroot that matches your target root
filesystem.
Also, using the variable TOOLCHAIN_HOST_TASK to add more packages.
http://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html
This variable lists packages the OpenEmbedded build system uses when
building an SDK, which contains a cross-development environment. The
packages specified by this variable are part of the toolchain set that
runs on the SDKMACHINE, and each package should usually have the
prefix "nativesdk-". When building an SDK using bitbake -c
populate_sdk , a default list of packages is set in this
variable, but you can add additional packages to the list.
e.g.
TOOLCHAIN_HOST_TASK += “nativesdk-libqt5core-dev”
Im a bit of a luarocks noob, but have done a fair bit of lua coding. I can't find the answer to this anywhere;
Ive installed a new luarock (lua-resty-auto-ssl) via:
luarocks install --tree lualib lua-resty-auto-ssl
This installs to my directory with no problems, however I don't have any .lua files.
I can see in the rock_manifest file they are all listed.
How do I install the .lua files?
After running luarocks install --tree lualib lua-resty-auto-ssl, I have a directory with the following content:
lualib
lualib/share
lualib/share/lua
lualib/share/lua/5.3
lualib/share/lua/5.3/resty
lualib/share/lua/5.3/resty/auto-ssl.lua
lualib/share/lua/5.3/resty/auto-ssl
lualib/share/lua/5.3/resty/auto-ssl/storage_adapters
lualib/share/lua/5.3/resty/auto-ssl/storage_adapters/redis.lua
lualib/share/lua/5.3/resty/auto-ssl/storage_adapters/file.lua
lualib/share/lua/5.3/resty/auto-ssl/jobs
lualib/share/lua/5.3/resty/auto-ssl/jobs/renewal.lua
lualib/share/lua/5.3/resty/auto-ssl/vendor
lualib/share/lua/5.3/resty/auto-ssl/vendor/shell.lua
lualib/share/lua/5.3/resty/auto-ssl/vendor/sockproc
lualib/share/lua/5.3/resty/auto-ssl/vendor/letsencrypt.sh
lualib/share/lua/5.3/resty/auto-ssl/storage.lua
lualib/share/lua/5.3/resty/auto-ssl/ssl_certificate.lua
lualib/share/lua/5.3/resty/auto-ssl/init.lua
lualib/share/lua/5.3/resty/auto-ssl/servers
lualib/share/lua/5.3/resty/auto-ssl/servers/challenge.lua
lualib/share/lua/5.3/resty/auto-ssl/servers/hook.lua
lualib/share/lua/5.3/resty/auto-ssl/utils
lualib/share/lua/5.3/resty/auto-ssl/utils/run_command.lua
lualib/share/lua/5.3/resty/auto-ssl/utils/shell_execute.lua
lualib/share/lua/5.3/resty/auto-ssl/utils/start_sockproc.lua
lualib/share/lua/5.3/resty/auto-ssl/init_worker.lua
lualib/share/lua/5.3/resty/auto-ssl/ssl_providers
lualib/share/lua/5.3/resty/auto-ssl/ssl_providers/lets_encrypt.lua
lualib/share/lua/5.3/resty/auto-ssl/shell
lualib/share/lua/5.3/resty/auto-ssl/shell/start_sockproc
lualib/share/lua/5.3/resty/auto-ssl/shell/letsencrypt_hooks
lualib/share/lua/5.3/resty/http_headers.lua
lualib/share/lua/5.3/resty/http.lua
lualib/lib64
lualib/lib64/luarocks
lualib/lib64/luarocks/rocks
lualib/lib64/luarocks/rocks/manifest
lualib/lib64/luarocks/rocks/lua-resty-auto-ssl
lualib/lib64/luarocks/rocks/lua-resty-auto-ssl/0.9.0-1
lualib/lib64/luarocks/rocks/lua-resty-auto-ssl/0.9.0-1/rock_manifest
lualib/lib64/luarocks/rocks/lua-resty-auto-ssl/0.9.0-1/lua-resty-auto-ssl-0.9.0-1.rockspec
lualib/lib64/luarocks/rocks/lua-resty-auto-ssl/0.9.0-1/doc
lualib/lib64/luarocks/rocks/lua-resty-auto-ssl/0.9.0-1/doc/CHANGELOG.md
lualib/lib64/luarocks/rocks/lua-resty-auto-ssl/0.9.0-1/doc/LICENSE.txt
lualib/lib64/luarocks/rocks/lua-resty-auto-ssl/0.9.0-1/doc/README.md
lualib/lib64/luarocks/rocks/lua-resty-http
lualib/lib64/luarocks/rocks/lua-resty-http/0.09-0
lualib/lib64/luarocks/rocks/lua-resty-http/0.09-0/rock_manifest
lualib/lib64/luarocks/rocks/lua-resty-http/0.09-0/lua-resty-http-0.09-0.rockspec
lualib/lib64/luarocks/rocks/lua-resty-http/0.09-0/doc
lualib/lib64/luarocks/rocks/lua-resty-http/0.09-0/doc/README.md
lualib/lib64/luarocks/rocks/lua-resty-http/0.09-0/doc/LICENSE
There are plenty of Lua files there. What result do you get?
(I don't think it will matter much, but: I'm using Lua 5.3 with LuaRocks 2.3.0)
I am the developer of this small library: https://github.com/martin-damien/babel and I have a problem with Luarocks releases.
From source
When I install from source with Luarocks I have no problem:
$ luarocks make --local rockspecs/babel-1.2-2.rockspec
From internet
But when deployed (using: tag master, add new rockspec release and publish to Luarocks), I can't install using
$ luarocks install --local babel
Because I encounter the following error:
Installing https://luarocks.org/babel-1.2-2.src.rock...
Using https://luarocks.org/babel-1.2-2.src.rock... switching to 'build' > mode
stat: malsukcesis eltrovi statinformon pri «locales/zh-HK.lua»: No such > file or directory
Error: Build error: Failed installing locales/zh-HK.lua in /home/damien/.luarocks/lib/luarocks/rocks/babel/1.2-2/lua/locales/zh-HK.lua: locales/zh-HK.lua: No such file or directory
As you can see in https://github.com/martin-damien/babel/issues/14 the error occure on different files (but until now, only with locale files, not with the babel.lua file).
I have no idea why it randomly crash like this, so if someone know why or have an idea from where it could come from...
Thanks in advance,
Damien
The location of the files in the build.modules table is (from the docs on the rockspec format):
relative to source.dir
Where source.dir is
source.dir (string) - the name of the directory created when the source archive is unpacked. Can be omitted if it can be inferred from the source.file field. Example: "luasocket-2.0.1"
and source.file is
source.file (string) - the filename of the source archive. Can be omitted if it can be inferred from the source.url field. Example: "luasocket-2.0.1.tar.gz"
You don't specify source.dir or source.file in your rockspec but you do set source.url (because you have to).
So you have source.url = https://github.com/martin-damien/babel/archive/v1.2-2.zip which (presumably) ends up with source.file = v1.2-2.zip and then source.dir = v1.2-2 but your zip file extracts into a babel-1.2 so luarocks can't find your source files. (The screenshot in the linked issue seems to indicate that luarocks uses source.file = v1.2.zip and the archive extracts to babel-1.2 but I'm not sure how that's possible.)
Add dir = "babel-1.2" to your rockspec's source table an I expect it will work.
Some versions ago there was a command to get a filters (and coders) ImageMagick dirs:
MagickCore-config --filter-path
But now (I use 6.8.0 version) it seems there no such command anymore. This command give an error. Seems there no such option --filter-path.
So how should I get filters dir?
MagickCore-config is a script. It performs pkg-config calls. The content of /opt/local/lib/pkgconfig/ImageMagick.pc (there is no link to filters dir exists):
prefix=/opt/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include/ImageMagick
Name: ImageMagick
Description: ImageMagick - Convert, Edit, and Compose Images
Version: 6.8.0
Libs: -L${libdir} -lMagickCore
Cflags: -I${includedir}
I found filters dir manually on my system at /opt/local/lib/ImageMagick-6.8.0/modules-Q16/filters. But I need an automated way.
The error was overpassed the next way:
According to http://www.imagemagick.org/script/resources.php there is a user-related dir for filters and coders: $HOME/.magick. So just use it in your scripts.
You need to set the following environment variable, actually:
export MAGICK_CODER_FILTER_PATH=$HOME/.magick/filters