Using NI DAQmx Base in openSUSE 64bit
Quick FAQ:
- Can I install “DAQmx Base” in a 64bit GNU/Linux OS?
Yes; despite National Instruments’ lack of interest. - Can it be installed in Ubuntu / Debian?
As far as I reached, only NI-DAK (the kernel driver), but not “DAQmx Base”. So, in short: you can’t. - Can I use it to compile my own C applications?
Yes, but only as 32bit programs. Even in a 64bit OS. - Why can’t I build 64bit programs? Shouldn’t it be easy to provide 64bit libraries?
Don’t know; ask NI.
1. Install NI KAL:
1.1. Prepare to build the kernel sources:
- You need a few packages to compile NI’s kernel driver module. Open a console, and execute:
1sudo zypper in kernel-devel kernel-source kernel-syms - Find out which kernel module you are running:
1uname -r - Change the directory to the /usr/src/linux-[VERSION] directory, where [VERSION] corresponds to the currently running kernel version.
- Run the following, replacing [VERSION] as corresponds to your system:
1234sudo suzcat /boot/symvers-[VERSION].gz > Module.symversmake cloneconfig # Configure sources for kernelmake modules_prepare # Prepare the headers for compilation
1.2. Install NI KAL
NI KAL is National Instruments’ Kernel Abstraction Layer (KAL). It is required before installing NI DAQmx Base or any other NI stuff.
- Get the latest version, NIKAL 2.4 as of October 2013:
http://joule.ni.com/nidu/cds/view/p/id/4459/lang/en - Extract the .iso file, for example, right-clicking on it and selecting “Extract”.
- Say you have now NIKAL contents in ~/Downloads/NIKAL24. Open a console and run:
12cd ~/Downloads/NIKAL24sudo ./INSTALL --nodeps
Accept the license and confirm the target directory to finish the installation:
- Recompile the module kernel, with:
1sudo /usr/local/natinst/nikal/bin/updateNIDrivers - Reboot, as you are prompted to.
- After rebooting, open a new console and check if the nikal module is correctly installed with:
12sudo modprobe nikalsudo lsmod | grep nikal
1nikal 93934 0
2. Install DAQmx Base
Installing DAQmx Base in a 64bit OS is not officially supported by NI, so a few extra steps are required. Here is the recipe:
- Download the latest Linux version of NI DAQmx Base. As of October 2013, it is version 3.7, and can be downloaded from:
For some obscure reason, there seems not to be one “central” web page where we can always get the latest version of DAQmx Base, or even knowing whether there exists a newer one. Sight.
- Save the
nidaqmxbase-3.7.0.iso
file, for example to~/Downloads
. - Open a console in the download directory and extract the ISO contents into a new directory named “DAQmx”:
12345mkdir DAQmx tmpsudo mount -o loop nidaqmxbase-3.7.0.iso tmpcp -r --no-preserve=ownership tmp/* DAQmxsudo umount tmprm -fr tmp
- Before installing NIVISA, we must patch the INSTALL script because the .rpm has some errors:
1234cd DAQmx/nivisa/chmod u+w . INSTALLperl -p -i -e "s/RPMOpts=--nodeps/RPMOpts=\"--replacefiles --nodeps\"/g" INSTALLperl -p -i -e "s/RPMOpts=\"\"/RPMOpts=\"--replacefiles\"/g" INSTALL
- Now, we can run the INSTALL script as root and NIVISA will get installed:
1sudo ./INSTALL
- At this point, you could try to launch niiotrace, but will find an error about missing libraries:
RUN THIS: /usr/local/bin/niiotrace
WILL SEE THIS: /usr/local/bin/niiotrace: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: No such file or directory - Fix the missing libraries:
1sudo zypper in libgcc_s1-32bit libstdc++6-32bit libXinerama1-32bit Mesa-libGL1-32bit - And if you launch niiotrace again now it should work:
1/usr/local/bin/niiotrace
- Now we can install the rest of DAQmx Base packages. We must do it “by hand”, one by one, due to some errors in the packages that force the usage of the flag “–replacefiles”:
12345cd ~/Downloads/DAQmx/sudo rpm -i nidaqmxbase-common-3.7.0-f0.i386.rpmsudo rpm --replacefiles -i nidaqmxbase-board-support-3.7.0-f0.i386.rpmsudo rpm -i nidaqmxbase-cinterface-3.7.0-f0.i386.rpmsudo rpm -i --replacefiles nidaqmxbase-usb-support-3.7.0-f0.i386.rpm - If everything went right (and remembered to reboot after the driver update!), you can run lsdaq and see the list of connected devices:
1lsdaq
1 2 3 4 5 |
-------------------------------- Detecting National Instruments DAQ Devices Found the following DAQ Devices: NI USB-6210: "Dev1" (USB0::0x3....) -------------------------------- |
3. Compiling programs with DAQmx Base
- Compiling 32bit C or C++ programs in openSUSE 64bit requires installing these extra packages:
1sudo zypper in glibc-devel-32bit gcc-32bit gcc-c++-32bit - You can test that everything works with some DAQmx examples:
12345cd && mkdir daqmx-examples && cd daqmx-examplescp -r /usr/local/natinst/nidaqmxbase/examples/* .cd aimake./acquireNScans - If you need to build some CMake-based project in 32bit, from your 64bit OS, just invoke cmake with:
1CXXFLAGS=-m32 CFLAGS=-m32 cmake [PATH_TO_SOURCES]