如何将 TMPDIR 环境变量设置为另一个目录? [英] How to set the TMPDIR environment variable to another directory?

查看:106
本文介绍了如何将 TMPDIR 环境变量设置为另一个目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编译 ffmpeg,但 tmp 目录有问题,因为它是用 noexec 挂载的:

I'M triyng to compile ffmpeg and there is a problem with tmp dir because is mounted with noexec:

./configure --enable-libmp3lame --enable-libvorbis --disable-mmx--enable-shared 无法在/tmp 中创建和执行文件.将 TMPDIR 环境变量设置为另一个目录并确保它没有挂载 noexec.健全性测试失败.

./configure --enable-libmp3lame --enable-libvorbis --disable-mmx --enable-shared Unable to create and execute files in /tmp. Set the TMPDIR environment variable to another directory and make sure that it is not mounted noexec. Sanity test failed.

如果您认为 configure 有误,请确保您使用的是来自 SVN 的最新版本.如果最新版本失败,请报告ffmpeg-user@mplayerhq.hu 邮件列表或 IRC #ffmpeg 上的问题irc.freenode.net.包括由产生的日志文件config.err"配置,因为这将有助于解决问题.

If you think configure made a mistake, make sure you are using the latest version from SVN. If the latest version fails, report the problem to the ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net. Include the log file "config.err" produced by configure as this will help solving the problem.

如何将 TMPDIR 环境变量设置为另一个目录?

How to set the TMPDIR environment variable to another directory?

推荐答案

我能够使用下面的代码完成它:

I was able to get it done using that code bellow:

$ export TMPDIR=~/tmp-ffmpeg

$ mkdir $TMPDIR

$ ./configure \
  --enable-gpl \
  --enable-version3 \
  --enable-shared \
  --enable-nonfree \
  --enable-postproc \
  --enable-libfaac \
  --enable-libmp3lame \
  --enable-libopencore-amrnb \
  --enable-libopencore-amrwb \
  --enable-libtheora \
  --enable-libvorbis \
  --enable-libvpx \
  --enable-libx264 \
  --enable-libxvid \
  --enable-x11grab \
  --extra-cflags="-I/usr/local/include" \
  --extra-ldflags="-L/usr/local/lib"

$ make
$ make install
$ rm -rf $TMPDIR
$ unset TMPDIR

还有 mktemp(1) 命令.以便您可以按如下方式设置 TMPDIR:

There is also mktemp(1) command. So that you can set TMPDIR as follows:

$ TMPDIR="$(mktemp -d -q ~/tmp/tmp.XXXXX)"
$ echo $TMPDIR
/home/marcelo/tmp/tmp.I8V9H

这应该适用于 GNU coreutils 以及 BSD(macOs、FreeBSD 等).另请注意,您无需导出 TMPDIR 然后取消设置.而是尝试直接将变量传递给配置:

This should work for GNU coreutils as well as for BSD (macOs, FreeBSD, etc). Also note, you not need to export TMPDIR and then unset it. Instead try to pass variable directly to configure:

$ TMPDIR="/foo/bar/baz" ./configure ...

希望它可以帮助其他人;-)

Hope it helps somebody else ;-)

这篇关于如何将 TMPDIR 环境变量设置为另一个目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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