Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Signal acquiring C program does not work for DAQmxBase on macos using daq 6008

Solved!
Go to solution
Highlighted

Signal acquiring C program does not work for DAQmxBase on macos using daq 6008

So I am new to daqmxBase and daq .

 

What I want to achieve:

- To simply record voltage from the analog input channel of my daq device ( NI DAQ 6008 )

- Use a C program to do the same and compile it using  clang or gcc at the "terminal" of my macos

 

Software Details:

- macos High Sierra 10.13.3

- downloaded the nidaqmxBase 15 software for macos

 

C Program that I am trying to compile

http://www.ni.com/tutorial/5409/en/

- this code basically includes "NIDAQmx.h" which gives off an error so I changed it to "nidaqmxbase/NIDAQmxBase.h"

- also I changed all DAQmx functions to DAQmxBase functions

 

THE ERROR

- The C program simply would not compile and give the following error:

Undefined symbols for architecture x86_64:

  "_DAQmxBaseCfgSampClkTiming", referenced from:

      _main in daqmirror-da73d6.o

  "_DAQmxBaseClearTask", referenced from:

      _main in daqmirror-da73d6.o

  "_DAQmxBaseCreateAIVoltageChan", referenced from:

      _main in daqmirror-da73d6.o

  "_DAQmxBaseCreateTask", referenced from:

      _main in daqmirror-da73d6.o

  "_DAQmxBaseGetExtendedErrorInfo", referenced from:

      _main in daqmirror-da73d6.o

  "_DAQmxBaseReadAnalogF64", referenced from:

      _main in daqmirror-da73d6.o

  "_DAQmxBaseStartTask", referenced from:

      _main in daqmirror-da73d6.o

  "_DAQmxBaseStopTask", referenced from:

      _main in daqmirror-da73d6.o

ld: symbol(s) not found for architecture x86_64

 

 

I am new to C as well as the daqmxBase library so could you please suggest at to what is causing this error?

The code was directly copy pasted from the ni website and still it fails to compile.

Also, none of the examples compile . They too give the same error.

0 Kudos
Message 1 of 7
(1,012 Views)

Re: Signal acquiring C program does not work for DAQmxBase on macos using daq 6008

When you install the C API for NI-DAQmx Base, it also installs C examples here: /Applications/National Instruments/NI-DAQmx Base/examples

 

For example, to build the analog input examples, do:

$ cd /Applications/National Instruments/NI-DAQmx Base/examples/ai
$ make

...
$ ./acquireNScans

...

Joe Friedchicken
NI Modular Instruments Application Software
Get with your fellow OS users
[ Linux ] [ macOS ]
Principal Software Engineer :: Modular Instruments Application Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2016)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
Message 2 of 7
(989 Views)

Re: Signal acquiring C program does not work for DAQmxBase on macos using daq 6008

Thanks Joe ! I did exactly as you insisted.

The 'make' compiler did manage to compile all .c examples in the AI folder.

Then tried running each one of them one by one but it just fails to run!

It gives the following runtime error:

 

2018-02-22 11:25:18.628 acquireNScans[5455:826073] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'nextEventMatchingMask should only be called from the Main Thread!'

*** First throw call stack:

(

0   CoreFoundation                      0x00007fff47021fcb __exceptionPreprocess + 171

1   libobjc.A.dylib                     0x00007fff6dcc3c76 objc_exception_throw + 48

2   AppKit                              0x00007fff44d14faf -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 4167

3   LabVIEW 15.0 Runtime                0x000000010f7c1b91 WEventAvail + 833

4   LabVIEW 15.0 Runtime                0x000000010f55ba7e Exec + 1246

5   LabVIEW 15.0 Runtime                0x000000010f550f8a _Z16DoBackgroundExeci + 202

6   LabVIEW 15.0 Runtime                0x000000010f6e8e6a _ZN12BGAppTask_MG11HandleTasksEi + 138

7   LabVIEW 15.0 Runtime                0x000000010f6d9fe3 _ZN15BGAppTask_MacUI21CheckAndHandleBGEventEv + 51

8   LabVIEW 15.0 Runtime                0x000000010f6dcc6d _Z33BGAppTasksRunLoopObserverCallbackP19__CFRunLoopObservermPv + 301

9   CoreFoundation                      0x00007fff46fba127 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23

10  CoreFoundation                      0x00007fff46fba04f __CFRunLoopDoObservers + 527

11  CoreFoundation                      0x00007fff46f9c6c3 __CFRunLoopRun + 1267

12  CoreFoundation                      0x00007fff46f9bf43 CFRunLoopRunSpecific + 483

13  LabVIEW 15.0 Runtime                0x000000010f6d8387 _ZN19MainLoop_MacCocoaUI3RunEv + 279

14  LabVIEW 15.0 Runtime                0x000000010ea43a46 _Z6MGMainiPKPKc + 294

15  LabVIEW 15.0 Runtime                0x000000010ea4450d _Z11SysUIThreadPv + 13

16  LabVIEW 15.0 Runtime                0x000000010f83803e _Z15ThreadCoverProcPv + 94

17  libsystem_pthread.dylib             0x00007fff6eb3e6c1 _pthread_body + 340

18  libsystem_pthread.dylib             0x00007fff6eb3e56d _pthread_body + 0

19  libsystem_pthread.dylib             0x00007fff6eb3dc5d thread_start + 13

)

libc++abi.dylib: terminating with uncaught exception of type NSException

Abort trap: 6

 

 

The thing is I program mainly in Java , and i need to acquire I/O control over the NI Daq 6008 , therefore I am trying to wrap my head around the C programs so that i could write my own basic acquire signal programs and then use it in Java

I just need a proof of concept: The C program should read "9V" from the battery connected to my daq 6008 device.Once i can read and then output an analog signal to the daq device using a basic C program half of my work is already done!

0 Kudos
Message 3 of 7
(983 Views)

Re: Signal acquiring C program does not work for DAQmxBase on macos using daq 6008

0 Kudos
Message 4 of 7
(981 Views)
Solution
Accepted by topic author swapcool
02-22-2018 09:35 AM

Re: Signal acquiring C program does not work for DAQmxBase on macos using daq 6008


@swapcool wrote:

Another thread with the same error:

https://forums.ni.com/t5/LabVIEW/Labview-crashed-on-Mac-OS-X-Sierra-nextEventMatchingMask-should/td-...


Hmm... yes, this looks like a hard stop for you right now :-(

 

Until the internal implementation is updated to match the new OS X behavior, the C API cannot be used. I'll bring this to the attention of that team.

Joe Friedchicken
NI Modular Instruments Application Software
Get with your fellow OS users
[ Linux ] [ macOS ]
Principal Software Engineer :: Modular Instruments Application Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2016)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
Message 5 of 7
(967 Views)

Re: Signal acquiring C program does not work for DAQmxBase on macos using daq 6008

yes Thanks!

Looks like this is the end of road as of now..

Lets hope NI mends it soon..

Smiley Happy

0 Kudos
Message 6 of 7
(957 Views)

Re: Signal acquiring C program does not work for DAQmxBase on macos using daq 6008


@swapcool wrote:

 

Lets hope NI mends it soon...


The team is aware of this crash, and the lower level bug from the internal layer has been fixed. The next steps are to include those updates in the driver. I don't know their schedule, but it seems "soon" is reasonable for some values of "soon" :-)

Joe Friedchicken
NI Modular Instruments Application Software
Get with your fellow OS users
[ Linux ] [ macOS ]
Principal Software Engineer :: Modular Instruments Application Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2016)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
0 Kudos
Message 7 of 7
(954 Views)