From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

cvicc on Ubuntu 12.04 toolbox.c undefined reference to `GetCtrlAttribute'

Solved!
Go to solution

I am trying to use cvicc to compile a GUI using Ubuntu 12.04 64-bit (originally written on Windows).  I have had this working fine on RedHat 5 and 6 (both 64-bit), so I know the code is fine.  I also have all the 32-bit libraries installed.  I also know that this machine will compile some relatively complex code, because I have been able to compile C, C++, and CUDA code just fine.  

 

I keep getting errors like:

 

toolbox.c(.text+0x13581): undefined reference to `GetCtrlAttribute'

 

after running

 

cvicc project_name.prj

 

So far I haven't been able to figure out the underlying problem.  I've been searching and stumbling around with this all day.  I am far from a LabWindows/CVI expert.  Thanks in advance for any help.

0 Kudos
Message 1 of 9
(4,941 Views)

Hi cbrinegar,

 

From LabWindows/CVI, can you perform a search from the bottom-left Find panel for GetCtrlAttribute, and pull up the Function Panel for that function?

 

Regards,

Daniel Dorroh
National Instruments
0 Kudos
Message 2 of 9
(4,927 Views)

No, I can't, because I have installed the minimum needed to compile the code and run the GUI.

0 Kudos
Message 3 of 9
(4,923 Views)

I suspect that some path information is not being set correctly during the compilation.  I get an error that InitCVIRTE() is undefined even though it appears that cvirte.h is being found.  So, the following does not work:

 

cvicc project.prj

 

I can work around the issue by doing this:

 

cvicc project.c

gcc -o project project.o -lcvi -rdynamic -m32

 

If I figure out why cvicc won't work on the original .prj file, I'll post the solution here.

0 Kudos
Message 4 of 9
(4,921 Views)

This works:

 

cvicc -lcvi -ldl -lpthread project.prj

 

My next question is why did "cvicc project.prj" work on RHEL (RedHat) but not here.  Possibly something was not set up correctly due to my installation without rpms.

0 Kudos
Message 5 of 9
(4,917 Views)
Solution
Accepted by cbrinegar

Hi cbrinegar,

 

Please try to add the toolbox library to LabWindows/CVI so it can access the toolbox functions.  You can do this by selecting Library from the menu bar, and choosing Customize... from the resulting drop down.  From the Customize Library Menu dialog, click Browse and navigate to the file: toolbox.fp located: <CVIxxxx>\toolslib\toolbox\toolbox.fp, where xxxx represents the version number of LabWindows/CVI you are using.  Select the file, and then press Select»OK to finalize loading the library.

 

After trying this, please let me know if you still encounter the definition errors.

 

Regards,

 


Hi cbrinegar,

 

I apologize for misunderstanding earlier.  Having to manually include your libraries is somewhat expected using CVICC in Linux.  You may find more information on this, here.  

 

Regards,

Daniel Dorroh
National Instruments
Message 6 of 9
(4,916 Views)

I know this is an old thread, but there is not a lot of information about CVI for Linux out there.  I found this via google.

 

The link in your post does not address the issue as CVI2010 already includes lpthread in the compile.ecc USE_LIBRY variable, but it appears to be ignored.

 

I sold a colleague on CVI2010 for Linux and since I tested the beta on 64-bit  Ubuntu 10.04, I expected no problems running it on 64-bit  Linux Mint 13 (a Ubuntu 12.04 derivative).

 

I get the same cvicc building problem as in the original post.  I also tried 32-bit Ubuntu 12.04, and my Ubuntu 10.04 system that I'd used for the beta.

 

The original poster's workaround also works for me, but I'd like to pass on one thing I found in my attempts to solve the issue in hopes of a real solution for using cvicc on the project files.

 

 

Using the tankdemo example and various changes to the compile.ecc file after adding the -v gcc flag in an attempt to get a idea of the commands cvicc was passing to gcc I got the following potential clue:

wally@voms ~/tankdemo $ cvicc Tank.prj
Building Release configuration of /home/wally/tankdemo/Tank.prj
Compiling /home/wally/tankdemo/Tank.c
Calling external compiler...
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcx
x-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
COLLECT_GCC_OPTIONS='-c' '-m32' '-v' '-std=gnu90' '-g' '-I' '/usr/local/natinst/cvi2010/include' '-I' '/usr/local/vxipnp/linux/include' '-I' '/home/wally/tankdemo' '-I' '/usr/local/natinst/cvi2010/toolslib/activex/word' '-I' '/usr/local/natinst/cvi2010/toolslib/activex/excel' '-I' '/usr/local/natinst/cvi2010/toolslib/custctrl' '-I' '/usr/local/natinst/cvi2010/toolslib/custctrl/custsupp' '-I' '/usr/local/natinst/cvi2010/toolslib/cvirtsup' '-I' '/usr/local/natinst/cvi2010/toolslib/datasock' '-I' '/usr/local/
natinst/cvi2010/toolslib/daqUtil' '-I' '/usr/local/natinst/cvi2010/toolslib/printing' '-I' '/usr/local/natinst/cvi2010/toolslib/toolbox' '-I' '/usr/local/natinst/cvi2010/toolslib/reportgen' '-I' '/usr/local/natinst/cvi2010/toolslib/localui' '-I' '/usr/local/natinst/cvi2010/instr' '-D' '_NI_unix_=1' '-D' '_NI_linux_=1' '-D' '_CVI_EXE_=1' '-D' '_LINK_CVIRTE_=1' '-D' 'NDEBUG=1' '-D' '_INTERACTIVE_WINDOW_BUILD_=1' '-D' '_CVI_PROFILE_LEVEL_=0' '-D' '_TARGET_FILE_VERSION_=1.0.0.0' '-D' '_TARGET_PRODUCT_VERSION_=
1.0.0.0' '-D' '__TPC__' '-o' '/tmp/CVI_int_obj_222621.o' '-mtune=generic' '-march=i686'
/usrlib/gcc/x866_64-inux-gnu/4.6/cc1 -quiet -v -I /usr/local/natinsst/cvi2010/include -I /usr/local/vxipnp/linux/include -I /home/wally/tankdemo -I /usr/local/natinst/cvi2010/toolslib/activex/word -I /usr/local/natinst/cvi2010/toolslib/activex/excel -I /usr/local/natinst/cvi2010/toolslib/custctrl -I /usr/local/natinst/cvi2010/toolslib/custctrl/custsupp -I /usr/local/natinst/cvi2010/toolslib/cvirtsup -I /usr/local/natinst/cvi2010/toolslib/datasock -I /usr/local/natinst/cvi2010/toolslib/daqUtil -I /usr/loca
l/natinst/cvi2010/toolslib/printing -I /usr/local/natinst/cvi2010/toolslib/toolbox -I /usr/local/natinst/cvi2010/toolslib/reportgen -I /usr/local/natinst/cvi2010/toolslib/localui -I /usr/local/natinst/cvi2010/instr -imultilib 32 -imultiarch i386-linux-gnu -D _NI_unix_=1 -D _NI_linux_=1 -D _CVI_EXE_=1 -D _LINK_CVIRTE_=1 -D NDEBUG=1 -D _INTERACTIVE_WINDOW_BUILD_=1 -D _CVI_PROFILE_LEVEL_=0 -D _TARGET_FILE_VERSION_=1.0.0.0 -D _TARGET_PRODUCT_VERSION_=1.0.0.0 -D __TPC__ /home/wally/tankdemo/Tank.c -quiet -dumpb
ase Tank.c -m32 -mtune=generic -march=i686 -auxbase-strip /tmp/CVI_int_obj_222621.o -g -std=gnu90 -version -fstack-protector -o /tmp/ccxKzxxj.s
GNU C (Ubuntu/Linaro 4.6.3-1ubuntu5) version 4.6.3 (x86_64-linux-gnu)
compled by GNU  C vesion 4.6.3, GMP version 5.0.2, MPFR version 3.11.0-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/include/i386-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../x86_64-linux-gnu/include"
ignoring nonexistent directory "/usr/include/i386-linux-gnu"
ignoring nonexistent directory "/usr/local/vxipnp/linux/include"
ignoring nonexistent directory "/usr/local/natinst/cvi2010/toolslib/activex/word"
ignoring nonexistent directory "/usr/local/natinst/cvi2010/toolslib/activex/excel"
ignoring nonexistent directory "/usr/local/natinst/cvi2010/toolslib/cvirtsup"
ignoring nonexistent directory "/usr/local/natinst/cvi2010/toolslib/datasock"
ignoring nonexistent directory "/usr/local/natinst/cvi2010/toolslib/daqUtil"
ignoring nonexistent directory "/usr/local/natinst/cvi2010/toolslib/reportgen"
#include "..." search starts here:
#include <...> search starts here:
/usrlocal/natinnst/cvi2010/include
/hom/wally/tankkdemo
/usrlocal/natinnst/cvi2010/toolslib/custctrl
/usrlocal/natinnst/cvi2010/toolslib/custctrl/custsupp
/usrlocal/natinnst/cvi2010/toolslib/printing
/usrlocal/natinnst/cvi2010/toolslib/toolbox
/usrlocal/natinnst/cvi2010/toolslib/localui
/usrlocal/natinnst/cvi2010/instr
/usrlib/gcc/x866_64-linux-gnu/4.6/include
/usrlocal/incluude
/usrlib/gcc/x866_64-linux-gnu/4.6/include-fixed
/usr/include
End of search list.
GNU C (Ubuntu/Linaro 4.6.3-1ubuntu5) version 4.6.3 (x86_64-linux-gnu)
compled by GNU  C vesion 4.6.3, GMP version 5.0.2, MPFR version 3.11.0-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 75e879ed14f91af504f4150eadeaa0e6
COLLECT_GCC_OPTIONS='-c' '-m32' '-v' '-std=gnu90' '-g' '-I' '/usr/local/natinst/cvi2010/include' '-I' '/usr/local/vxipnp/linux/include' '-I' '/home/wally/tankdemo' '-I' '/usr/local/natinst/cvi2010/toolslib/activex/word' '-I' '/usr/local/natinst/cvi2010/toolslib/activex/excel' '-I' '/usr/local/natinst/cvi2010/toolslib/custctrl' '-I' '/usr/local/natinst/cvi2010/toolslib/custctrl/custsupp' '-I' '/usr/local/natinst/cvi2010/toolslib/cvirtsup' '-I' '/usr/local/natinst/cvi2010/toolslib/datasock' '-I' '/usr/local/
natinst/cvi2010/toolslib/daqUtil' '-I' '/usr/local/natinst/cvi2010/toolslib/printing' '-I' '/usr/local/natinst/cvi2010/toolslib/toolbox' '-I' '/usr/local/natinst/cvi2010/toolslib/reportgen' '-I' '/usr/local/natinst/cvi2010/toolslib/localui' '-I' '/usr/local/natinst/cvi2010/instr' '-D' '_NI_unix_=1' '-D' '_NI_linux_=1' '-D' '_CVI_EXE_=1' '-D' '_LINK_CVIRTE_=1' '-D' 'NDEBUG=1' '-D' '_INTERACTIVE_WINDOW_BUILD_=1' '-D' '_CVI_PROFILE_LEVEL_=0' '-D' '_TARGET_FILE_VERSION_=1.0.0.0' '-D' '_TARGET_PRODUCT_VERSION_=
1.0.0.0' '-D' '__TPC__' '-o' '/tmp/CVI_int_obj_222621.o' '-mtune=generic' '-march=i686'
as -32 -o /tmp//CVI_int_obj_222621.o /tmp/ccxKzxxj.s
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.6/:/usr/lib/gcc/x86_64-linux-gnu/4.6/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.6/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.6/32/:/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../i386-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib32/:/lib/i386-linux-gnu/:/lib/../lib32/:/usr/lib/i386-linux-gnu/:/usr/lib/../lib32/:/usr/lib/gcc/x86_64-linux-gnu/4.6/:/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../i386-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../:/lib/i386-linux-gnu/:/lib/:/usr/lib/i386-linux-gnu/:/usr/lib/
COLLECT_GCC_OPTIONS='-c' '-m32' '-v' '-std=gnu90' '-g' '-I' '/usr/local/natinst/cvi2010/include' '-I' '/usr/local/vxipnp/linux/include' '-I' '/home/wally/tankdemo' '-I' '/usr/local/natinst/cvi2010/toolslib/activex/word' '-I' '/usr/local/natinst/cvi2010/toolslib/activex/excel' '-I' '/usr/local/natinst/cvi2010/toolslib/custctrl' '-I' '/usr/local/natinst/cvi2010/toolslib/custctrl/custsupp' '-I' '/usr/local/natinst/cvi2010/toolslib/cvirtsup' '-I' '/usr/local/natinst/cvi2010/toolslib/datasock' '-I' '/usr/local/
natinst/cvi2010/toolslib/daqUtil' '-I' '/usr/local/natinst/cvi2010/toolslib/printing' '-I' '/usr/local/natinst/cvi2010/toolslib/toolbox' '-I' '/usr/local/natinst/cvi2010/toolslib/reportgen' '-I' '/usr/local/natinst/cvi2010/toolslib/localui' '-I' '/usr/local/natinst/cvi2010/instr' '-D' '_NI_unix_=1' '-D' '_NI_linux_=1' '-D' '_CVI_EXE_=1' '-D' '_LINK_CVIRTE_=1' '-D' 'NDEBUG=1' '-D' '_INTERACTIVE_WINDOW_BUILD_=1' '-D' '_CVI_PROFILE_LEVEL_=0' '-D' '_TARGET_FILE_VERSION_=1.0.0.0' '-D' '_TARGET_PRODUCT_VERSION_=
1.0.0.0' '-D' '__TPC__' '-o' '/tmp/CVI_int_obj_222621.o' '-mtune=generic' '-march=i686'
/home/wally/tankdemo/cvibuild.Tank/Release/Tank.niobj: In function `main':
/home/wally/tankdemo/Tank.c:52: undefined reference to `InitCVIRTEEx'

... many more linker undefined reference errors ...

collect2: ld returned 1 exit status
Build failed.

Note the mangled directory names after #include <...> search starts here:

 

/usrlocal/natinnst/cvi2010/include should be /usr/local/natinst/cvi2010/include

although its not the only mangled path.

 

 

0 Kudos
Message 7 of 9
(4,804 Views)

I had a few more clarifying command examples but hit the 10,000 character limit for posts.

 

 

To clarify, using the tankdemo sample program:

wally@voms ~/tankdemo $ cvicc -lcvi -lpthread Tank.prj
Building Release configuration of /home/wally/tankdemo/Tank.prj
/usr/local/natinst/cvi2010/toolslib/toolbox/toolbox.o: In function `CVIAbsoluteTimeFromCNVTime':
toolbox.c:(.text+0x2154): undefined reference to `CVIAbsoluteTimeFromTimeUnit'
/usr/local/natinst/cvi2010/toolslib/toolbox/toolbox.o: In function `CVIAbsoluteTimeFromCVIANSITime':
toolbox.c:(.text+0x21c9): undefined reference to `CVIAbsoluteTimeFromTimeUnit'
/usr/local/natinst/cvi2010/toolslib/toolbox/toolbox.o: In function `CVIAbsoluteTimeToCNVTime':
toolbox.c:(.text+0x2257): undefined reference to `CVIAbsoluteTimeToTimeUnit'
/usr/local/natinst/cvi2010/toolslib/toolbox/toolbox.o: In function `CVIAbsoluteTimeToCVIANSITime':
toolbox.c:(.text+0x22f0): undefined reference to `CVIAbsoluteTimeToTimeUnit'
/usr/local/natinst/cvi2010/toolslib/toolbox/toolbox.o: In function `CVIAbsoluteTimeFromCVIUILTime':
toolbox.c:(.text+0x23e5): undefined reference to `CVIAbsoluteTimeFromLocalCalendar'
/usr/local/natinst/cvi2010/toolslib/toolbox/toolbox.o: In function `CVIAbsoluteTimeToCVIUILTime':
toolbox.c:(.text+0x2495): undefined reference to `CVIAbsoluteTimeToLocalCalendar'
/usr/local/natinst/cvi2010/toolslib/toolbox/toolbox.o: In function `DelayQueueHandler':
toolbox.c:(.text+0x138e5): undefined reference to `GetTimerTickData'
collect2: ld returned 1 exit status
Build failed.

 

 

Using the workaround of the original poster:

wally@voms ~/tankdemo $ cvicc Tank.c
Compiling /home/wally/tankdemo/Tank.c
Calling external compiler...

wally@voms ~/tankdemo $ gcc -rdynamic -m32 Tank.o -lcvi -o tank

 results in a working example program.

 

 

As does:

gcc Tank.c -rdynamic -m32 -I/usr/local/natinst/cvi2010/include -lcvi -o tank

 

 

Which brings up the question is why does cvic exist at all as it seems the only issue tying the product to Rehat Linux versions.

 

To run on Debian derived Liunx versions all I had to do was convert the rpms to debs using alien and then install uisng dpkg -i,  although my 64-bit 10.04 system required the --force-architecture option to dpkg as well.


 

 

0 Kudos
Message 8 of 9
(4,801 Views)

Here is a simple sample Makefile to eliminate the need for cvicc for the tankdemo sample program.

 

# Simple sample makefile to work around cvicc not working on Ubuntu 12.04 and related systems
# just uses gcc like any "normal" C program would.
# The -rdynamic option is required on all systems or the LoadPanel function fails with error -86.
# The -m32 option is to compile the 32-bit CVI for linux libraries on 64-bit Ubuntu.

CVIinclude = -I/usr/local/natinst/cvi2010/include \
			 -I/usr/local/natinst/cvi2010/toolslib/toolbox \
			 -I/usr/local/natinst/cvi2010/toolslib/printing \
			 -I/usr/local/natinst/cvi2010/toolslib/localui \
			 -I/usr/local/natinst/cvi2010/toolslib/custctrl

CVIlib = -lcvi -lnianlys -lcvintwrk -lnilxtcor -lninetv -llksock -llksec -llkrealt -llkdynam -llkbrow -livi -liomp5 -linstrsup -lLV100000_BLASLAPACK

tank : Tank.c Tank.h Tank.uir
	gcc Tank.c -rdynamic -m32 $(CVIinclude) $(CVIlib) -o tank

 

Had something like this been discoverable by Google it's saved me a day of futzing around 😞

 

Hope this helps someone else.

 

Message 9 of 9
(4,791 Views)