LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Running executables with no display

Highlighted
I'm running an executable built using the Application Builder, under Linux.  I would like to be able to run it with no display (it is control software for a remote system, there is usually no-one logged in).  Is there any way to do this?  If you run the executable via a non-graphical shell login you get "Unable to open X display".  Do I need to have a dummy user logged in permanently and export the DISPLAY variable to point at their session?  Or is there a cunning way of changing the settings of the Application Builder to avoid this?

Cheers,
Tom

0 Kudos
Message 1 of 4
(1,407 Views)
Highlighted
Hallo Tom,

there is on option in the advanced settings of the execution builder this is called "use embedded version of run-time engine" in the linux version of labview.
If you use this option your application need no X-Display.

Michael
0 Kudos
Message 2 of 4
(1,372 Views)
Highlighted
Great, thanks!  Seems to work fine on the simple VI that I have just tested.

For the benefit of anyone else attempting the same thing, here is how I got this to work:

1) create a build specification for a shared library and select the "embedded runtime" option (this option is sadly only available for shared libraries, not if you are building an executable).  Make sure you add at least one method/function to the prototype/interface - for many applications this will simply involve adding your top level VI and accepting the default settings of void myViName()

2) Make sure you have the requisite libraries on your machine. On Ubuntu Edgy Desktop this involved "sudo apt-get install libc6-dev" and "sudo apt-get install build-essential"

3) hit Build in Labview

4) Write a simple C++ program to call your shared library.  Mine looked like this:

#include "libWriteText.h"
int main()
{
        WriteTextFile();
        return 0;
}


Save this as whatever.cpp in your build directory (set in your labview build spec), which should be full of stuff created by labview.  Here, libWriteText.h was the name of the VI-specific header file that labview created, and "WriteTextFile" was the name of the function that I declared in the "Prototypes" section of the build spec.

5) run "g++ -o myTestProgram writeTextFile.cpp -L. libWriteText.so /usr/local/natinst/LabVIEW-8.2/AppLibs/liblvrtdark.so.8.2.1" from the command line in the build directory.  This builds an application out of the C++ file you have just written, the shared library created from your VI and the "dark" (i.e. no display) labview runtime library.

6) run your application.  You will probably have to sort out your ld paths first - either add the new library to /usr/lib and run "sudo ldconfig" or run "export LD_LIBRARY_PATH=/path/to/my/new/library" before executing your app.

0 Kudos
Message 3 of 4
(1,320 Views)
Highlighted
The lvrtdark library use libstdc++ version 5, so make sure you link against this rather than version 6.  I found that the easiest way was to use gcc_3.3 instead of g++ (version 3.3 of gcc was the last to use libstdc++ v5).
0 Kudos
Message 4 of 4
(1,272 Views)