LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

"unable to open resource files"

I'm trying to execute a LabVIEW executable application from a simple C program, but I keep getting the error message "unable to open resource files". The Labview application runs fine if I just execute it from the command line, but from a C-program it doesn't. I've tried the execl() function, and I've also tried to open the labview runtime dynamic libraries in the C program using uselib(), but without success. Does anyone have any ideas on this? I'm running Linux kernel 2.4. Thanks in advance!
0 Kudos
Message 1 of 5
(6,762 Views)
Hello Marnix,
The reason for this may be that the computer is not searching the correct directories when the application is called. To change this, you will need to specify the LabVIEW directory as one of the default directories to search. Make the following changes while logged on as "root".

Edit the file /etc/ld.so.conf using a text editor. Add the path to the LabVIEW directory. For example, if LabVIEW 6.1 was installed in the default directory, add the line /usr/local/lib/LabVIEW-6.1.

Run the ldconfig command to update the dynamic linker. The command is ldconfig -v. The -v (which stands for verbose) is optional and is used to check if liblvrt.so.6.1 is found.

Let me know if this helps.

Erik vH
Applications Engineering
National Instruments
0 Kudos
Message 2 of 5
(6,762 Views)
Hi Erik,

thanks for the quick reply. I'm afraid it doesn't solve the problem though... I checked /etc/ld.so.conf, and the line you specify was already there. The directory it points to exists, liblvrt.so.6.1 is in it. Running ldconfig poses no problems either...
What surprises me most is that the app does run from a shell command. Also if this shell command is given from within the C-program, for instance with system(), or by calling a script file that calls the app...
0 Kudos
Message 3 of 5
(6,762 Views)
You might have success using "strace" to find out what files labview is looking for and not finding.

My best guess is that LabVIEW cannot find the resources in the executable itself. The way that it works normally, is that when you run the LabVIEW executable, it actually tries to open the executable itself (ARG[0]) to pull out resources. If the exec system call is somehow giving a bogus ARG[0] (either pointing to the wrong executable, or a bogus path), then I could see this failing.

I've created an example that "works for me."
Message 4 of 5
(6,762 Views)
Hi David,

thanks very much for your suggestion; At first your program didn't work either, and using strace I found out that indeed it couldn't find something: my own program! I forgot to put the './' in the second argument of exec (arg[0])... So it was looking in all the wrong places 😕
Guess I was thrown off-track by the error message, thought it had something to do with the libraries...

So thanks a lot!!
0 Kudos
Message 5 of 5
(6,762 Views)