LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CVI on Linux, a few observations

Hello all,

I've been using CVI on Linux for some time and I like it. Here are a few
observations:

- keep working on it, as there's plenty of future for it. In our (big) lab,
the codewords now are "if you can do it in Linux, do so" and "no Vista
allowed".

- please work out the licensing issues. We have a site license for all (?)
NI software (including LV for Linux and the real-time modules), and I just
received the latest installment, but cvicc is still missing from it (or it's
really really well hidden). I had to have our local rep send it to us
directly.

- will it be possible to someday develop the UIR file under Linux so we can
get rid entirely of the Windows paperweight ?

- Since a Makefile is required (?) if you want to debug your program in
KDevelop, there should be a quick .prj to Makefile converter, even if it
doesn't need to compile anything. Maybe make it automatic when using
the -debug option. And BTW, since you already choose
[Build][Configuration][Release] or [Debug] in the IDE, why do you need to
specify it on the command line ?

- Why is the -rebuild option necessary ? Since the prj file contains the
whole tree structure, a simple look at the file dates should be enough to
determine what needs to be compiled.

- Bug: [Shift][Tab] in the UIR doesn't move back to the previous control

- Bug: UInt64Type used in GetDiskSpace() doesn't seem to be defined anywhere

- Bug: EVENT_PANEL_SIZING doesn't seem to be defined anywhere (maybe because
I have 8.1 on Windows and 8.0 on Linux)

- Bug: GetDiskSpace which is part of toolbox.h doesn't seem to link properly

- Is there a list of compiler defines specific to cvicc ? I've seen
_NI_linux_ but I'm sure there are several others.

- If I work on an SMB mounted drive, I always get errors such as this:
Compiling MetaCycles.c...
Calling external compiler...
1, 0 Error writing file "/nEDM/AcqEDM/cvibuild.AcqEDM/MetaCycles.nidobj"
(File access permission denied)
But I have no problem 'touch'ing the niobj file manually.

- Is cvicc based on gcc and as such can receive extended options ? (I doubt
it).


There were several other issues I seem to have forgotten C:-(
--
Guillaume Dargaud
http://www.gdargaud.net/



0 Kudos
Message 1 of 14
(5,202 Views)
To my mind, improvements in debugging on Linux are more importatant than getting the UIR editor to run on Linux. 

If you install VirtualBox and set up a Windows Virtual Machine, using its "seemless" mode you might be fooled into thinking the UIR editor was running on Linux.

But if the product to go really go anywhere, the installation and basic usage instructions need to be much improved.  Compiling the kernel modules will always have a distribution dependency, but the rest is just a matter of copying files to the "right" places with the right permisions and making some symlinks.  I installed on Ubuntu by converting the rpm files to deb files using "alien --to-deb --scripts *.rpm" after copying the rpm files to a writable directory from the CD.

While various "Linux Standard Base" conformance schemes are good in theory, I've always thought any software application that can't be "installed" by simply copying the top level directory was broken by design.  Clean up the product so everything is under a natinst top level directory directory and a tgz unpacking and set of the path to the execuatables is all that would be needed for any distribution.

Top priority is maintaining currency with the Windows version, the Linux runtime is already two releases behind!

--wally.

0 Kudos
Message 2 of 14
(5,184 Views)
your observations sound promising, Guillaume,
I've just not come around to give it a try, so far (as my employer is unfortunately a die-hard windoze-only company, which will probably not change in the near future).
anyways, I also believe there _is_ a big potential for CVI on linux, so I just want to encourage NI to continue this path.

--
Once the game is over, the king and the pawn go back into the same box.
0 Kudos
Message 3 of 14
(5,163 Views)
I'm trying to understand how to debug interactively on Linux. On a first
attempt a couple months ago I managed to get it to work a bit at random but
I can't really replicate now.

cvicc -rebuild -debug Project.prj
kgdb ./Project

It kind of works: I can step in the main program, set breakpoints, view
variables, etc... The problem is that it only works in the main .c file. I
have plenty and it won't go in them. I don't know how I'm supposed to give a
list of c files to the debugger to consider.

Couple months ago I managed to create a KDevelop project out of a CVI
project and although I couldn't (and I had no intention to) compile it with
KDevelop, I could run and debug the executable fine. I don't remember if I
did this by playing with the various KDevelop project types or by writing a
basic makefile that was then used as a reference by the debugger.

***

Now onto a current linux specific bug (?):
I have some panel callbacks that force a panel dimension:

case EVENT_PANEL_SIZE:
SetPanelAttribute(panel, ATTR_HEIGHT, 100); // Keep height constant
GetPanelAttribute(panel, ATTR_WIDTH, &Width);
SetCtrlAttribute(...); // Various ctrl settings and moving
break;

This behaves very strangely under Linux: it loops and the width of the panel
grows and shrinks randomly !

Note: I'm running from an X-server, so maybe X sends random dimensions, but
If I don't force the height, I don't have the problem. So does setting the
height trigger a new call to the panel callback with EVENT_PANEL_SIZE event
?!?
--
Guillaume Dargaud
http://www.gdargaud.net/



0 Kudos
Message 4 of 14
(5,152 Views)
Gahhh, as usual, right after crafting a long message to a group, you find
the obvious solution:

After launching
kdbg ./Executable

Just do [File][Open source], type *.c and [OK]
It will then display the correct file as you step into functions.

The debugger is a bit rough compared to the CVI IDE but it's quite usable.
--
Guillaume Dargaud
http://www.gdargaud.net/


0 Kudos
Message 5 of 14
(5,152 Views)
Thanks for the tip about how to use kdbg, it'll be very useful to me!

--wally.

0 Kudos
Message 6 of 14
(5,143 Views)
Sorry, I keep finding bugs in CVI Linux 8.0:
- Timer() does not work (always returns 0)
- DisplayPanel() does not bring the panel to the front (at least on a remote
X-windows session)
--
Guillaume Dargaud
http://www.gdargaud.net/
"Aiming for the least common denominator sometimes causes division by
zero."


0 Kudos
Message 7 of 14
(5,135 Views)
Hello all,

Here are a few explanations (& questions) on some of the above issues.

-re: requiring -debug or -release on the command line
cvicc is built using the same source as the comple.exe utility from Windows. Neither tool reads the workspace .cws file which is where the debug  versus release configuration info is stored. The Windows version was envisioned to be a tool used in an automated release build where you would not want to pick up the environments last saved configuration, you would most likely want to specify on the command line which to build.

-re: the -rebuild option
The -rebuild is used to prevent the cvicc from doing a dependency check, possibly because the file dates have changed. A prime use case would be if you used the same physical source tree on a dual boot linux/Windows machine; after you built on Windows and then rebooted into linux, the object files look up to date, but they are Windows format files that cvicc won't recompile which then get passed to the linux linker which has no idea what the object files are and generates link errors.

-re: [Shift][Tab] bug
In general this works, what distribution/window manager are you using?

-re: GetDiskSpace link bug
The toolbox function GetDiskSpace is implemented on top of the Win32 SDK function GetDiskFreeSpaceEx and is located within a ifdef for _NI_mswin32_.

-re: UInt64Type
The definition for this type is in toolbox.h inside a _NI_mswin32 ifdef.

-re: EVENT_PANEL_SIZING
This feature was introduced in CVI 8.1.

-re: other predefined macros
_NI_unix_ is also defined.

-re: SMB file access error
Windows file systems have several more permissions differences from unix file systems. The ability to modify a file is separate from the ability to delete or create a file. When cvicc calls gcc to compile the file it is going to delete the old object file and then try to write a new file. This could be why 'touch'-ing the file succeeds, but compiling it does not.

-re: cvicc and gcc relation
cvicc is implemented as a wrapper that reads the project file, determines which files to compile, uses gcc to compile, determines what things to put in the link, and then used ld to do the final link and create the output binary. You can add addition link libraries to the cvicc with the -llibname option that gets passed to ld. If you want to change the gcc compile options you can edit the file /usr/local/natinst/cvi80/bin/compile.ecc This is a external compiler support (from Windows) file that was customized for linux. The line with COMPFLAGS gets added to the command line that compiles each .c file into a .o file The line with LINKFLAGS get added to the command line that performs the final link.

-re: odd EVENT_PANEL_SIZE and ATTR_HEIGHT behavior
The call to SetPanelAttribute should not be generating a user event. It specifically calls an internal function with NoUserEvent in its name. One possibility I can think for this behavior is that your window manager might be intercepting our size call and changing the size that we are asking for. If this is the case then it would probably send a new size event to the window.

-re: DisplayPanel not bringing window to front
As part of creating and showing the underlying XWindows window we call the X function XRaiseWindow. This function should bring the window to the top of the Z-plane unless something else (like a window manager) asked to do an override on our window and disallow the Z-plane change.

-re: Timer always returns 0
The Timer function is implemented on the system function gettimeofday. The most likely cause of failure for this function is the timezone not being set on the system.


Michael
NI
Message 8 of 14
(5,106 Views)


@Michael H. wrote:
Hello all,

Here are a few explanations (& questions) on some of the above issues.
...
-re: EVENT_PANEL_SIZING
This feature was introduced in CVI 8.1.
...

Michael
NI


This is the single largest factor that will prevent the Linux Runtime from succeeding.

CVI is at 8.5 now, so we are two versions behind already!

My use of CVI for the past 7 years has been creating user interfaces on WIndows that connect to a network client on Linux which controls real-time hardware.  It has  worked great.  But for my latest project serious performance improvemnet are gained by eliminating the network latency -- the CVI runtime for Linux is a godsend at this moment.  However, other times the client server model is a necessity and if the Clinet providing the UI is on Windows or Linux won't matter, but I don't have to maintain Windows boxes running the clinets, only the Linux boxes, so being able to target both systems is also very important to me, but the Linux runtime keeps me from using the Windows bugfixes and improvements unless I'm willing ot break portability.

--wally.


0 Kudos
Message 9 of 14
(5,080 Views)
A coworker just told me I was incorrect on my answer regarding SetPanelAttribute(  , ATTR_HEIGHT,). Calling SetPanelAttribute or SetCtrlAttribute should not generate a user event. There was a bug in the panel sizing attributes that caused user events to be sent. We added an attribute ATTR_DISABLE_PROG_PANEL_SIZE_EVENTS in CVI 5.5 that is used to disable these size events from programmatic size changes. We didn't want to change the default behavior in case someone was relying on the behavior.

Michael
NI
0 Kudos
Message 10 of 14
(5,068 Views)