不能为i386构建PortAudio以使其与NI的DAQmxBase一起使用

时间:2014-01-31 20:31:42

标签: c++ c macos portaudio nidaqmx

我正在尝试编写一个小的C / C ++程序,它既可以从NI USB DAQ获取数据,也可以使用PortAudio播放音频。问题是,似乎用于Mac / Linux的NI DAQ库DAQmxBase必须在i386下构建,而我无法为i386构建PortAudio。

我在运行-arch=i386之前尝试将CFLAGS和LDFLAGS设置为./configure --disable-mac-universal && make && make install,但是当我向PortAudio添加调用时,仍然无法构建NI DAQmxBase示例代码:

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

NI DAQmxBase Makefile如下所示:

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)

更改DAQmxBase Makefile中的-arch标志不起作用:

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

我认为这是因为DAQmxBase是用i386数据类型编写的。上述错误从NIDAQmxBase.h引用的行是:

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.");

我可以自己构建一些正常的PortAudio示例,但是我想将PortAudio和DAQmxBase放在同一个程序中并让它们相处。必须有一种方法来构建PortAudio,以便它可以与DAQmxBase一起使用,不是吗?

谢谢!

1 个答案:

答案 0 :(得分:0)

DAQmx Base版本14.0和15.0支持64位应用程序,因此您现在应该可以升级驱动程序并重试。

DAQmx Base 15.0 for Mac