I just found out that RedHat provides this "Developer toolset" which allows me to install (and of course use) the most up-to-date gcc-4.7.2. I use it on Centos, but the process is the same.
Once installed, you can start a new bash session with this toolset enabled by issuing:
scl enable devtoolset-1.1 bash
That works all right. Now, could I somehow add this to my bashrc since this actually starts a new bash session? Or should I better place it inside my makefiles to avoid starting a new bash session. Would there be a way to issue this within a makefile?
I wrote a blog post on this subject because it started to come up a lot. If you would like to read it, you can find it here: http://developerblog.redhat.com/2014/03/19/permanently-enable-a-software-collection/
tl;dr
you can source /opt/rh/devtoolset-1.1/enable in your .bashrc or, for somewhat better solution you can include:
source /opt/rh/devtoolset-1.1/enable
export X_SCLS="`scl enable devtoolset-1.1 'echo $X_SCLS'`"
But definitely check out the post for more info.
Check the URL
http://preilly.me/2013/05/28/redhat-developer-toolset-1-1/
for more information, for example how to set the CC, CPP, CXX environment variables. Or check
http://people.centos.org/tru/devtools-1.1/
for the devtool-1.1 repository for CentOS.
Related
Situation
Software author wants to add zsh completion to his project. Has written completion script, works.
Needs to figure out where under $CMAKE_INSTALL_PREFIX to install so it gets found by default.
Problem
Testing Fedora 34 against Ubuntu 20.04, it was found that the only common member of $fpath is /usr/local/share/zsh/site-functions; none of the /usr/share fpaths overlap. Especially, Ubuntu does not read /usr/share/zsh/site-functions.
So, I can't just install into $CMAKE_INSTALL_PREFIX/share/zsh/site-functions, because that only works for $CMAKE_INSTALL_PREFIX==/usr/local, but not later in packaging ($CMAKE_INSTALL_PREFIX==/usr). I'd argue this is a Ubuntu inconsistency, but that doesn't effectively matter.
Question
Is there a sensible way to figure out at CMake time where to put completion scripts?
Note that CMake is not usually run from zsh, so checking $fpath is not an option.
$CMAKE_INSTALL_PREFIX/share/zsh/site-functions is the right place.
It is the same with man pages, info pages, pkg-config path, binaries and libraries and whatever else. On a default install, man will only look in predefined places like /usr/share/man and /usr/local/share/man.
If someone decides to install to /opt/gnuradio or whatever, it is then also their responsibility to ensure that they set $PATH, $MANPATH $INFOPATH and whatever else accordingly. It is the same for $fpath. The best software can do is ensure that they stick to established conventions and not to spew files elsewhere on the filesystem outside of $PREFIX.
If Ubuntu wants to be clever and invent their own vendor-completion directories then a consequence of that is that is that they need to patch everything they package that includes a zsh completion. That's their problem because they created the problem for themselves.
I created a package for sagemath and used Sphinx to create its documentation. Now I'm trying to create the necessary configuration files to build the documentation in readthedocs.
The problem is that I've come across is that in order for the documentation to build, I have to run sphinx inside a sagemath shell (that is, sage -sh -c "make html").
Is there any way to achieve so with the configuration file for readthedocs? Or to use a makefile to build the docs? Can't seem to find the information on their documetation.
At the moment, Read the Docs has a fixed build process that involves calling python -m sphinx -b html (with some more parameters) from the virtual environment where the requirements are installed. This is described in the documentation.
Therefore, running custom commands is not possible.
However, since sage is available from conda and Read the Docs supports conda environments, you might be able to build the docs without invoking a Sage shell.
Read the Docs has released a beta feature that allows users to override the build process completely and execute custom commands. You can achieve what you want by using build.commands config key in the configuration file (see https://docs.readthedocs.io/en/stable/config-file/v2.html)
Full documentation of this beta feature at https://docs.readthedocs.io/en/stable/build-customization.html#override-the-build-process
pyenv-virtualenv offers a nice way of activating the environment on the very instant of entering or leaving the directory which contains a .python-version text file which specifies the environment to activate. It works for the directory it is in and all directories contained in it.
The environment is deactivated once we change the directory to something above it. This allows to easily switch between projects or analyses using different python versions (just by changing the directories).
Is there a way of achieving the same behaviour with (ana)conda?
Edit: added bash tag, because - as far as I understand - pyenv achieves this by hooking a custom script into .bashrc (which allows it to monitor the directory changes). If there is no build-in way in conda, how to create a script which would make it possible?
As mentioned in my comment, this is currently not supported. There is however an open issue on conda's GitHub asking for this feature.
In the meantime you could use autoenv, a small tool that'll automatically run the code in a .env file when entering a directory and that in a .env.leave when leaving the directory (supports bash/zsh and a couple others).
A simple example taken from their readme which illustrates the feature quite nicely:
$ echo "echo 'whoa'" > project/.env
$ cd project
whoa
To load a conda environment your .env would simply look like this:
conda activate <my_env>
Note 1: Check out the Configuration section of their GitHub readme before you start using it.
Note 2: The author of autoenv actually suggests trying direnv instead. However I've never used it, so I can't comment on it.
From autoenv's readme:
you should probably use direnv instead. Simply put, it is higher quality software. But, autoenv is still great, too. Maybe try both? :)
Web development is new to me and I'm trying to grasp the meaning and usage of environment variables once and for all. In my research the most simple explanation I've come across is that it is comparable to 'configuration settings'.
Through the terminal I've been exploring what feels like the computer's innards by typing printenv etc etc.
But I'm still not sure when it is necessary to set up env var. For example, I use fish as my shell. Often when I try to do an npm install it seems like the package didn't take. Here is a recent example:
user#iMac-van-user ~/P/v/v/public_html> npm install -g modernizr
/usr/local/Cellar/node/10.4.0/bin/modernizr -> /usr/local/Cellar/node/10.4.0/lib/node_modules/modernizr/bin/modernizr
+ modernizr#3.6.0
updated 1 package in 2.316s
user#iMac-van-user ~/P/v/v/public_html> modernizr
When I try to use modernizr as a command fish will tell me the modernizr is an unknown command and the color remains red. Valid commands show up in white in fish. Thus I have a suspicion that modernizr will only be available and valid once I've set up the configs. I've had this happen many times with various attempts to install package managers and things like composer, vue-cli, etc. My failures to get it working boils down to my meager knowledge of environment variables and what they do, I think.
This is from the documentation on the modernizr site: modernizr -c modernizr-config.json
Note that you will need to give the command line config the file path
to the configuration you downloaded from the site. In the above
example, we are running the modernizr command from the same folder
that we downloaded the modernizr-config.json file to.
What does the sentence: "Note that you will need to give the command line config the file path to the configuration you downloaded from the site" imply? I copied the file into my project folder but there is no change.
Is there is someone that can explain the following to me in layman's terms, so like you would to a 5 year old, it would be great:
use of environment variables
setting up configs - why, where and how (I've done it once through VIM)
how to know when to set up environment variables
Thank you in advance.
Developing on macOS 10.
GPUMlib comes with a filed called CMakeLists.txt instead of Makefiles or configure scripts. I do not see any build instructions and I do not see a list of packages that need to be installed in order to build GPUMlib even in the sources.
This answer assumes that cmake and gcc et al are already installed.
First install the CULA tools. Their documentation doesn't seem mention it, but their installer (which is barely mentioned in their FAQ) worked for me.
Once the installer finishes, it'll report some important shell variables, namely CULA_LIB_PATH_32, CULA_LIB_PATH_64, and CULA_INC_PATH. Take note of their values.
Invoke cmake with the shell variables reported by the CULA installer. Using me as an example, I installed my CULA tools at /home/john/projects/gpumlib/cula and cloned the gpumlib code into a directory called gpumlib-code so then my cmake command looked like this:
CULA_LIB_PATH_32=/home/john/projects/gpumlib/cula/lib CULA_LIB_PATH_64=/home/john/projects/gpumlib/cula/lib64 CULA_INC_PATH=/home/john/projects/gpumlib/cula/include cmake gpumlib-code
make -j 8
I wrote a bash script to do this for me which looks like this:
#!/bin/bash
export CULA_LIB_PATH_32=/home/john/projects/gpumlib/cula/lib
export CULA_LIB_PATH_64=/home/john/projects/gpumlib/cula/lib64
export CULA_INC_PATH=/home/john/projects/gpumlib/cula/include
cmake gpumlib-code
make -j 8
Thanks to Noel de Jesus Mendonça Lopes (the author of gpumlib) for helping me.