Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

segmentation fault with libnipalu

I installed Nidaqmx v8.0 on Linux Fedora Core 4.
Everything works and example programs work.

Now i have to integrate a DIO functionality in my software but as I add
-lnidaqmx in the makefile (even with no change in the code), compilation runs perfectly but I get segmentation fault at execution.
The problem occurs even before the first instruction. Here are debugger messages:

(gdb) run
[Thread debugging using libthread_db enabled]
[New Thread -1208138048 (LWP 14288)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1208138048 (LWP 14288)]
0x003ef9f5 in libLoad () from /usr/local/lib/libnipalu.so.1
(gdb)

And here the backtrace:
#7  0x00000000 in ?? ()
#6  0x03f95f32 in ?? () from /usr/local/lib/libnimxpu.so.1
#5  0xbfdec4c8 in ?? ()
#4  0x03fa152c in ?? () from /usr/local/lib/libnimxpu.so.1
#3  0x03fa1720 in ?? () from /usr/local/lib/libnimxpu.so.1
#2  0x03f95f63 in ?? () from /usr/local/lib/libnimxpu.so.1
#1  0x03f9d3fb in nNIMXP100::tCPUCycleCounter::tCPUCycleCounter () from /usr/local/lib/libnimxpu.so.1
#0  0x003ef9f5 in libLoad () from /usr/local/lib/libnipalu.so.1

Does anybody know what's happening?
Thanks,
RMAR


0 Kudos
Message 1 of 8
(4,553 Views)

Hi,

could you just post here the makefile you are using. I want to see if I can reproduce the behaviour over here.

AlessioD

0 Kudos
Message 2 of 8
(4,537 Views)
Voilà...
(I renamed as Makefile.txt to be able to post it)

Thanks,
RMAR

Download All
0 Kudos
Message 3 of 8
(4,536 Views)
Sorry, in previous msg I attached the same file twice..
RMAR
0 Kudos
Message 4 of 8
(4,532 Views)

Unfortunately there does not seem to be anything wrong in what you are doing. The situation you stumbled upon may just be an effect of using NI products on a Linux Distribution which is not supported by NI.
Here http://www.ni.com/linux/support.htm#1 you can find the list of supported distributions, as well as other useful information.
Keep in mind that even if something is not supported by NI, this does not necessarily mean it won't work. It is simply not guaranteed it wiil work.

Linking the libraries manually is another test you could do. Just some hints on what libraries to look for

-lnidaqmx -lnimercu -lnidmxfu -lnimhwcfu -lnimstsu -lnimdbgu -lniorbu -lnipalu -lnimercu

With this being said, I have been crawling around the forums for similar issues and found the following threads which may help you.

http://forums.ni.com/ni/board/message?board.id=250&message.id=15833&requireLogin=False

http://forums.ni.com/ni/board/message?board.id=250&message.id=11879&requireLogin=False

 

0 Kudos
Message 5 of 8
(4,515 Views)
Thanks,
Fedora is only a version of RedHat, so I think there shouldn't be any pb for that.
Do you know what libnipalu does (just to have a direction for investigations)?

An hypothesis is a conflit with pthread, since NI libraries create theòselves a thread for each DIO task.
How does it sound to you?
RMAR


0 Kudos
Message 6 of 8
(4,513 Views)
RMAR,

I took a look at your MAKEFILE, and yes, pthread is likely your problem.   You should take a look at:

Why Does my Application Segmentation Fault When Using the pthread Library?

Also I must point out that "Fedora is only a version of RedHat" is like saying Fedora is only a version of Linux.  Sure both statements are true, but really the only thing all Linux distributions have in common is that they use the Linux kernel.  Even then you can have different versions of the kernel, different patches applied to the kernel, and of course different configurations of the kernel.

Lets compare FC 4 to RHEL WS 3 (Which is supported by DAQmx 8.0).  On the highest level FC 4 has kernel version 2.6.11, and RHEL WS 3 has 2.4.21.  The difference between 2.4 and 2.6 is huge.  OK, but DAQmx 8.0 supports Mandriva 2006 which happens to have a 2.6.12 kernel version, so why not FC 4?  Well, once again each distribution can apply what ever patches they want to the kernel, and they can use whatever configuration options they want.  If you ignore the difference in patches, FC 4 has been compiled with a 4K kernel stack, and Mandriva 2006 has been compiled with an 8K kernel stack.

You may not have run into this problem yet, and you may not run into it, but our DAQmx 8.0 test suites have been able to overflow the 4K kernel stack of RHEL WS 4.  If you overflow the kernel stack your system can crash, or become unstable.

Shawn B.
National Instruments
Use NI products on Linux? Come join the NI Linux Users Community
0 Kudos
Message 7 of 8
(4,505 Views)
IT'S TRUE!!!!!
By simply replacing -lpthread with -pthread it works!
Further investigation are still needed anyway, but I feel I'm on the right way.
Thanks a lot,
RMAR
Message 8 of 8
(4,498 Views)