LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Using cvicc on 64-bit Linux?

Solved!
Go to solution

I've used the CVI8.0 runtime for Linux on a project (~ 4 years ago) that I still need to support, short of setting up a 32-bit virtual machine, does anyone know the trick of compling the 32-bit CVI for Linux code on a 64-bit system?

 

I'm aware of the gcc -m32 and ld -melf_i386  options for 32-bit builds on 64-bit systems, but  I just don't see how to pass them if cvicc is calling the GNU tools or what I'd need to do to setup a generic Makefile to compile and link my CVI for Linux code.

 

I have verified I've got the 32-bit runtime working correctly as I can move my CVI for Linux app compiled on a 32-bit system to the 64-bit development system I'm setting up and it appears to run correctly.

 

--wally.

 

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

Hey wally - 

 

While we've not done much testing on a 64-bit linux OS, you should be able to add those compile flags pretty simply.  You'll just need to modify the compile.ecc file located at /usr/local/natinst/cvi80/bin.  You should be able to add the gcc compile flag to "COMPFLAGS" and the ld link flag to "LINKFLAGS".  

 

You are correct that these options are all passed through to gcc under the hood, so you could create your own make file if all else fails.  The shared libraries you need are installed to /usr/local/lib (libcvi, libcvintwrk, etc), object files for toolbox are at /usr/local/natinst/cvi80/toolslib/toolbox (or custctrl), and headers are in the same toolslib locations or at /usr/local/natinst/cvi80/include.

 

NickB

National Instruments 

0 Kudos
Message 2 of 13
(6,189 Views)

Thanks, this appears to get the compile correct.  I had to install some additional Ubuntu packages to get the gnu/stubs-32.h header files, specifically libc6-dev-i386 which then brought in the gcc-multilib packages.

 

 

But the link step still fails with:

 

/usr/bin/ld: skipping incompatible /usr/local/lib/libcvi.so when searching for -lcvi

 

 

my compile.ecc file looks like:

 

CMPLRNAME = GCC
VALID_CFG = 1
DOPARSING = 0
OPT_LEVEL = 0
WARNLEVEL = 0
USERFLAGS =
COMPFLAGS = -c -m32 -x c
LINKFLAGS = -rdynamic -melf_i386
COMPLPATH = gcc
ENV_BATCH =
OBJ_TEMPL = -o $OBJECT
SRC_TEMPL = $SOURCE
DEF_TEMPL = -D$MACRO
DEFVTEMPL = -D$MACRO=$VALUE
INC_TEMPL = -I$PATH
LIB_TEMPL = -l$LIBRARY
LIBPTEMPL = -L$PATH
LIB_PATHS =
USE_LIBRY = nianlys;rt;cvintwrk
ABS_LIBRY =
OPT_FLAGS
Debug Opt = -g
Release Opt = -O2
END_FLAGS
WARNFLAGS
Warnings =
END_FLAGS
__CEND___

 

 

 

libcvi.so.5 and its link are in /usr/local/lib, do I need to link them or move them to /usr/lib32?

 

This is my first attempt at using gcc "multilib".  Thanks for your quick reply.

 

--wally.

 

 

0 Kudos
Message 3 of 13
(6,170 Views)
Solution
Accepted by topic author wally_666

Hey wally - 

 

Sorry to take so long to get back to you, I wasn't sure, so I figured I'd try it myself.  It turns out you want to pass -m32 for both the compiler and the linker flags.  These just tell gcc and ld which directories to use during the compile and link stages, meaning that any libraries you depend on must be in the /usr/lib32 directory (or links from there to the libraries you depend on).   For instance, I created a link to libcvi.so in /usr/lib32

 

$ ln -s /usr/local/natinst/cvirte/lib/libcvi.so /usr/lib32

 

and was then able to build one of our examples (after pulling nianlys out of the USE_LIBRY flag in compile.ecc...).

 

let me know if you run into anything else,

 

NickB

National Instruments 

Message 4 of 13
(6,132 Views)

Thanks a bunch!

 

This is one of those arcane knowledge things that just drives me nuts.  Google got me close with -m32 and -melf_i386, but no clue at all as to needing *both* 😞

 

One might think that using  -melf_i386 would imply -m32 but obviously you'd be wrong 🙂

 

Thanks again, this sure beats setting up another virtual machine.

 

--wally.

 

0 Kudos
Message 5 of 13
(6,123 Views)

Glad that got it working for you!

 

I wasn't quite clear enough in my first post though - you shouldn't need the -melf_i386 flag at all, just the -m32 flag.  I think the -melf_i386 flag was being ignored.  Because of this, I don't think using both of them matters that much, but I just wanted to be clear. 

 

NickB

National Instruments  

0 Kudos
Message 6 of 13
(6,120 Views)

It doesn't seem the symlink in /usr/lib32 to the CVI libs is needed on Ubuntu 10.04 as I tried that while waiting and since it didn't work removed it.

 

 

I'm using:

 

COMPFLAGS = -c -m32 -x c
LINKFLAGS = -rdynamic -m32 -melf_i386

 

in my compile.ecc file.

 

 

I did have to copy over to /usr/lib32 a 32-bit version of  libstdc++.so.5.0.7 (I used the one from Ubuntu 8.04) and link it to libstdc++.so.5 to get the compile step to work.

 

I have verified that the -melf_i386 is not required in compile.ecc.

 

--wally.

 

 

 

0 Kudos
Message 7 of 13
(6,110 Views)

i have a dll that i want to convert it to .so file so that i can use it in Suse Linux by calling it through Call library function.Suse linux version  that i use is 64 bit.so is there labview version of linux for 64 bit?cos i will be compiling the c program in linux which creates a .so file of 64 bit format, but i think i have labview of 32 bit,so can i call the 64 bit .so file in 32 labview linux version?

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

i have a dll file that uses __declspec (dll export) function in my dll.i want to convert this code to .so file.i have the source code for the dll file(that contains about 2 c files and 3 header files).i want the code to be completely used in linux so that i can create a .so file through a compiler in linux and call it in my labview linux version thgough CLF(call library function)

0 Kudos
Message 9 of 13
(5,821 Views)

larshana prefers posting the identical issue in multiple forums

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