无法链接Portaudio Library [英] Fail to Link Portaudio Library

查看:346
本文介绍了无法链接Portaudio Library的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用Portaudio库制作了一个简单的Makefile项目,该项目已经在以下Makefile中正常工作:

  CXXFLAGS = -O2 -g -Wall -fmessage-length = 0 
OBJS = RecAudio.o
LIBS = ../Portaudio/portaudio/lib/.libs/libportaudio.a -lpthread -lrt -lasound
#LIBS = -lportaudio -lpthread -lrt -lasound
TARGET = RecAudio
$(TARGET):$(OBJS)
$(CXX)-o $(TARGET)$ OBJS)$(LIBS)
all:$(TARGET)
clean:
rm -f $(OBJS)$(TARGET)
pre>

我将尝试将Portaudio库集成到使用Automake工具创建的另一个项目中。我以这种方式在Makefile.am文件中添加了库:

  METASOURCES = AUTO 
lib_LTLIBRARIES = libsounddevice.la
libsounddevice_la_SOURCES = AudioCapturePluginCommon.cpp SoundDevice.cpp SoundDeviceConfig.cpp
libsounddevice_la_LDFLAGS = -module
AM_CPPFLAGS = -D_REENTRANT
libsounddevice_la_LIBADD = portaudio / portaudio / lib / .libs / libportaudio.a -lACE - lxerces-c -llog4cxx -lorkbase -lpcap -lpthread -lrt -lasound
INCLUDES = -I @ top_srcdir @ -I ../../../ orkbasecxx -I ../ common
AudioCapturePluginCommon。 cpp:
ln -s ../common/AudioCapturePluginCommon.cpp AudioCapturePluginCommon.cpp

但我获得了以下错误:

  sr / bin / ld:portaudio / portaudio / lib / .libs / libportaudio.a .o):在创建共享对象时不能使用针对`.rodata.str1.8'的重定位R_X86_64_32;重新编译-fPIC 
portaudio / portaudio / lib / .libs / libportaudio.a:无法读取符号:错误值


解决方案

不要使用静态库来链接-shared。



使用共享的-lportaudio



另请参阅为什么在64位而不是32位平台上绝对需要fPIC?


I have made a simple Makefile project using Portaudio libraries and the project has been working fine with the following Makefile:

CXXFLAGS =  -O2 -g -Wall -fmessage-length=0
OBJS =      RecAudio.o
LIBS = ../Portaudio/portaudio/lib/.libs/libportaudio.a -lpthread -lrt -lasound
#LIBS = -lportaudio -lpthread -lrt -lasound
TARGET =    RecAudio
$(TARGET):  $(OBJS)
    $(CXX) -o $(TARGET) $(OBJS) $(LIBS)
all:    $(TARGET)
clean:
    rm -f $(OBJS) $(TARGET)

I'll try to integrate Portaudio libraries into another project created with Automake tools. I added library in Makefile.am file in this way:

METASOURCES = AUTO
lib_LTLIBRARIES = libsounddevice.la
libsounddevice_la_SOURCES = AudioCapturePluginCommon.cpp SoundDevice.cpp SoundDeviceConfig.cpp
libsounddevice_la_LDFLAGS = -module
AM_CPPFLAGS = -D_REENTRANT
libsounddevice_la_LIBADD = portaudio/portaudio/lib/.libs/libportaudio.a -lACE -lxerces-c -llog4cxx -lorkbase -lpcap -lpthread -lrt -lasound
INCLUDES = -I@top_srcdir@ -I../../../orkbasecxx -I../common
AudioCapturePluginCommon.cpp:
    ln -s ../common/AudioCapturePluginCommon.cpp AudioCapturePluginCommon.cpp

but I obtained the following error:

sr/bin/ld: portaudio/portaudio/lib/.libs/libportaudio.a(pa_front.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
portaudio/portaudio/lib/.libs/libportaudio.a: could not read symbols: Bad value

解决方案

Don't link with "-shared" against a static library.

Use the shared one "-lportaudio"

See also Why is fPIC absolutely necessary on 64 and not on 32bit platforms?

这篇关于无法链接Portaudio Library的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆