I'm trying to write a little C/C++ program that both acquires data from an NI USB DAQ and plays audio with PortAudio. The problem is, it appears that the NI DAQ library for Mac/Linux, DAQmxBase, has to be built under i386, and I just can't get PortAudio to build for i386.
I have tried setting CFLAGS and LDFLAGS to -arch=i386
before running ./configure --disable-mac-universal && make && make install
, but the NI DAQmxBase example code still won't build when I add calls to PortAudio to it:
gcc -I../../includes -g -O2 -arch i386 acAnalogTest.c -framework nidaqmxbase -framework nidaqmxbaselv -o acAnalogTest
Undefined symbols for architecture i386:
"_Pa_Initialize", referenced from:
_main in ccf1t0bz.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
make: *** [acAnalogTest] Error 1
The NI DAQmxBase Makefile looks like this:
nilibs=-framework nidaqmxbase -framework nidaqmxbaselv
includes=-I../../includes
flags= -g -O2 -arch i386
cc=gcc
ao_examples = acAnalogTest acquireNScans
......
all : $(ao_examples)
% : %.c
>---$(cc) $(includes) $(flags) $< $(nilibs) -o $@
clean :
>---rm -f $(ao_examples)
Changing the -arch flag in the DAQmxBase Makefile doesn't work:
gcc -I../../includes -g -O2 -arch x86_64 acAnalogTest.c -framework nidaqmxbase -framework nidaqmxbaselv -o acAnalogTest
In file included from acAnalogTest.c:1:
../../includes/NIDAQmxBase.h:104: warning: division by zero
../../includes/NIDAQmxBase.h:104: error: enumerator value for ‘assert_line_104’ is not an integer constant
../../includes/NIDAQmxBase.h:105: warning: division by zero
../../includes/NIDAQmxBase.h:105: error: enumerator value for ‘assert_line_105’ is not an integer constant
make: *** [acAnalogTest] Error 1
I assume this is because DAQmxBase is written with i386 data types in mind. The lines the above error references from NIDAQmxBase.h are:
NIStaticAssert(sizeof(long) == 4, "Error: This platform is unsupported because long is not 4 bytes.");
NIStaticAssert(sizeof(int) == sizeof(long), "Error: This platform is unsupported because int is not the same size as long.");
I can build some of the normal PortAudio examples on their own just fine, but I want to put PortAudio and DAQmxBase in the same program together and have them get along. There must be a way to build PortAudio so that it works with DAQmxBase, no?
Thanks!