09-15-2005 03:55 AM
09-15-2005 11:08 AM
09-15-2005 12:50 PM
Hello Shawn,
Ýou where right about the library. However another error appears when i use the correct library. When i compile with the following lines:
if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/gnome/include/glib-2.0 -I/opt/gnome/lib/glib-2.0/include -Wall -g -O2 -MT nid-counter.o -MD -MP -MF ".deps/nid-counter.Tpo" -c -o nid-counter.o `test -f 'counter.c' || echo './'`counter.c; \
then mv -f ".deps/nid-counter.Tpo" ".deps/nid-counter.Po"; else rm -f ".deps/nid-counter.Tpo"; exit 1; fi
if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/gnome/include/glib-2.0 -I/opt/gnome/lib/glib-2.0/include -Wall -g -O2 -MT nid-dio.o -MD -MP -MF ".deps/nid-dio.Tpo" -c -o nid-dio.o `test -f 'dio.c' || echo './'`dio.c; \
then mv -f ".deps/nid-dio.Tpo" ".deps/nid-dio.Po"; else rm -f ".deps/nid-dio.Tpo"; exit 1; fi
if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/gnome/include/glib-2.0 -I/opt/gnome/lib/glib-2.0/include -Wall -g -O2 -MT nid-nid.o -MD -MP -MF ".deps/nid-nid.Tpo" -c -o nid-nid.o `test -f 'nid.c' || echo './'`nid.c; \
then mv -f ".deps/nid-nid.Tpo" ".deps/nid-nid.Po"; else rm -f ".deps/nid-nid.Tpo"; exit 1; fi
if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/gnome/include/glib-2.0 -I/opt/gnome/lib/glib-2.0/include -Wall -g -O2 -MT nid-input.o -MD -MP -MF ".deps/nid-input.Tpo" -c -o nid-input.o `test -f 'input.c' || echo './'`input.c; \
then mv -f ".deps/nid-input.Tpo" ".deps/nid-input.Po"; else rm -f ".deps/nid-input.Tpo"; exit 1; fi
/bin/sh ../libtool --mode=link --tag=CC gcc -g -O2 -o nid -L/opt/gnome/lib -lglib-2.0 nid-counter.o nid-dio.o nid-nid.o nid-input.o -llvrtdark -lnidaqmxbase
mkdir .libs
gcc -g -O2 -o nid nid-counter.o nid-dio.o nid-nid.o nid-input.o -L/opt/gnome/lib /opt/gnome/lib/libglib-2.0.so -llvrtdark -lnidaqmxbase
I get this error when trying to execute the application
./nid
ERROR! The LabVIEW RunTime Engine failed to initialize correctly.
This is usually caused by linking applications incorrectly.
Please see the AppLibs/README.shlibs file in the LabVIEW directory for
instructions on building programs using LabVIEW-built shared libraries.
LabVIEW caught fatal signal
- Received SIGSEGV
Reason: address not mapped to object
Attempt to reference address: 0x4
Segmentation fault
When i run
gdb ./nid
I get the following;
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1090661296 (LWP 27212)]
0x401f3c22 in GenericListInternals<unsigned char const*>::NumElts () from /usr/local/lib/liblvrtdark.so.7.0
(gdb)
Is there a known bug in liblvrtdark.so.7.0 ?
As before. The application runs fine if i compile at the prompt with:
gcc -I. -I/opt/gnome/include/glib-2.0 -I/opt/gnome/lib/glib-2.0/include -O2 nid.c dio.c input.c counter.c -lnidaqmxbase -lnidaqmxbaselv -llvrtdark -L/opt/gnome/lib -lglib-2.0 -o nid
I would appreciate an answer..
Cheers /Josef
09-15-2005 01:07 PM
Hello again.
I think i've found the bug.
If i link the application with the follwing:
gcc -g -O2 -o nid nid-counter.o nid-dio.o nid-nid.o nid-input.o -llvrtdark -lnidaqmxbase -lnidaqmxbaselv -L/opt/gnome/lib /opt/gnome/lib/libglib-2.0.so
I get
./nid
ERROR! The LabVIEW RunTime Engine failed to initialize correctly.
This is usually caused by linking applications incorrectly.
Please see the AppLibs/README.shlibs file in the LabVIEW directory for
instructions on building programs using LabVIEW-built shared libraries.
LabVIEW caught fatal signal
- Received SIGSEGV
Reason: address not mapped to object
Attempt to reference address: 0x4
Segmentation fault
But if i link it with:
gcc -g -O2 -o nid nid-counter.o nid-dio.o nid-nid.o nid-input.o -lnidaqmxbase -lnidaqmxbaselv -llvrtdark -L/opt/gnome/lib /opt/gnome/lib/libglib-2.0.so
Then It runs fine.
The following also works:
gcc -g -O2 -o nid nid-counter.o nid-dio.o nid-nid.o nid-input.o -L/opt/gnome/lib /opt/gnome/lib/libglib-2.0.so -lnidaqmxbase -lnidaqmxbaselv -llvrtdark
gcc -g -O2 -o nid nid-counter.o nid-dio.o nid-nid.o nid-input.o -L/opt/gnome/lib /opt/gnome/lib/libglib-2.0.so -lnidaqmxbaselv -llvrtdark -lnidaqmxbase
But not:
gcc -g -O2 -o nid nid-counter.o nid-dio.o nid-nid.o nid-input.o -L/opt/gnome/lib /opt/gnome/lib/libglib-2.0.so -lnidaqmxbase -llvrtdark -lnidaqmxbaselv
It seems that one must link in -lnidaqmxbaselv before -llvrtdark.
It also works when im not using X.
The conclusion is that everyone who wants to develop under linux beware of how you link your application to ni library.
Why havent this feature been well documented by NI. I know that NI have written one page about linking problem but it was hard getting that
document and it didnt contain that much, mostly about problems under Solaris and not under Linux.
/josef
09-15-2005 01:14 PM
For the record.
If anyone except me is using autoconf and automake together with nilibs one must add the libraries in the following order in configure.in
AC_CHECK_LIB(lvrtdark,main,,AC_MSG_ERROR(nid needs lvrtdark))
AC_CHECK_LIB(nidaqmxbaselv, main,, AC_MSG_ERROR(nid needs nidaqmxbaselv))
AC_CHECK_LIB(nidaqmxbase,DAQmxBaseStartTask,, AC_MSG_ERROR(nid needs nidaqmxbase))
Cheers /josef