ruby-on-rails - 如何在没有 root 访问权限的服务器上安装 SQLite3 for Rails
问题描述
我正在尝试在我们的托管服务器上创建一个 Ruby on Rails“Hello World”应用程序,其中没有 root 或sudo
可能。
Ruby 是 2.3.3p222 版本,Rails 是 v5.2.4.1。
我曾经rails new testproject
创建我的“Hello World”测试。这失败了,bundle install
因为我无法在系统中安装 gems
Error "Your user account isn't allowed to install to the system RubyGems"
转到testproject
文件夹并输入:
bundle install --path ~/.gem
返回:
This failed with *"An error occurred while installing sqlite3 (1.4.2),
and Bundler cannot continue."*
The reason is an compiler error: *"conftest.c:13:57: error:
‘pthread_create’ undeclared (first use in this function)"* Problem:
The compiler can't find pthread because the *pthread.h* not included.
The only include in the conftest.c is *#include "ruby.h"* and this is
included from the system includes.
我从日志文件中提取了 gcc 命令,更改了包含文件夹的顺序,因此我的本地包含文件夹现在是第一个。我在本地包含中放置了一个虚拟的“ruby.h”,其中包括系统包含文件夹中的“pthread.h”和“ruby.h”。
新的 gcc 命令是:
gcc -o conftest -I/usr/home/admin/include -I/usr/include/x86_64-linux-gnu/ruby-2.3.0 -I/usr/include/ruby-2.3.0/ruby/backward -I/usr/include/ruby-2.3.0 -I. -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/ruby2.3-LPgLkQ/ruby2.3-2.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DTAINTING_SUPPORT conftest.c -L. -L/usr/lib/x86_64-linux-gnu -L. -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -lruby-2.3 -lfalse -lpthread -lgmp -ldl -lcrypt -lm -lc
现在出现新错误:
cannot find -lfalse
当我-lfalse
从 gcc 命令中删除时,我不再收到错误。
所以现在我知道“pthread.h”的缺失包含是我的第一个问题。这-lfalse
是第二个。但是我该如何解决呢?我怎么知道bundle install
要包含 pthread.h?为什么有一个-lfalse
?
我花了几个小时才达到这一点,但我现在不知道如何继续。
解决方案
推荐阅读
- javascript - 带有可点击链接的剑道网格
- vb.net - 是否可以在 VB.net 中测试两种类型是否具有相同的未知继承?
- vb.net - VB.NET 如何正确循环遍历结果集
- java - Spring 未从属性文件加载 AWS-SNS 凭证
- c# - 从 PredicateBuilder 中剥离字符以提高搜索准确性
- javascript - 使用自定义 `tslint` 规则,无需从 typescript 编译
- audio - 从 Arduino 中的 FFT 检测特定模式
- sql - 如果类型为“10”,则不显示客户名称“a”
- javascript - 从字节缓冲区转换为字符串,然后在 NodeJS / Javascript 中转换回字节
- python - “CommentForm”对象没有属性“cleaned_data”