08-27-2015 01:15 PM
Hello,
I have been working on this solution to getting a USB-6210 working with linux for some time now, i believe I am at a point where GCC is not able to successfully compile the example files provided to test the device. Here I will share my setup and then show my problem, please help!
CentOS 7 64bit (claims support for both 32 and 64, Closest to the latest redhat, yay budget constraints)
NIDAQmx Base 14.0.0 (recommended to my boss by one of your guys via email)
USB-6210 - purchased to match other labs for power usage data validation, so we can remove variables in reporting results (we have 8 of these, possibly intend to buy more)
installed these depencies first
used this reference for depencies after some troubles getting lsdaq to function
http://digital.ni.com/public.nsf/allkb/93C92D41B25341B286257A4D007BACB8
I am getting these errors when trying to compile
trying to compile the example from the nidaqmxbase/example/ai/ directory
cc -o acquire1Scan acquire1Scan.c
In file included from acquire1Scan.c:40:0:
/usr/local/include/NIDAQmxBase.h:83:1: error: enumerator value for ‘assert_line_83’ is not an integer constant
NIStaticAssert(sizeof(int32) == 4, "Error: This platform is unsupported because int32 is not 4 bytes.");
^
/usr/local/include/NIDAQmxBase.h:93:1: error: enumerator value for ‘assert_line_93’ is not an integer constant
NIStaticAssert(sizeof(uInt32) == 4, "Error: This platform is unsupported because uInt32 is not 4 bytes.");
^
Thinking this error might be because the code is meant for 32bit devices, i force the compiler to run in 32bit
cc -m32 -o acquire1Scan acquire1Scan.c
/tmp/ccyOyT4I.o: In function `main':
acquire1Scan.c:(.text+0xa8): undefined reference to `DAQmxBaseCreateTask'
acquire1Scan.c:(.text+0x10b): undefined reference to `DAQmxBaseCreateAIVoltageChan'
acquire1Scan.c:(.text+0x130): undefined reference to `DAQmxBaseStartTask'
acquire1Scan.c:(.text+0x193): undefined reference to `DAQmxBaseReadAnalogF64'
acquire1Scan.c:(.text+0x1d8): undefined reference to `DAQmxBaseGetExtendedErrorInfo'
acquire1Scan.c:(.text+0x1f2): undefined reference to `DAQmxBaseStopTask'
acquire1Scan.c:(.text+0x201): undefined reference to `DAQmxBaseClearTask'
collect2: error: ld returned 1 exit status
thinking i need to include the header and lib files i add these lines, but it does not change the output for 64 or 32 bit
cc -m32 -o acquire1Scan -B /usr/local/natinst/nidaqmxbase/lib/ -B /usr/local/natinst/nidaqmxbase/include/ acquire1Scan.c
searching through GCC documentation for help, i added the -mpc32 command, which " When -mpc32 is specified, the significands of results of floating-point operations are rounded to 24 bits (single precision);" http://linux.die.net/man/1/gcc. this compiles a file, but i am unable to do anything with it, compiling wrong?
It may just be my lack of skill with GCC and C++, but I have spent a lot of time working on this and could use a bit of help, thanks!
attached is niSystemReport and lsdaq
08-27-2015 08:04 PM
What happens when you use the Makefile?
cd /usr/local/natinst/nidaqmxbase/examples/ai
make
./acquireNScans
Joe Friedchicken
NI Configuration Based Software Get with your fellow OS users
[ Linux ] [ macOS ]Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
08-28-2015 10:27 AM
It looks like this workeded
[localadmin@FM73LAB054 ai]$ make
gcc -O2 -m32 acquireNScans.c -lnidaqmxbase -o acquireNScans
gcc -O2 -m32 acquireNScans-ExtClk.c -lnidaqmxbase -o acquireNScans-ExtClk
gcc -O2 -m32 acquireNScans-AnlgStart.c -lnidaqmxbase -o acquireNScans-AnlgStart
gcc -O2 -m32 acquireNScans-DigRef.c -lnidaqmxbase -o acquireNScans-DigRef
gcc -O2 -m32 contAcquire-ExtClk-DigStart.c -lnidaqmxbase -o contAcquire-ExtClk-DigStart
gcc -O2 -m32 contAcquireNChan.c -lnidaqmxbase -o contAcquireNChan
gcc -O2 -m32 loadAITask.c -lnidaqmxbase -o loadAITask
gcc -O2 -m32 acquireNScansThermocouple.c -lnidaqmxbase -o acquireNScansThermocouple
[localadmin@FM73LAB054 ai]$
08-28-2015 10:27 AM
cc -v -mpc32 -m32 -o acquire1Scan -B /usr/local/natinst/nidaqmxbase/lib/* -B /usr/local/natinst/nidaqmxbase/include/* acquire1Scan.c
worked to build one file
08-28-2015 10:29 AM
[localadmin@FM73LAB054 ai]$ ./acquireNScans
Acquired 1000 samples
data[0] = -0.000997
data[1] = -0.000997
data[2] = -0.001326
data[3] = -0.000997
data[4] = -0.001326
data[5] = -0.001326
data[6] = -0.001654
data[7] = -0.001983
data[8] = -0.002312
data[9] = -0.002641
[localadmin@FM73LAB054 ai]$
it looks like its working!
10-01-2015 09:13 AM
FYI, DAQmx Base 15.0 has been released, and included in it is support for 32-bit and 64-bit applications on CentOS 7. See this post: https://decibel.ni.com/content/thread/39138?tstart=0 for more details.
Joe Friedchicken
NI Configuration Based Software Get with your fellow OS users
[ Linux ] [ macOS ]Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)