LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

HTTP Client - Failed to Load Library (Ubuntu only, fine under Windows)

Hi everyone,

 

I've been running into this same error for several years now, always managed to find a workaround before, but now I'm completely stumped. The problem is as follows.

 

I have a semi-large application developed under Windows (Windows 10, LabVIEW 2015 SP1), that also works under an Ubuntu Linux environment. When I release an update, I have to build the same application under Windows and Ubuntu separately. 99.9% of the time, this is fine. However, I now need to use the LabVIEW HTTP Client VI's to perform some queries to a web service. Under Windows, these work fine, but when trying them on my Ubuntu virtual machine (which has LabVIEW 2015 SP1 installed with all add-ons that were on the Linux LabVIEW DVD), I get the following error:


OS and Network Services:  (Hex 0x8ABC7021) Failed to load library.
Complete call chain:
     LabVIEWHTTPClient.lvlib:OpenHandle.vi:6450001
     http.vi

 

I have scavenged through all of the threads I could find concerning the topic and tried the suggested fixes, but to no avail. Tried reinstalling, tried creating a new symlink, reinstalling all add-ons, disabling my firewall, but no results whatsoever, still the same cryptic error message.

Any help would be much appreciated.

0 Kudos
Message 1 of 13
(6,058 Views)

Most likely one of the shared library dependencies is not correctly installed on your Ubuntu system. What Ubuntu version and bitness (32 bit or 64 bit) do you have? Which variant of LabVIEW did you install (32 bit or 64 bit)?

 

You probably have a 64 bit Ubuntu version and run a 32 bit LabVIEW version. That usually works but can cause problems for extra libraries since not every 32 bit library is likely installed by default in your system.

 

Generally speaking you have to find out which libraries the httpclient library depends on and then possibly find secondary dependencies of those libraries too. As far as I know httpclient itself uses libcurl and several other such open source libraries which should be installed by default together with LabVIEW. One of them might use other libraries that NI considers default libraries for Linux and does not include with the LabVIEW installer.

Or also a possibility you installed some other program in your Ubuntu system that came with it's own older version of one of those libraries and also manipulated the LD_PATH variable or created public symlinks for them, so that when the LabVIEW library gets loaded and asks for one of these libraries it gets served the old library which is missing a specific export that the LabVIEW provided library needs. As soon as a single import in a library can not be satisfied the loading of the entire library will eventually fail.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 2 of 13
(6,017 Views)

Hi martinusk,

I just wanted to confirm with you the troubleshooting steps you have already taken. When trying to create the simlinks, did you follow the method as described in the following KB article? http://digital.ni.com/public.nsf/allkb/9F305B6121FE69498625781D006EFA95  

Message 3 of 13
(6,013 Views)

Hi and thank you for your replies.

 

JustNI, yes, I tried the solution provided in the KB article you linked.

 

I am using Ubuntu 16.04 LTS (32-bit) under Oracle VirtualBox and LabVIEW 2015 SP1 (32-bit). The VM was created for one purpose only, which is building LabVIEW Linux applications. I have not installed any 3rd party software which would meddle with my LD_PATH or anything like that. Of course it is possible that something that was installed by default with my Linux installation is doing it...

 

I took a screenshot of my simple test-VI which utilizes the HTTP Client library, you can see it here: https://www.dropbox.com/s/zi7jl00ksv6618q/LV_Linux_deps.PNG?dl=0

Doesn't look like anything special to me, the files shown here exist in the specified /usr/local/natinst... directory. Should I use some other tactics to find secondary dependencies?

0 Kudos
Message 4 of 13
(6,006 Views)

That hierarchy helps nothing. The problem is not in LabVIEW but in one of the shared libraries. You will have to use the command line and use tools like ldd to list the dependencies.

 

Something like:

ldd httpClient.so

after you changed to the directory where this file is.

Then look at all the dependencies and try to find them on your system and do the same with each of them until you find the culprit.

 

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 5 of 13
(6,000 Views)

Right. I wrote a little script to recursively check lib dependencies, I have attached the output plus the actual file list for the directory.

 

I checked the symlinks in the directory and all the links were actually there - for example, "libmpr.so.4 => not found" actually links as such: "libmpr.so.4 -> libmpr.so.4.1.0", which is an existing file in the same directory.

 

I'm not very much at home with shared libraries under Linux, so I can't really make any conclusions from this output. All the files seem to be there, all the symlinks seem to be there to link older files to new ones. Could it be some kind of a permissions issue...?

 

I also started another VM with the same Linux version and did a fresh LabVIEW install on it, but to no avail.

Download All
0 Kudos
Message 6 of 13
(5,990 Views)

Hi Martin,

 

While I'm not very familiar with shared libraries in Linux, I did some digging after reading your ldd output. It seems like the fact that it isn't finding the links even though they are there could be the source of your problem. After doing a bit more research, it seems that this can happen for a variety of reasons. A few people have fixed this issue by running ldconfig to create the necessary links. For more information on ldconfig, please see the man page:

https://linux.die.net/man/8/ldconfig

 

Can you try running that and then re-verifying the ldd output?

-Justin

Message 7 of 13
(5,954 Views)

Hi JustNI,

 

Thanks for helping me dig around. I tried the ldconfig approach and while it actually seems to have helped to some extent (some "not found" lines are no more present as seen in the attachment and the ones remaining seem to be user interface-related), there is no difference in LabVIEW itself; I still get the exact same error message when trying to use the HTTP library. Naturally I also tried restarting the system after relinking the libraries, restarting LabVIEW, trying the relink when LabVIEW was not running, relinking while running, you name it.

 

This is all such a fuss that it really seems a nightmare integrating it into an installer for my application on a live system. Unfortunately, I'm quite out of options here, other than running the application in a Windows environment only OR scrapping the whole new functionality, and neither of those options is desirable right now.

0 Kudos
Message 8 of 13
(5,940 Views)

The problem is not likely inside the /usr/local/natinst/LabVIEW-2015/resource/

folder itself! These are libraries that NI installs during LabVIEW installation and are only really used when you execute your program inside the LabVIEW IDE.

 

But these libraries are not self contained. Most of them rely on system libraries such as libc, and various other ones that are USUALLY present on any reasonable Linux distribution but there is no guarantee about that, thanks to the very varied world of Linux. That is one of the reasons one can not simply develop an application for Linux and then say it will work on every Linux distribution. Each distribution has its own ideas about what tools it packs into the main system, and accordingly what dependencies get installed alongside with them and in what version.

 

You will likely have to start at libni_httpClient.so and list its dependencies, then find each of them, which could be anywhere in /usr/lib and even the system /lib directory and possibly in other directories that your distribution might add to the /etc/ld.so.conf file to search for additional libraries. Then list all dependencies of each of those files too and continue like that until you found them all. One of them is likely not present.

 

If you can't find any dependency that is not present, you might have a more complicated problem that one of your system libraries really is an older (or sometimes newer version) than what the NI libraries where build against and is missing a particular exported function.

 

All this is the Linux version of DLL hell, as you can encounter it on Windows too. While the Linux ELF standard tries to avoid some of the problems that cause DLL hell on Windows, it is basically completely helpless against the diversification of the Linux world and bad discipline of library developers, who often forget to do a sensible versioning for their libraries or even worse, discontinue or change APIs at their whim. 

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 9 of 13
(5,935 Views)

I did some extensive digging and could not find anything - all the deeper dependencies seemed fine, all the libraries that were linked to outside the LabVIEW resource folder (system libraries) seemed in order and nothing was reported missing.

So it seems kind of hopeless, really - a lot like the Linux version of DLL hell you described. Something is missing or configured wrong, but finding out the exact root cause is beyond me - looks like I have to give up for the first time during my 10+ years of LabVIEW conquests. 🙂

 

Of course, Ubuntu Linux is not specifically supported by LabVIEW and so I probably can't complain; but it just seems unusual that something is so difficult to debug. Thanks for helping, I'll leave this thread open just in case someone discovers a breakthrough at some moment.

0 Kudos
Message 10 of 13
(5,903 Views)