05-01-2009 03:37 PM
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
Solved! Go to Solution.
05-04-2009 08:24 PM
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?
05-05-2009 03:45 PM
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
05-06-2009 04:18 PM
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?
06-04-2009 12:27 PM
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
06-05-2009 09:38 AM
Good Morning Andy,
Thanks for posting an update. I am happy that you were able to figure out what was going on.
07-19-2011 05:49 PM
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.
07-19-2011 06:01 PM
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...