gpt4 book ai didi

error-handling - ./说出: error while loading shared libraries: libespeak-ng.so.1: cannot open shared object file: No such file or directory

转载 作者:行者123 更新时间:2023-12-03 07:58:12 25 4
gpt4 key购买 nike

我已经从github下载了最新版本的espeak-ng,并做了./autogen.sh ./configure make make install
所以我写了一个测试程序,如下所示:

#include <string.h>
#include <vector>
#include </usr/local/include/espeak-ng/speak_lib.h>

int samplerate; // determined by espeak, will be in Hertz (Hz)
const int buflength = 200; // passed to espeak, in milliseconds (ms)

std::vector<short> sounddata;

int SynthCallback(short *wav, int numsamples, espeak_EVENT *events) {
if (wav == NULL)
return 1; // NULL means done.

/* process your samples here, let's just gather them */
sounddata.insert(sounddata.end(), wav, wav + numsamples);
return 0; // 0 continues synthesis, 1 aborts
}

int main(int argc, char* argv[] ) {
char text[] = {"my name is espeak"};
samplerate = espeak_Initialize(AUDIO_OUTPUT_RETRIEVAL, buflength, NULL, 0);
espeak_SetSynthCallback(&SynthCallback);
espeak_SetVoiceByName("en");
unsigned int flags=espeakCHARS_AUTO | espeakENDPAUSE;
size_t size = strlen(text);
espeak_Synth(text, size + 1, 0, POS_CHARACTER, 0, flags, NULL, NULL);
espeak_Synchronize();

/* in theory sounddata holds your samples now... */

return 0;
}

并通过此命令对其进行编译,没有任何错误:
g++ -W -o speaks espeak.cpp -lespeak-ng

但是,当我尝试通过 ./speaks运行可执行文件时,出现以下错误消息:
./speaks: error while loading shared libraries: libespeak-ng.so.1: cannot open shared object file: No such file or directory

有什么问题?

我知道 libespeak-ng.so.1在这里: /usr/local/lib/libespeak-ng.so.1

最佳答案

我通过将这两行添加到我的/etc/environment文件中解决了这个问题:

LD_LIBRARY_PATH=/usr/local/lib
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

关于error-handling - ./说出: error while loading shared libraries: libespeak-ng.so.1: cannot open shared object file: No such file or directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47400061/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com