Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Linux driver compiling problem

I try to compile the Linux GPIB drive (nigpib-linux-0.8.5) on the SuSE Linux distribution (Kernel 2.4.21, gcc 3.3.1). It doesn't compile. I get the error

ib_linux.c:419:6: missing binary operator before token "("

What can I do?
0 Kudos
Message 1 of 10
(5,704 Views)
Hugo,

the NI GPIB Linux driver comes pre-compiled. Please consult the "readme" file for installation isntructions. If you are writing a GPIB program, just #include the ugpib.h file and link cib.o with gcc.

Alan
Applications Engineer
National Instruments
0 Kudos
Message 2 of 10
(5,704 Views)
No, the module is not pre-compiled. That is just plain wrong.
0 Kudos
Message 3 of 10
(5,704 Views)
jnikkel,

You can download beta version .8.5 of the GPIB driver here. After extracting the tarball you will find several pre-compiled libraries: "cib.o", "ib_ni.o", and "libgpib.a". libgpib.a is the complete static library, and I recommend that you link to it in your GPIB programs.

The command "gcc -o testexec test.c libgpib.a" will compile simple c gpib programs.

The "readme" contains more information.

Thank you for contacting NI.

Alan Loprete
Applications Engineer
National Instruments
0 Kudos
Message 4 of 10
(5,704 Views)
That was not the point. If _you_ read the README it says to run the INSTALL script which _does_ try to compile a kernel module for insertion. The way I found around the exact same error that is listed above was to comment out the pre-processor directives and just assume that HZ>100. That seems to work for me though is of course not the correct thing to do.
0 Kudos
Message 5 of 10
(5,704 Views)
jnikkel,

I apologize, but it appears that we've had somewhat of a symantic misunderstanding. I believed that Hugo was attempting to compile one of his own programs, not the kernel module itself. Yes, indeed, if when running the INSTALL script an error of this nature is encountered, it warrants attention. Please tell me more about your setup (linux distribution version, kernel version, gcc version, etc.) and I will communicate this issue to R&D. I personally use Slackware 9.1, kernel 2.4.22, and gcc 3.2.3 (and have not had problems compiling the module)

Thank you!

Alan Loprete
Applications Engineer
National Instruments
0 Kudos
Message 6 of 10
(5,704 Views)
I understand. Here, I really think that the issue is with the distribution as I am running SuSe as well. (V9.0, gcc 3.3.1, kernel 2.4.21-144) This is what happens:
james/nigpib-linux-0.8.5> ./INSTALL

NI-488.2 GPIB Driver for Linux/x86 (Beta Release 0.8.5)
Copyright (C) 1999-2003 National Instruments Corporation.
Supports AT-GPIB/TNT, AT-GPIB/TNT PnP, and PCI-GPIB cards ONLY.
Note that PCII/a and PCMCIA cards are NOT supported; see README for more info.

This driver requires a stable Linux 2.0.x, 2.2.x, or 2.4.x series kernel with
loadable modules and module versioning enabled.

Your kernel appears to be configured properly to build NI-GPIB for Linux.
Do you want to proceed? [yn] y

gcc -c -O2 -D__KER
NEL__ -I/lib/modules/2.4.21-144-default/build/include -DMODULE -DMODVERSIONS -include /lib/modules/2.4.21-144-default/build/include/linux/modversions.h -D__GPIBDRIVER__ -o ib_linux-2.4.21-144-default.o ib_linux.c
ib_linux.c:419:6: missing binary operator before token "("
make: *** [ib_linux-2.4.21-144-default.o] Error 1
Couldn't build driver.

As I mentioned, the only way I found to fix this is to assume that HZ=1000 (as it is defined in ) and delete all the preprocessor lines and the other ticks= lines. It seems to work, but obviously is not a real solution.

I think a bigger issue overall with the driver has been brought up in this thread;
http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=50650000000800000062870000&UCATEGORY_0=_26_%24_13_&UCATEGORY_S=0&USEARCHCONTEXT_QUESTION_0=libgpib&USEARCHCONTEXT_QUESTION_S=0
There really does seem to be funky going on with that library which could be easily fixed in the distribution.

James
0 Kudos
Message 7 of 10
(5,704 Views)
James,

Thank you for such a thorough reply. I will compile this imformation and give it to R&D. As for the "errno" problem, this has to do with a change that occured in the latest versions of gcc. Though I can't speculate as to R&D's release schedule (timeline / fixes), they know about it and I imagine that this will be remedied in future releases.

Thank you again for your advisement.

Alan
0 Kudos
Message 8 of 10
(5,704 Views)
My workaround was the following:

#define HZ __HZ

before line 419 in "ib_linux.h". But I think this not a good solution. Even better is a test for the value of "HZ", "__HZ" or "get_hz" (from "hz.h") in a kernel indepedend manner at runtime.

...Rolf
0 Kudos
Message 9 of 10
(5,704 Views)
The problem may be some backports from 2.5/2.6 kernel to the SuSE kernel 2.4.21.

...Rolf
0 Kudos
Message 10 of 10
(5,704 Views)