LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Library Function Node in Linux - Functions Not Found

Solved!
Go to solution

Hello,

 

I'm currently developing a VI in LabView 7.1 under Linux 2.6 (Fedora Core 6) which needs to call a Library Function that I have developed. I believe that there are no errors in either the code in the library nor in the way the VI is put together, but LabView simpy cannot use this library. Whenever I open my VI, it asks me to locate my library and when I point LabView to the library, it simply cannot open it; it will keep asking me where the library is. If I choose to ignore this and continue loading the VI, once I double-click on my Library Function Node and point LabView to the library the error I get changes from "Cannot load/find library" to "Library does not contain the function requested." I've coded the entire library in C and have built it as follows:

gcc -fPIC -shared -c EncoderLib.c

ld -G -o libencoder.so EncoderLib.o -lphidget21

 

Here, the -lphidget21 option is to link to a library that I'm developing a LabView wrapper for. While this is not the EXACT method mentioned in "Chapter 6: Using External Code in LabView," it is still quite close. I was unsuccessful at getting my library to compile in one statement. I am unable to locate the document I'm refering to right now, but I believe I got it somewhere on the NI website. Anyway- perhaps I'm linking or building this library incorrectly? I've checked to make sure that the library does indeed contain the function that I'm trying to call from LabView using the commandline function "nm" in Linux. The output is as expected:
$ nm libencoder.so
 *** TRUNCATED TO SHOW IMPORTANT PARTS ***
00000614 T NumEncodersAttached
0000053a T PollPosition
0000059b T PollRotations
000004e8 T SelectAxis
000005c6 T SetPosition

 

The functions listed are the functions that I'm trying to call, so they're all definitiely in the library and yet for some reson LabView cannot find them! I would just be tickled pink if anyone has any thoughts about how to fix this. If anyone has compiled and used a Library Function Node in Linux before, I'd love to hear about your experiance and if you had any problems. Has anyone run into this problem before?  Any and all help is greatly appreciated. Please let me know if I can offer any more information.

 

Thanks everyone!

- Andy 

0 Kudos
Message 1 of 8
(3,818 Views)

Good Evening Andy,

 

Thanks for the detailed post.  It seems that you are following the proper steps.  Have you been able to use any other libraries in a similar/the same manner on this computer?

0 Kudos
Message 2 of 8
(3,773 Views)

Hey Charlie,

 

Yes. I have indeed used a library before. I have, in fact, used an earlier version of this same library. Is it possible that I'm compiling incorrectly or could something in LabView be throwing an error when trying to open this file? Is there some preference I can check on or is there anywhere if I can find if an error is coming up?

 

Any help is appreciated. 

Thank you Charlie,

Andy 

 

0 Kudos
Message 3 of 8
(3,751 Views)

Good Afternoon Andy,

 

For that library to have worked as a previous version of itself, I would imagine that you are using the compiler properly (maybe just a bad compile?).  Is this new version adding features (that could be commented out for troubleshooting?) or streamlining what was there?

 

There are options for Error Checking in the Call Library Function Node (attached image).  Maybe this will help?

0 Kudos
Message 4 of 8
(3,729 Views)
Solution
Accepted by topic author Syn

Hey Charlie,

 

Linux does not offer any sort of Error Handling capabilities. Thanks for the good suggestion, though. I finally did figure it out. LabView was very, very unhappy with the toUpper function, despite the fact that it lives in the standard C library. I took out the function and the library worked like a charm. I don't know if this is a mistake made by my compiler (standard gcc for linux) or if it is an error in LabView, but either way it's surely something that users should know about. Hope this helps someone in the future.

 

Thanks for all the assistance, Charlie,

- Andy

0 Kudos
Message 5 of 8
(3,609 Views)

Good Morning Andy,

 

Thanks for posting an update.  I am happy that you were able to figure out what was going on.

0 Kudos
Message 6 of 8
(3,595 Views)

Hello,

 

I have LabVIEW 2010 for Linux and am running into the exact same problem. Here is a screen shot showing the error.

 

We developed a shared library that proved to be fully functional when called from a C application (i.e. the C executable loads the .so file and calls exported functions successfully). However, when we try to load the exact same shared library in LabVIEW (when configuring a Call Library Node), LabVIEW complains about not being able to find the file. The shared library file resides in the same folder as the VI file.

 

Has anyone else run into this problem and are there any additional suggestions as to why this might be happening?

 

Thx.

0 Kudos
Message 7 of 8
(3,211 Views)

OK, very odd.

 

For some reason LabVIEW chokes when the optimization flag is used. So, remove "-O2".

 

Answer was found here: http://forums.ni.com/t5/LabVIEW/Cannot-find-the-shared-library-on-linux/td-p/1421886

 

Seems like an important flag that LabVIEW should support...

0 Kudos
Message 8 of 8
(3,202 Views)