How to compile using uclibc? - configuration

Hi all I have installed buildroot toolchain and am able to compile simple "Hello World" program which runs on uClibc based chroot. However I am confused how to do so for programs that use ./configure as how to ask it to use the uclibc based toolchain and not the glibc based toolchain present in my system.
My OS is Fedora and it is i386 based machine.I want to compile programs using uClibc for the same platform.

buildroot contains the package directory where there are numerous examples how to do it

Just set CC=PATH_TO_BUILDROOT_UCLIBC_GCC etc.
And you don't need to use chroot:
xxx/buildrootxxx/output/host/bin/xxxxx-gcc works fine, it would search the headers and libs in its own directory (like xxx/buildrootxxx/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/*)

Related

nvcc not found but cuda runs fine?

I was trying to run nvcc -V to check cuda version but I got the following error message.
Command 'nvcc' not found, but can be installed with:
sudo apt install nvidia-cuda-toolkit
But gpu acceleration is working fine for training models on cuda. Is there another way to find out cuda compiler tools version. I know nvidia-smi doesn't give the right version.
Is there a way to install or configure nvcc. So I don't have to install a whole new toolkit.
Most of the time, nvcc and other CUDA SDK binaries are not in the environment variable PATH. Check the installation path of CUDA; if it is installed under /usr/local/cuda, add its bin folder to the PATH variable in your ~/.bashrc:
export CUDA_HOME=/usr/local/cuda
export PATH=${CUDA_HOME}/bin:${PATH}
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:$LD_LIBRARY_PATH
You can apply the changes with source ~/.bashrc, or the next time you log in, everything is set automatically.
As #pQB and #talonmies above mentioned you only need to install the GPU drivers (Versioned 430-470 these days) to use PyTorch. If you are using your GPU display port you should be fine.
For Cuda compilation tools you need to install the whole toolkit, which includes the driver as well. If installing manually from CLI the downloaded file, CLI will give you the option to choose the components to install or skip.
Generally, it is recommended to install the compilation tools (which are system wide) and GPU drivers together because it avoids compatibility issues.
Append:
export PATH="/usr/local/cuda/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda/lib64:$LD_LIBRARY_PATH"
to
~/.bashrc
Note: your path to cuda may include a version so navigate to /usr/local/ and check for cudaXX.XX and modify the command to point to that in ~/.bashrc

Best solution to have multiple CUDA/cuDNN versions installed on Ubuntu

I am using Conda on Ubuntu 16.04. My objective is to associate each Conda environment to a specific version of CUDA / cuDNN. I had a look around and I found this interesting article, which basically suggests to put different CUDA versions into different folders and then use an environment-specific bash script (run when the environment is activated) to properly set the PATH/LD_LIBRARY_PATH variables (which creates the association with the CUDA version).
This is fine, but when I try to install frameworks such as pytorch using Conda, it forces me to install also the "cudatoolkit" package.
So, a couple of questions:
1) does downloading cudatoolkit mess up my previous CUDA configurations? which version will be used?
2) if using Conda is possible to install "cudatoolkit" and also "cudnn", why not just using conda for everything? Why even needing to apply the instructions of the above mentioned article?
Thank you.
As an answer to the first question, no, downloading and installing another CUDA toolkit won't mess up other configurations. From CUDA toolkit installer, you specify an installation directory, so just pick whatever works for you that is unique to that CUDA version. This won't affect any currently installed CUDA versions. A Pytorch install will look for a CUDA_HOME environment variable as well as in '/usr/local/cuda' (the default CUDA toolkit install dir.), so it's just this environment variable that needs to be changed.
I can't speak for the second part. Perhaps the installation using Conda will use the default installation directory for the CUDA toolkit (seems silly but this is just speculation).

Can't make cuda sample: Makefile:36: findcudalib.mk: No such file or directory

My problem is that I cannot compile a CUDA example. I believe I've got CUDA 4.0 installed correctly ( I need the old version b/c I'm trying to run GPGPU-Sim). I downloaded an NVIDIA cuda sample, namely conjugateGradient. If I cd to it and run
make
it doesn't work:
macair93278:7_CUDALibraries r8t$ cd conjugateGradient/
macair93278:conjugateGradient r8t$ ls
Makefile main.cpp
macair93278:conjugateGradient r8t$ make
Makefile:36: findcudalib.mk: No such file or directory
make: *** No rule to make target `findcudalib.mk'. Stop.
I've changed my path so that running
nvcc -V
doesn't produce an error, but gives me the version. So I think that's right.
Thanks for any help.
-bb
findcudalib.mk is missing because the individual sample you downloaded is not designed to be a complete, standalone sample. It requires a framework of other files and probably other libraries that need to be built around it.
To fix this, download the CUDA 4.0 SDK (GPU Computing SDK) from here.
Install that package. Once you have installed it, and assuming your CUDA install is otherwise intact, you should be able to change into the toplevel directory and issue make. This will build all the samples. For convenience, you may wish to issue make -k.

How to configure Xcode to compile not supported language, e.g. Fortran?

I would like to use Xcode under Mac OS X to compile and run a program written in a language that is not supported, e.g. Fortran. Assuming I have a compiler installed, e.g. gfortran or ifort, what are the steps in the Xcode project settings to make it possible to compile and run the program?
I have created an new, empty project since Fortran is not supported (only C,C++,Objective-C and Swift are selectable in a command line tool application). I created a simple Fortran file. But now I guess I have to add several things to the Builds tab in the project settings to make it compile and run (it works from the command line). What are these steps?
Add an external build system target to your project. External build system targets/projects let you build projects in languages Xcode doesn't natively support. The external build system target/project is in the Other section under OS X on the left side of the assistant. When you click the Next button, you'll be asked for the location of the build tool. Enter the path to your Fortran compiler. When you build the project, Xcode will use the Fortran compiler to do the building.

how to build hxselect with mingw?

I downloaded html-xml-utils-6.5.tar.gz and started compiling hxselect.c with mingw. I need a makefile, but the package is designed to generate the makefile. The build instructions are in a configure script, config.h.in file and makefile.in.
Is there a mingw-compatible tool to help generate the makefile? I am considering making a linux machine so I can run the configuration to get the generic makefile, and then bring that back for mingw to start chewing on...
Is there an easier way?
Thanks !
Assuming you've downloaded and installed mingw from [1], launch the MinGW Shell
from the start menu and then cd to directory containing the configure script and proceed as you typically do with autotools based projects:
./configure
make
make install
The purpose of MinGW is in fact to make available to Windows a minimalistic GNU environment (meaning shell and other tools) which allow you to work (mostly) as you would in an operating system with a full-fledged GNU userland (such as GNU/Linux). Occasionally it seems that MinGW is used to denote the windows port of the gcc compiler, but it should be empathized that MinGW actually denotes the Windows port of a (minimalistic) GNU environment.
[1] http://www.mingw.org/