How to fix cmake install in Jupyter kernels, specifically Google Colab? - cmake

I am trying to get OpenAI roboschool to run in Google Colab (have a virtual display setup that records the environment during training and displays video after). The roboschool library will import, but the environments don't show up properly (at all), when I run:
import roboschool, gym;
print("\n".join(['- ' + spec.id for spec in
gym.envs.registry.all() if spec.id.startswith('Roboschool')]))
the list is empty, and it should include the environments.
When cmake links dlls, does it do so with environment variables? Environment variables in Colab don't work as usual, and I think that may be the issue. I don't know enough to know for sure.
This output looks suspect to me, doesn't seem right that the runtime path would be removed. There are a number of these so I only grabbed two for example.
-- Set runtime path of "/content/roboschool/roboschool/cpp-
household/bullet_local_install/lib/libBulletDynamics.so.2.87" to ""
-- Set runtime path of "/content/roboschool/roboschool/cpp-
household/bullet_local_install/lib/libBullet3Geometry.so.2.87" to "
Here is the command sequence.
cmake -DBUILD_SHARED_LIBS=ON -DUSE_DOUBLE_PRECISION=1 -
DCMAKE_INSTALL_PREFIX:PATH=/content/roboschool/roboschool/cpp-
household/bullet_local_install -DBUILD_CPU_DEMOS=OFF -
DBUILD_BULLET2_DEMOS=OFF -DBUILD_EXTRAS=OFF -DBUILD_UNIT_TESTS=OFF -
DBUILD_CLSOCKET=OFF -DBUILD_ENET=OFF -DBUILD_OPENGL3_DEMOS=OFF ..
make -j4
make install
Is there a way I can override the way paths are determined for the linked libraries so they will link with the correct paths if that is correct? Seems like looking into RPATH may be a step in the right direction?
Thanks in advance. Please let me know if additional detail is necessary.

Hard to say what's going on without more details, but if you're building .so's to non-standard location that you want the python runtime to see, you have to somehow tell the runtime about the .so's location. Guessing based on the snippets you provided, maybe this (possibly after a runtime restart (ctrl-m-period)) will unblock you:
import os
os.environ['LD_LIBRARY_PATH'] = '/content/roboschool/roboschool/cpp-household/bullet_local_install/lib:' + os.environ['LD_LIBRARY_PATH']
If that doesn't do it for you, two other suggestions are:
Change your configuration to install to "standard" locations
Share a minimal notebook that reproduces the issue.

Related

NIST Round 3 Classic McEliece Missing Libkeccek.a.headers/SimpleFIPS202.h

I am attempting to build the KAT's for the round 3 submission for Classic McEliece, based off the reference implementation on this site:
https://csrc.nist.gov/Projects/post-quantum-cryptography/post-quantum-cryptography-standardization/round-3-submissions
When I try and build it, I get the error:
libkeccak.a.headers/SimpleFIPS202.h
I have attempted to build XKCP by cloning this repo: https://github.com/XKCP/XKCP
and running: make generic64/libXKCP.a
I can see that this builds, and I get a directory within the repo ./bin/generic64/libXKCP.a.headers
Has the name of this project changed since the round 3 submissions were released, or should I be looking for a different repository?
If this is correct, I still cannot build Classic McEliece, even if I change all references from libkeccak.a.headers/SimpleFIPS202.h to libXKCP.a.headers/SimpleFIPS202.h
Do I need to move this directory: ./bin/generic64/libXKCP.a.headers somewhere to allow gcc to find it? (I am on wsl)
Managed to fix it myself.
This question helped me: C++ Using Keccak Library
I had to clone those repos to the correct spot.
Then you need to change the include from libkeccak.a.headers/SimpleFIPS202.h to libXKCP.a.headers/SimpleFIPS202.h , as I guessed.
After that, you also need to change one of the flags in compilation from -lkeccak to -lXKCP (I couldnt find a reference anywhere, so this was a guess, but it worked.)

how to fix the problem of downloading fasttext-model300?

I'm using windows 10 and python 3.3. I tried to download fasttext_model300 to calculate soft cosine similarity between documents, but when I run my python file, it stops after arriving at this statement:
fasttext_model300 = api.load('fasttext-wiki-news-subwords-300')
There are no errors or not responding, It just stops without any reaction.
Does anybody know why it happens?
Thanks
I'd recommend against using the gensim api.load() functionality. It dynamically runs new, unversioned source code from remote servers – which is opaque in its operations & suboptimal for maintaining a secure local configuration, or debugging any issues which occur.
Instead, find the actual exact data files you trust and download them as plain data. Then, use specific library operations, like the KeyedVectors.load_word2vec_format() method, so instantiate exactly the model you need, using precise local-file paths you understand.
Following those steps may make it clearer what, if anything, is going wrong. If it doesn't, try also enabling logging at the INFO level to gather more information about what progress is made before failure (and add any new details as a comment or to your question).
python3 -m gensim.downloader --download fasttext-wiki-news-subwords-300
Try using this. Source : https://awesomeopensource.com/project/RaRe-Technologies/gensim-data

Generate Lint targets using cmake (Flexelint/Linux)

I am working on a C/C++ product that only builds in the Linux environment. It is a massive code base and generating lint targets manually is going to be incredibly painful. I know that you can link Lint into cmake so cmake generates these targets for you while it builds the code. Cmake has a macro called add_pc_lint (https://cmake.org/Wiki/PC-Lint) which does this for you. I wanted to know if there is something similar that could be used for Flexelint?
I currently have a PC-Lint license and wanted to ask this question before spending $998 on a Flexelint license. Thanks!
FlexeLint and PC-lint share the same manual so I'm pretty sure they are fully compatible on the command line. You should be able to use the same make files for both, or with minor changes. Otherwise they do offer a 30-day money-back guarantee.
Another option might be to run PC-lint under Wine. I tried this once and I got it working, but then I never used it much so I'm not sure how well it worked.
So I did get a FlexeLint license yesterday and now I am trying to integrate it into my CMakeLists. I am looking at the source code of cmake's add_pc_lint function and trying to modify it to work for FlexeLint. If anyone has played around with it before, please comment. The FlexeLint manual is not at all helpful.

How do I determine what to import using gnulib-tool

autoscan produced a series of function checks (AC_FUNC_* and AC_CHECK_FUNCS), and AC_CHECK_HEADERS. Now I need to pull in gnulib code. Do I just try to import every function and header that autoscan identified? Half of them don't show up in the gnulib-tool --list output. Or do I wait until ./configure fails on some platform?
My suggestion would be to ignore autoscan entirely and instead try to figure out which platform you're targeting.
In particular autoscan will try to add tests for functions that are available in every single platform since 1990, but might be missing on a non-SysV OS for instance.
Start with a base platform target (such as C99 and the latest POSIX), and then figure out which other OSes you want to target and what they are missing.
Don't try to cover bases for OSes you have no access to, it's likely you won't actually know what is needed for them to build, let alone run.
Full disclosure: I have changed my opinion on gnulib over the years and not suggest it to be used anymore, if at all possible.
There are two ways to determine which list of gnulib modules you might need:
You can scan your source code or your object files (with nm) by hand.
You can import all the POSIX header file modules via gnulib-tool, then add -DGNULIB_POSIXCHECK to the CFLAGS, compile your package, and analyze the resulting warnings.
Also, some gnulib overrides exist for the sake of old platforms only. You can read the list of what each override fixes, and apply your own judgement.

Is there a script that turns a Pharo core image into something more useful, that would include an OmniBrowser?

I cannot use the most recent dev Pharo release because of some strange issues with the compiler built into Pharo. Well. I was wondering if there is a quick way to install all the nifty extras into Pharo that the core image misses, as compared to the dev image.
With all non-core Pharo images come a script which was used to build that image. Just edit that file and drag&drop it on a new core.
You could also tell me what you don't like in the Pharo images so that I can enhance them.
There is also the script I published on the Pharo wiki that I use to build my images:
http://code.google.com/p/pharo/wiki/ImageBuildScripts
Of course it is very specific to my preferences and needs, but you can take it as an example and adapt it to your own needs.
CommandShell works with Pharo 9.10.10. You will hit several errors as you try to load the package due to Pharo lacking MVC, but you can simply proceed past the first bunch and abandon the last one (that tries to actually open a CommandShell in Morphic). At that point, you'll have a class called PipeableOSProcess that can be used very easily to grab output. For example:
(PipeableOSProcess command: 'ls /bin') output
will return the contents of your bin directory as a string.
Ok, OB itself can be easily downloaded using ScriptLoader loadSuperOB.
Damien adds (from comment below):
The problem with that approach is that nobody really maintains it.
Moreover, you miss some configuration steps to enhance the use of OB
(for example, you won't have the OB-based browsers if you ask for the
senders of a message from a workspace)