ubuntu报错
E: 无法定位软件包 libjasper-dev 或者 E: Unable to locate package libjasper-dev
# 打开软件源配置文件,按“i”进行插入编辑
sudo vim /etc/apt/sources.list
# 末尾增加一行,并按ESC 、按:x保存退出
deb http://security.ubuntu.com/ubuntu xenial-security main
# 更新软件源
sudo apt-get update
# 查询是否可以找到该软件,无返回则说明增加的软件源无效或未更新成功。
apt-cache search libjasper-dev
# 进行该软件安装
sudo apt-get install libjasper-dev
sudo 没有效果还是提示权限不够:
使用 sudo echo "" > /etc/ld.so.preload
命令时,即使使用了 sudo
提升了权限,但这个命令实际上并没有正确利用 sudo
的优势,因为 >
符号重定向输出是bash shell先执行的操作,然后再执行 sudo
提权,所以需要 sudo sh -c 'echo "" > /etc/ld.so.preload'
, sh -c
参数后面跟的是一个单引号包裹的命令字符串,它作为一个整体在 sudo
提权后执行,确保了整个重定向操作都在超级用户权限下进行。
虚拟机ubuntu突然只有lo一个网口 操作系统 / Linux
su --> ifconfig -a --> ifconfig ens33 up --> service network restart
修改ip: vi etc/network/interfaces
修改dns: vi /etc/resolv.conf
重启网络:sudo /etc/init.d/networking restart
使用dhcp协议自动获取ip参数:dhclient ens33 (dh)
1.
E: 无法获得锁 /var/lib/dpkg/lock - open (11: 资源暂时不可用)
E: 无法锁定管理目录(/var/lib/dpkg/),是否有其他进程正占用它?
Linux 报错:Could not get lock /var/lib/dpkg/lock 该如何解决呢? - 封兴旺 - 博客园 (cnblogs.com)
编译 flex 报段错误:
1.修改 host-flex-2.6.4/configure.ac:
@@ -25,8 +25,10 @@
# autoconf requirements and initialization
AC_INIT([the fast lexical analyser generator],[2.6.4],[flex-help@lists.sourceforge.net],[flex])
+AC_PREREQ([2.60])
AC_CONFIG_SRCDIR([src/scan.l])
AC_CONFIG_AUX_DIR([build-aux])
+AC_USE_SYSTEM_EXTENSIONS
LT_INIT
AM_INIT_AUTOMAKE([1.15 -Wno-portability foreign std-options dist-lzip parallel-tests subdir-objects])
AC_CONFIG_HEADER([src/config.h])
@@ -166,6 +166,7 @@ strtol dnl
AC_CHECK_FUNCS([dnl
pow dnl Used only by "examples/manual/expr"
setlocale dnl Needed only if NLS is enabled
+ reallocarr dnl NetBSD function. Use reallocarray if not available.
reallocarray dnl OpenBSD function. We have replacement if not available.
])
2.修改 host-flex-2.6.4/src/misc.c:
@@ -142,7 +142,14 @@ void add_action (const char *new_text)
void *allocate_array (int size, size_t element_size)
{
- void *mem;
+ void *new_array;
-#if HAVE_REALLOCARRAY
+#if HAVE_REALLOCARR
-
- /* reallocarray has built-in overflow detection */
- mem = reallocarray(NULL, (size_t) size, element_size);
+ new_array = NULL;
+ if (reallocarr(&new_array, (size_t) size, element_size))
+ flexfatal (_("memory allocation failed in allocate_array()"));
#else
+# if HAVE_REALLOCARRAY
+ new_array = reallocarray(NULL, (size_t) size, element_size);
+# else
+ /* Do manual overflow detection */
size_t num_bytes = (size_t) size * element_size;
- mem = (size && SIZE_MAX / (size_t) size < element_size) ? NULL :
+ new_array = (size && SIZE_MAX / (size_t) size < element_size) ? NULL :
malloc(num_bytes);
+# endif
+ if (!new_array)
+ flexfatal (_("memory allocation failed in allocate_array()"));
#endif
- if (!mem)
- flexfatal (_
- ("memory allocation failed in allocate_array()"));
-
- return mem;
+ return new_array;
}
@@ -667,21 +664,21 @@ void *reallocate_array (void *array, int size, size_t element_size)
void *reallocate_array (void *array, int size, size_t element_size)
{
void *new_array;
-#if HAVE_REALLOCARRAY
+#if HAVE_REALLOCARR
+ new_array = array;
+ if (reallocarr(&new_array, (size_t) size, element_size))
+ flexfatal (_("attempt to increase array size failed"));
- /* reallocarray has built-in overflow detection */
- new_array = reallocarray(array, (size_t) size, element_size);
#else
+# if HAVE_REALLOCARRAY
+ new_array = reallocarray(array, (size_t) size, element_size);
+# else
+ /* Do manual overflow detection */
size_t num_bytes = (size_t) size * element_size;
new_array = (size && SIZE_MAX / (size_t) size < element_size) ? NULL :
realloc(array, num_bytes);
-#endif
+# endif
if (!new_array)
flexfatal (_("attempt to increase array size failed"));
+#endif
return new_array;
}
2.libavformat/http.c:25:10: fatal error: zlib.h: 没有那个文件或目录
sudo apt-get install zlib1g-dev
本文来自博客园,作者:封兴旺,转载请注明原文链接:https://www.cnblogs.com/fxw1/p/16769840.html