LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

daqmx base and gtk

Am basically trying to do some data acquisition on my redhat machine. I installed daqmx base from the Ni web site and chose to use the C Api wrapper for my data acquisition. When the installation was completed. there one new directory /usr/local/natinst which had 3 sub directories - nidaqmxbase , nikal, and nipal.
 
I went ahead and tried the analog input example in the /usr/local/natinst/nidaqmxbase/examples/ai. It worked fine. However for my application I require to display the daq values in a graphics interface, hence am using a gtk program. My code just has one large program with code for both the data acquisition and graphics. This is my make file.
 

nilibs=-lnidaqmxbase -lnidaqmxbaselv -llvrtdark -lserial
includes=-I../../include
includes1= `pkg-config --cflags --libs gtk+2.0`
flags= -O2
cc=gcc

ai_examples = sergra
     
all : $(ai_examples)

% : %.c
      $(cc) $(includes1) $(includes) $(flags) $< $(nilibs) -o $@

clean :
      rm -f $(ai_examples)

The code works fine !! no errors whilst compiling  but when I try to run my program I seem to get an error.

 

 

ERROR! The LabVIEW RunTime Engine failed to initialize correctly.
This is usually caused by linking applications incorrectly.
Please see the AppLibs/README.shlibs file in the LabVIEW directory for
instructions on building programs using LabVIEW-built shared libraries.

Error initializing LabVIEW shared library (error 1)

 

 

I understand that my c code is just a wrapper. But I dont have a labview directory and I am not able to understand whats up with the linking.Anyone got any ideas??!!

 
 
0 Kudos
Message 1 of 14
(4,064 Views)

Hello-

The file in question should actually appear in the "/usr/local/lv71/AppLibs" directory on your drive.  The file (I have attached to this message) seems to describe the problem you're seeing- that the application will link correctly but will crash unexpectedly due to a bug in some versions of Solaris and RedHat Linux.  I had to change the extension to ".txt" to get the forum software to allow the attachment to pass.

Please take a look at this file and let us know if you're still seeing problems.

Thanks-

Tom W
National Instruments
0 Kudos
Message 2 of 14
(4,038 Views)

Tom,

Thanks for your quick response. My situation is almost the same but not quite! When I installed daqmx base I had installed NI-VISA, all the other tools and the C API. But I reckon labview was not installed since I do not have the  directory."/usr/local/lv71/AppLibs" . I was also unable to find the files SharedLibs.so,folders cintool or lv61.  Also my program does not make direct use of labview but uses the C API. I know my C program is just a wrapper and it has labview underneath it. I am assuming it is accessed somewhere from /usr/local/vxipnp/linux. I have a choice of reinstalling daqmxbase (with labview). But am not sure I need to do that as I am able to aquire data with my current status.Hope I have given you a sufficient background to help me.

 

Thanks,

Prem

 

 

0 Kudos
Message 3 of 14
(4,025 Views)

Hi Prem-

You may indeed need to have LabVIEW installed in order to work with your graphical interface because certain variable type libraries are necessary that are not included with the NI-DAQmx Base driver directly.  The driver itself is written in LabVIEW, so even though you are using the C interface the LabVIEW RunTime engine will still be running all of the interfaces.  The graphical front end you are using seems to have difficulties interfacing with the RunTime engine, so these additional libraries are needed.  It sounds like your non-graphical approach is working fine, so the hardware and programming seem to be in line.

After installing LabVIEW you will need to reinstall the DAQmx Base driver and then modify the search directory suggested by "gcc -o myapp myapp.c -I/usr/local/lv61/cintools SharedLib.so -llvrt -lpthread" to reflect your version of LabVIEW (i.e. lv71 for LabVIEW 7.1).  The necessary files should then be included.

Please let me know if you still aren't able to compile after taking these steps and I will investigate further.

Thanks-

Tom W
National Instruments
0 Kudos
Message 4 of 14
(4,010 Views)
Tom, Prem:
 
This error is ocurring because the DAQmx Base driver is trying to access the runtime engine but cannot find it.  This is due to the way that you are pointing to the DAQmx Base libraries.  In the example code's makefile you can point to these libraries using the following line:
includes = -I../../include
 
This works because the examples are in the /usr/local/natinst/nidaqmxbase/examples/ai directory. 
 
On the other hand, your application should be in a different folder, so you have to reference this directory explicitly.  If you change the include line in your makefile to the following:
includes = -I/usr/local/natinst/nidaqmxbase/include
 
it should work properly.
David Staab, CLA
Staff Systems Engineer
National Instruments
0 Kudos
Message 5 of 14
(4,001 Views)

David, Tom..

Sorry about the delay but I wanted to try out both your suggestions. Davids suggestion about refering to the correct directory does not seem to work. My application is in /root/Desktop/wcp . So I tried to refer to the correct directory as -T../../../usr/local/natinst/nidaqmxbase/include. I am still getting the same error( it is worth mentioning that the only file in this directory is nidaqmxbase). I tried toms technique. uninstalled nidaqmxbase, installed lab view and then reinstalled nidaqmxbase. I aslo went through the readme you had suggested. From it I gather that  my include is -I../../../usr/local/lv71/cintools ( going by current directory. ) I also included -llvrt and -lpthread as my nilibs . I however could not find the file sharedlib.so ( or are we creating it ?) . I am including my make file for reference. I still do get the same error.

 

nilibs=-lnidaqmxbase -lnidaqmxbaselv -llvrtdark -lserial -llvrt -lpthread
includes=-I../../../usr/local/lv71/cintools
includes1= `pkg-config --cflags --libs gtk+2.0`
flags= -O2
cc=gcc

ai_examples = sergra
     
all : $(ai_examples)

% : %.c
      $(cc) $(includes1) $(includes) $(flags) $< $(nilibs) -o $@

clean :
      rm -f $(ai_examples)

0 Kudos
Message 6 of 14
(3,983 Views)

Hi Prem-

I do not see in your makefile where you reference the directory suggested by David.  Are you able to see better results by referencing the directory directly as suggested by David rather than using the relative path structure "-T../../../usr/local/natinst/nidaqmxbase/include" ?

 

Tom W
National Instruments
0 Kudos
Message 7 of 14
(3,962 Views)

Tom,

I have tried davids method it does not work. Besides the error message says the runtime engine failed to initialise. Davids include points to just one file nidaqmxbase.h .

0 Kudos
Message 8 of 14
(3,956 Views)
Hi Prem-
 
After testing we were able to compile projects in locations other than the examples directory using the directory location as specified in the attached makefile.  I do not have access to testing with gtk, but this method compiled and ran successfully at the command line.  Please take a look- I added back in the gtk includes as you showed in your last post.
 
Thanks-
Tom W
National Instruments
0 Kudos
Message 9 of 14
(3,938 Views)

Tom,

I undertstand what your saying. I just have now more question. In the readme file that you mentioned ....there is a file called sharedlib.so ....where is this file if it exists...because it is not there on my system

0 Kudos
Message 10 of 14
(3,920 Views)