我在安装了GCC 4.4.5的gentoo linux上.我可以使用gcc main.c -o main编译和链接这样的程序而没有任何错误,并且命令./main正确返回结果.
[main.c]
#include <math.h>
#include <stdio.h>
int main(void)
{
double c = ceil(2.5);
printf("The ceil of 2.5 is %f\n", c);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
但是,当我将ceil的调用放入另一个源文件时,就会出现问题.
[calc.h]
#ifndef _CALC_H_
#define _CALC_H_
double myceil(double n);
#endif
[calc.c]
#include <math.h>
#include "calc.h"
double myceil(double n)
{
return ceil(n);
}
[main1.c]
#include <stdio.h>
#include "calc.h"
int main(void)
{
double c = myceil(2.5);
printf("The ceil of 2.5 is %f\n", c);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
使用命令gcc …
背景:我正在考虑在 Gentoo Linux 中开发一个类似于 portage 的包管理器(我最终可能会 fork portage)。对于那些对 Gentoo 知之甚少的人来说,它是一个基于源代码的发行版,这意味着所有包都是从源代码编译的。目前可以将程序编译成目标文件,然后编译成可执行文件。
$ gcc -c a.c -o a.o
$ gcc -c b.c -o b.o
$ gcc a.o b.o -o executable
Run Code Online (Sandbox Code Playgroud)
我想对 portage 进行的改进如下。
推理:我是一名 Arch Linux 用户,喜欢基于源代码的发行版的想法,但无法为保持系统最新的艰巨任务而烦恼。我的大部分工作也是在带有小型硬盘驱动器的笔记本电脑上完成的,因此将可执行文件反编译/取消链接到目标文件而不是仅仅保留占用大量空间的目标文件。它还可能减少系统的整体编译时间,因为重新编译大部分源代码的需要将大大减少。它还允许一种简单的方法来更改包上的 USE 标志,而无需完全重新编译。
问题:是否可以将目标文件编译为可执行文件,然后反编译回目标文件。下面是一个例子。
$ gcc -c a.c -o a.o
$ gcc -c b.c -o b.o
$ gcc a.o b.o -o executable
Run Code Online (Sandbox Code Playgroud)
进而
$ SomeCommand executable
output << a.o b.o
Run Code Online (Sandbox Code Playgroud)
如果目前无法做到这一点。是否可以修改 GNU 链接器“ $ld
”的一个版本来记录链接目标文件时所做的更改,从而故意使程序“可逆向工程”??? …
我正在尝试在Gentoo系统上从源代码安装tensorflow(我认为我需要这样做才能使用CUDA 9.1)。
我能够构建tensorflow,然后以以下用户身份安装它:
pip3 install --no-cache-dir --user /tmp/tensorflow_pkg/tensorflow-1.6.0rc1-cp35-cp35m-linux_x86_64.whl
Run Code Online (Sandbox Code Playgroud)
当我尝试导入tensorflow时,我得到:
>RuntimeError Traceback (most recent call last)
>RuntimeError: module compiled against API version 0xc but this version of numpy is 0xb
>
>ImportError Traceback (most recent call last)
>ImportError: numpy.core.multiarray failed to import
>
>ImportError Traceback (most recent call last)
>ImportError: numpy.core.umath failed to import
>
>ImportError Traceback (most recent call last)
>ImportError: numpy.core.umath failed to import
Run Code Online (Sandbox Code Playgroud)
所以我的猜测是tensorflow是针对不同于我的系统默认版本(1.13.3)的numpy版本构建的。
问题是如何解决?我对这个过程有很多陌生的知识,因此,如果有以下任何建议,我将不胜感激:
任何帮助表示赞赏!
我搜索了网络和手册,但我只是设法了解蒙面包的内容,而不是如何安装它.我确实找到了一些命令,但它们似乎在2008年没有工作(看着它,似乎那些是早期版本).我有这样的事情:
localhost ~ # emerge flamerobin
Calculating dependencies
!!! All ebuilds that could satisfy "dev-db/flamerobin" have been masked.
!!! One of the following masked packages is required to complete your request:
- dev-db/flamerobin-0.8.6 (masked by: ~x86 keyword)
- dev-db/flamerobin-0.8.3 (masked by: ~x86 keyword)
Run Code Online (Sandbox Code Playgroud)
我想安装0.8.6版本,但不知道如何?我找到了一些说明,但是他们告诉我编辑或写入/ etc/portage下的一些文件.但是,我的系统上没有/ etc/portage:
localhost ~ # ls /etc/portage
ls: cannot access /etc/portage: No such file or directory
Run Code Online (Sandbox Code Playgroud) 有谁知道如何在apache下安装/配置php?
我已经出现了php apache.我想在GENTOO OS中使用mod_php进行apache.
php temp.php
命令行运行正常,但http://localhost/temp.php没有在Web服务器上执行,而是显示php代码的内容.
我一直在尝试在Gentoo上安装Sass,但它并没有太顺利.不幸的是,最新版的Sass in portage是3.1.21.我想要使用Sass,至少需要Sass 3.2,可以通过rubygems获得.
我尝试过的:
emerge dev-ruby/sass
(安装旧版本)gem install sass
第二个命令似乎安装了Sass gem.但是,除了Sass之外,我不会在任何其他方面使用Rails或Ruby,所以宝石对我来说似乎毫无用处.另外,我不知道gem
s的安装位置或使用方法(我是一个ruby noob.)我想做的就是sass
从命令行调用.
有没有办法获得最新版本的Sass,我可以在命令行中使用它?
干杯.
我最近已从默认的binutils链接程序ld.bfd切换到ld.gold(以使链接时间优化工作正常,为什么不这样做?)。它是手工制作的(例如:http://wiki.gentoo.org/wiki/Gold)。结果,我得到了从/ usr / bin / ld到ld.gold二进制文件的符号链接链,因此在构建过程中透明更改了链接器。
但是,当我尝试重建所有软件包时,我发现ld.gold有时会导致配置/编译失败,例如“ C编译器无法创建可执行文件”:
checking for x86_64-pc-linux-gnu-gcc... x86_64-pc-linux-gnu-gcc
checking whether the C compiler works... no
configure: error: in `/var/tmp/portage/sys-libs/db-6.0.30-r1/work/db-6.0.30/build_unix-abi_x86_64.amd64':
configure: error: C compiler cannot create executables
Run Code Online (Sandbox Code Playgroud)
哪个实际上是链接器问题:
configure: checking whether the C compiler works
/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.4/../../../../x86_64-pc-linux-gnu/bin/ld: --default-symver: unknown option
/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.4/../../../../x86_64-pc-linux-gnu/bin/ld: use the --help option for usage information
collect2: error: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)
但是可以使用默认的bfd链接器成功构建软件包,因此问题是对于不能使用ld.gold构建的软件包,如何返回bfd链接器?
问题软件包为= sys-libs / db-6.0.30-r1(目前引起我注意的软件包)。
有没有办法在 Gentoo amd64 系统上安装 rstan?rstan 依赖于 v8-r ( https://cran.r-project.org/web/packages/V8/index.html ),它依赖于 v8 安装。我还没有找到可用的 v8 ebuild,v8 无法使用 didactic-duck ebuilds 进行编译。我也尝试过nodejs,但没有成功。从源代码编译 v8 失败,并显示“不支持的 linux 发行版”。
谢谢,斯文
我设置Phorum在我的本地服务器(Ubuntu Jaunty)上使用搜索引擎友好的URL.它工作得很好.将站点移动到生产服务器(Gentoo)后,我找不到所有页面的404.下面的mod_rewrite日志显示了问题.
两个安装都使用相同的规则:
RewriteEngine On
# READ RULES
RewriteRule ^([0-9]*)/([0-9]*)/([0-9]*)/([0-9a-zA-Z\-_=]*)/(.*)$ read.php?$1,$2,$3,$4
RewriteRule ^([0-9]*)/([0-9]*)/([0-9]*)/(.*)$ read.php?$1,$2,$3
RewriteRule ^([0-9]*)/([0-9]*)/([0-9a-zA-Z\-_=]*)/(.*)$ read.php?$1,$2,$3
RewriteRule ^([0-9]*)/([0-9]*)/(.*)$ read.php?$1,$2
RewriteRule ^([0-9]*)/([0-9]*)$ read.php?$1,$2
# DEFAULT RULES
RewriteRule ^([a-z]*)/([0-9]*)/([0-9a-zA-Z=_\-]*)/([0-9a-zA-Z=_\-]*)/([0-9a-zA-Z=_\-]*)$ $1.php?$2,$3,$4,$5
RewriteRule ^([a-z]*)/([0-9]*)/([0-9a-zA-Z=_\-]*)/([0-9a-zA-Z=_\-]*)$ $1.php?$2,$3,$4
RewriteRule ^([a-z]*)/([0-9]*)/([0-9a-zA-Z=_\-/:\.?]*)$ $1.php?$2,$3
RewriteRule ^([a-z]*)/([0-9]*)$ $1.php?$2
RewriteRule ^([a-z]+)$ $1.php
Run Code Online (Sandbox Code Playgroud)
在我的本地服务器上,重写规则行为正确:
88.88.88.8 - - [09/Jun/2009:11:32:49 +0100] [home.mapledesign.co.uk/sid#b81b3280][rid#b8395ae8/initial] (2) init rewrite engine with requested uri /forums/list/3
88.88.88.8 - - [09/Jun/2009:11:32:49 +0100] [home.mapledesign.co.uk/sid#b81b3280][rid#b8395ae8/initial] (1) pass through /forums/list/3
88.88.88.8 - - [09/Jun/2009:11:32:49 +0100] [home.mapledesign.co.uk/sid#b81b3280][rid#b8395ae8/initial] (3) [perdir /var/www/mydomain/web/forums/] add path info postfix: /var/www/mydomain/web/forums/list …
Run Code Online (Sandbox Code Playgroud) 我如何在Pepper上安装东西,因为我不知道它使用什么包管理器.我通常在我的Ubuntu机器上使用apt,并希望在Pepper上安装一些软件包.我不确定包管理器Pepper有什么(如果有的话)并希望安装一些软件包,但也只知道使用apt的软件包名称(不确定软件包名称是否与其他软件包管理器相同).如果可能的话,我能否在Pepper上安装apt.谢谢.
注意:从我所做的研究中,Pepper正在使用基于Gentoo的NaoQi,它使用了portage.