ctemplate:cannot open shared object file:No such file or directory

204 阅读1分钟

先说我是怎么解决的 在lib64建立一个软链接指向ctemplate安装的地方即可

ln -s libctemplate.so.3 /usr/local/lib/libctemplate.so.3

安装的路径:/usr/local/lib/libctemplate.so.3

我在安装了Ctemplate库之后

测试相关文件test.cc和test.html之后

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用来测试</title>
</head>
<body>
    <p>{{key}}</p>
    <p>{{key}}</p>
    <p>{{key}}</p>
    <p>{{key}}</p>
    <p>{{key}}</p>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用来测试</title>
</head>
<body>
    <p>{{key}}</p>
    <p>{{key}}</p>
    <p>{{key}}</p>
    <p>{{key}}</p>
    <p>{{key}}</p>
</body>
</html>

PQY}2WVJC4BPWYLINL01D2S.png

image.png 这个问题实际上是库的链接问题。我们在安装这个ctemplate之后,实际上安装在了 usr/local/lib下面,但是我们ldd a.out之后,这个库文件要在lib64里面找,所以我们进入到lib64里面建立一个软链接

image.png

**ln -s libctemplate.so.3 /usr/local/lib/libctemplate.so.3**

image.png

这样就成功了

image.png