我正在尝试apt-utils
在Docker 上安装,因为当我刚刚做的时候apt-get update
,我收到了错误:debconf: delaying package configuration, since apt-utils is not installed
.所以我添加了一行安装apt-utils
(连同curl
):
RUN apt-get update && apt-get install -y apt-utils && apt-get install -y curl
Run Code Online (Sandbox Code Playgroud)
但是,我仍然遇到这个错误,导致我相信我的命令不起作用.当我尝试构建图像时,下面是我的输出.
Step 5/12 : RUN apt-get update && apt-get install -y apt-utils && apt-get install -y curl
---> Running in 6e6565ff01bd
Get:1 http://security.debian.org jessie/updates InRelease [94.4 kB]
Ign http://deb.debian.org jessie InRelease
Get:2 http://deb.debian.org jessie-updates InRelease [145 kB]
Get:3 http://deb.debian.org jessie Release.gpg [2420 B]
Get:4 http://deb.debian.org jessie …
Run Code Online (Sandbox Code Playgroud) 为什么libc_nonshared.a
存在?它的目的是什么?我一直无法在网上找到关于它存在的好答案。
据我可以告诉它提供了某些符号(stat
,lstat
,fstat
,atexit
,等等)。如果有人在他们的代码中使用这些函数之一,它将被链接到这个存档中的最终可执行文件。这些函数是 POSIX 标准的一部分并且非常常见,所以我不明白为什么它们不会分别放在 shared 或 staticlibc.so.6
或 中libc.a
。
根据这些指示,我一直在尝试与主管一起设置gunicorn .但是,当我跑
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start Server-CardLearning
Run Code Online (Sandbox Code Playgroud)
我收到了错误Server-CardLearning: ERROR (spawn error)
.
我的配置文件很简单.
[program:Server-CardLearning]
command = gunicorn app:app -b localhost:8000
directory = /home/alexg/www/<flask project>
user = www-data
Run Code Online (Sandbox Code Playgroud)
我在日志文件中收到以下错误.
...
...
2017-11-30 13:48:52,276 INFO gave up: Server-CardLearning entered FATAL state, too many start retries too quickly
2017-11-30 13:49:10,595 INFO spawnerr: unknown error making dispatchers for 'Server-CardLearning': ENOENT
2017-11-30 13:49:11,597 INFO spawnerr: unknown error making dispatchers for 'Server-CardLearning': ENOENT
2017-11-30 13:49:13,599 INFO spawnerr: unknown error …
Run Code Online (Sandbox Code Playgroud) 我的初步了解是:
.dynamic
包含可执行文件需要加载的库.dynsym
包含外部符号,例如 setsockopt@GLIBC_2.0
.dynstr
包含功能要求字符串总体而言,我有点困惑,这些部分是如何共同创造一个二进制-特别是.dynsym
和.dynstr
。所以我的问题有两个方面。我上面的说法正确吗?如果是这样,这三个部分如何协同工作以创建二进制文件?
我正在尝试使用Ionic2构建一个应用程序,允许用户通过Google Street View API 加载StreetViewPanorama对象.加载视图后,用户应该能够以他们选择的任何方式操纵街景(远离原始位置,缩放等).完成此任务后,用户将捕获最终街道视图的静态图像.
当我试图拍摄新街景位置的照片时,我的困难就出现了.我正在尝试使用Google的静态图像生成文档来实现这一目标.不幸的是,在创建对象后,我无法引用Panorama对象的属性.我是Javascript的新手,所以请耐心等待.
要生成街景全景图,我运行以下功能(从底部开始initMap()
):
/**
* Creates the map options for panorama generation. This includes adjusting the coordinate
* position of a user to the nearest available street view. Following creation of the settings,
* it generates the street view on a user's device.
*
* @param userLocation a JSON object whose keys are 'lat' and 'lng' and whose values are
* the corresponding latitude and longitude respectively
*/
generatePanorama(userLocation): void …
Run Code Online (Sandbox Code Playgroud) 我正在尝试按照此处发布的说明让 Font Awesome 图标运行我的 React Native 应用程序。但是,完成说明后,我的模拟器没有加载应用程序,命令行给了我以下错误:
error: bundling failed: Error: While trying to resolve module `@fortawesome/fontawesome-svg-core` from file `/Users/agaidis/Auto-ID-Lab/AudioApp/App.js`, the package `/Users/agaidis/Auto-ID-Lab/AudioApp/node_modules/@fortawesome/fontawesome-svg-core/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/agaidis/Auto-ID-Lab/AudioApp/node_modules/@fortawesome/fontawesome-svg-core/index.js`. Indeed, none of these files exist:
* `/Users/agaidis/Auto-ID-Lab/AudioApp/node_modules/@fortawesome/fontawesome-svg-core/index.js(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json)`
* `/Users/agaidis/Auto-ID-Lab/AudioApp/node_modules/@fortawesome/fontawesome-svg-core/index.js/index(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json)`
at ResolutionRequest.resolveDependency (/Users/agaidis/Auto-ID-Lab/AudioApp/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:92:15)
at DependencyGraph.resolveDependency (/Users/agaidis/Auto-ID-Lab/AudioApp/node_modules/metro/src/node-haste/DependencyGraph.js:237:485)
at Object.resolve (/Users/agaidis/Auto-ID-Lab/AudioApp/node_modules/metro/src/lib/transformHelpers.js:116:25)
at dependencies.map.result (/Users/agaidis/Auto-ID-Lab/AudioApp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:298:29)
at Array.map (<anonymous>)
at resolveDependencies (/Users/agaidis/Auto-ID-Lab/AudioApp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:294:16)
at /Users/agaidis/Auto-ID-Lab/AudioApp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:159:33
at Generator.next (<anonymous>)
at step …
Run Code Online (Sandbox Code Playgroud) 我只是运行以下命令来生成自签名证书:
openssl req -x509 -newkey rsa:4096 -nodes -out cert.pem -keyout key.pem -days 365
Run Code Online (Sandbox Code Playgroud)
执行命令后,我回答了一些关于我的位置等的问题。生成证书时没有错误。然后我添加app.run(ssl_context=('cert.pem', 'key.pem'))
到我的 Flask 应用程序中。
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
""" Home page of the website """
return render_template('index.html')
... Some other functions ...
if __name__ == "__main__":
app.run(ssl_context=('cert.pem', 'key.pem'))
Run Code Online (Sandbox Code Playgroud)
问题是没有任何东西通过 HTTPS 传送。当我运行应用程序时,我得到:
$ flask run
* Running on http://0.0.0.0:5000/
Run Code Online (Sandbox Code Playgroud)
我可以使用 HTTP 正常访问页面,但是当我尝试执行 HTTPS 时,我的浏览器出现以下错误:
An error occurred during a connection to XXXXXXX.XXX.edu:5000.
SSL received a record that exceeded the maximum …
Run Code Online (Sandbox Code Playgroud) 我总是通过 SSH 连接到我的虚拟机,并且在设置完 VM 后不使用 VMWare 的虚拟机窗口/终端。我发现始终打开 VMWare Fusion 应用程序以及 VM 窗口很烦人,因此,我希望能够从终端静默启动 VM,并仅通过终端执行所有其他操作。
我在 VMWare 网站上看到了这个页面,其中讨论了使用以下命令启动虚拟机:
/Applications/VMware\ Fusion.app/Contents/Library/vmrun start full/path/of/your/virtual/machine/bundle
Run Code Online (Sandbox Code Playgroud)
这是朝着正确方向迈出的一步,因为我不需要单击任何内容来启动虚拟机,但是,它仍然会在 Windows 中打开应用程序和虚拟机。
当我使用 Virtual Box 时,我记得可以使用如下命令来执行此操作:
VBoxManage startvm "VM name" --type headless
Run Code Online (Sandbox Code Playgroud)
VMWare 是否有类似的命令可以让我无头运行我的 VM?
我正在尝试使用musl工具链编译各种程序,例如 MariaDB 。也就是说,我不希望在编译完成后对 glibc 或 GNU 的链接器有任何依赖。
到目前为止,我一直在使用 musl 的 GCC 包装器musl-gcc
来编译东西。但是,对于像 MariaDB 这样的大型程序,我很难获得所有必要的库和标头,并且符号链接或添加编译环境变量并没有真正的帮助。
我在这个 GitHub 存储库中看到提到构建一个针对 musl libc 的交叉编译器以及附加文档和代码。来自交叉编译器的文档:
这为您提供了一个完整的、可重定位的 musl 目标工具链,具有 C++ 支持和自己的库路径,您可以将第三方库安装到其中。
听起来这可以帮助我,但我不确定这与 musl 的 GCC 包装器有什么不同,据我所知,它只是改变了 GCC 寻找库和头文件等的位置。
最终,我不确定这个交叉编译器与 GCC 包装器到底有多大不同,以及它对我的情况是否有用。当我可以符号链接到现有库并使用 GCC 包装器时,为什么我需要自己的库路径来安装第三方库?交叉编译器是我应该编译的方式吗,尤其是更大的代码库?
我有一个简单的测试程序,用于fgetc()
从文件流中读取字符并lseek()
读取文件偏移量。它看起来像这样:
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int main() {
char buf[] = "hello world";
FILE *f;
int fd;
fd = open("test.txt", O_RDWR | O_CREAT | O_TRUNC, 0600);
write(fd, buf, sizeof(buf));
lseek(fd, 0, SEEK_SET);
f = fdopen(fd, "r");
printf("%c\n", fgetc(f));
printf("%d\n", lseek(fd, 0, SEEK_CUR));
}
Run Code Online (Sandbox Code Playgroud)
当我运行它时,我得到以下输出:
h
12
Run Code Online (Sandbox Code Playgroud)
的返回值fgetc(f)
,h
,对我来说很有意义。但是为什么要将文件偏移量重新定位到文件末尾呢?为什么不lseek(fd, 0, SEEK_CUR)
给我1?
如果我重复第一个打印语句,它会按预期工作并打印e
then anl
等。
我在man
页面中没有看到任何提及这种奇怪行为的内容。
c ×3
flask ×2
glibc ×2
python ×2
apt ×1
c++ ×1
docker ×1
elf ×1
font-awesome ×1
gcc ×1
google-maps ×1
gunicorn ×1
javascript ×1
libc ×1
linux ×1
macos ×1
musl ×1
react-native ×1
ssl ×1
supervisord ×1
vmware ×1
x86 ×1