AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 35648
In Process
cd1
cd1
Asked: 2009-07-04 09:58:50 +0800 CST2009-07-04 09:58:50 +0800 CST 2009-07-04 09:58:50 +0800 CST

无法通过网络使 distcc 工作

  • 772

我正在尝试使用distcc通过网络使用多台计算机编译 C/C++ 程序。我现在只使用两台计算机,但我打算在与这两台计算机一起使用时使用更多。

我正在使用 Gentoo,我distcc在两台机器上都安装了以下命令:

[user@pc ~]$ 出现 distcc

我正在使用的机器的 IP/名称是:10.0.0.47 (qc7) 和 10.0.0.46 (qc6)。这些计算机是相同的,我在它们上都安装了完全相同的软件包,并且我distcc以相同的方式进行了配置。

我将机器名称设置为distcc-config:

[user@pc ~]$ distcc-config --set-hosts "qc6 qc7"

我更改了文件/etc/conf.d/distcc以允许两台机器:

...
DISTCCD_OPTS="${DISTCCD_OPTS} --allow 10.0.0.46 --allow 10.0.0.47"
...

之后,我刚刚启动了服务:

[user@pc ~]$ /etc/init.d/distccd 启动

我尝试编译一个简单的 C++ 程序,其中包含一个类 ( .hand .cc) 和一个包含该main函数的文件。代码如下:

人.h

#include <string>

using namespace std;

class Person {
  private:
    string name_;
    int age_;

  public:
    Person(string, int);

    string name() const { return name_; }
    int age() const { return age_; }

    void set_name(string name) { name_ = name; }
    void set_age(int age) { age_ = age; }
};

个人.cc

#include "person.h"

Person::Person(string name, int age)
    : name_(name), age_(age) {}

主文件

#include <iostream>
#include "person.h"

using namespace std;

int main() {
    Person cd1("Cristian",22);
    cout << "hi, my name is " << cd1.name() << " and I'm " << cd1.age() << " years old." << endl;
    return 0;
}

生成文件

CC=g++
CFLAGS=-墙

人:main.o person.o
$(CC) $(CFLAGS) -o person main.o person.o

person.o: person.cc person.h
$(CC) $(CFLAGS) -c person.cc

main.o: main.cc person.h
$(CC) $(CFLAGS) -c main.cc

如果我只运行:

[user@pc ~]$ 制作

不使用distcc,代码编译得很好。但如果我运行:

[user@pc ~]$ make CC=distcc

链接阶段给了我一个错误。这是输出:

distcc -Wall -c main.cc
distcc -Wall -c person.cc
distcc -Wall -o person main.o person.o
main.o:在函数“全局构造函数键控到 main”:
main.cc :(.text+ 0xa): 未定义引用`std::ios_base::Init::Init()'
main.cc:(.text+0x19): 未定义引用`std::ios_base::Init::~Init()'
main .o:在函数'main'中: main.cc:(.
text+0x5a):未定义引用'std::basic_string, std::allocator >::basic_string(char const*, std::allocator const&)'
main .cc:(.text+0x80): 未定义引用`std::basic_string, std::allocator >::_Rep::_S_empty_rep_storage'
main.cc:(.text+0xa4): 未定义引用`std::basic_string , std::allocator >::basic_string(std::basic_string, std::分配器 > const&)'
main.cc:(.text+0xb3): undefined reference to `std::cout'
main.cc:(.text+0xb8): undefined reference to `std::basic_ostream >& std::__ostream_insert >(std:: basic_ostream >&, char const*, long)'
main.cc:(.text+0xc5): undefined reference to `std::cout'
main.cc:(.text+0xce): undefined reference to `std::basic_ostream >& std::__ostream_insert >(std::basic_ostream >&, char const*, long)'
main.cc:(.text+0xe3): 未定义对`std::basic_ostream >& std::__ostream_insert >(std ::basic_ostream >&, char const*, long)'
main.cc:(.text+0xed): undefined reference to `std::basic_ostream >::operator<<(int)'
main.cc:(.text+ 0x102): 对`std::basic_ostream >& std:: 的未定义引用__ostream_insert >(std::basic_ostream >&, char const*, long)'
main.cc:(.text+0x182): 未定义引用 `std::basic_ostream >::put(char)'
main.cc:(.text+0x18a): 未定义引用`std::basic_ostream >::flush ()'
main.cc:(.text+0x1d9): undefined reference to `std::__throw_bad_cast()'
main.cc:(.text+0x208): undefined reference to `std::basic_string, std::allocator > ::_Rep::_M_destroy(std::allocator const&)'
main.cc:(.text+0x243): 未定义引用`std::basic_string, std::allocator >::_Rep::_M_destroy(std::allocator const&)'
main.cc:(.text+0x277): undefined reference to `std::basic_string, std::allocator >::_Rep::_M_destroy(std::allocator const&)'
main.cc:(.text+ 0x292): 未定义引用`std::basic_string, std::allocator >::~basic_string()'
main.cc:(.text+0x2af): 未定义引用 `std::basic_string, std::allocator >::~basic_string()'
main.cc:(.text+0x2bc): 未定义引用`std:: basic_string, std::allocator >::~basic_string()'
main.o:(.eh_frame+0x13): undefined reference to `__gxx_personality_v0'
person.o: In function `Person::Person(std::basic_string, std: :allocator >, int)':
person.cc:(.text+0x15): undefined reference to `std::basic_string, std::allocator >::basic_string(std::basic_string, std::allocator > const&)'
person.o:在函数‘Person::Person(std::basic_string, std::allocator >, int)’中:
person.cc:(.text+0x45): 未定义引用‘std::basic_string, std::分配器 >::basic_string(std::basic_string, std::allocator >常量&)'
person.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
distcc[26001] ERROR: compile (null) on localhost failed
make: *** [person] Error 1

[粗体线是唯一与 相关的distcc,其他都是编译器输出。]

好像distcc找不到基本库。我应该怎么做才能distcc使用网络上的多台计算机编译这个程序?是我错过了一些配置吗?

networking gentoo
  • 2 2 个回答
  • 736 Views

2 个回答

  • Voted
  1. pjc50
    2009-10-28T04:22:15+08:002009-10-28T04:22:15+08:00

    尝试不要将 distcc 用于链接阶段。也就是说,使用

    LD=g++

    person: main.o person.o
    $(LD) $(LDFLAGS) -o person main.o person.o
    

    在你的 Makefile 中。

    • 1
  2. pjz
    2009-07-07T20:44:38+08:002009-07-07T20:44:38+08:00

    也许这是一个愚蠢的问题,但是......你确定你在两台机器上都放置了所需的头文件和库吗?

    • 0

相关问题

  • 10 Gb 网络:在光纤和双绞线之间做出决定

  • 如何在 Windows Server PPTP VPN 中自动为客户端分配路由?

  • 为什么我的电脑休眠时 VPN 连接会中断?[关闭]

  • 有什么软件可以模拟局域网?

  • 带宽利用工具?[关闭]

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    从 IP 地址解析主机名

    • 8 个回答
  • Marko Smith

    如何按大小对 du -h 输出进行排序

    • 30 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    Windows 中执行反向 DNS 查找的命令行实用程序是什么?

    • 14 个回答
  • Marko Smith

    如何检查 Windows 机器上的端口是否被阻塞?

    • 4 个回答
  • Marko Smith

    我应该打开哪个端口以允许远程桌面?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    MikeN 在 Nginx 中,如何在维护子域的同时将所有 http 请求重写为 https? 2009-09-22 06:04:43 +0800 CST
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    0x89 bash中的双方括号和单方括号有什么区别? 2009-08-10 13:11:51 +0800 CST
  • Martin Hope
    kch 如何更改我的私钥密码? 2009-08-06 21:37:57 +0800 CST
  • Martin Hope
    Kyle Brandt IPv4 子网如何工作? 2009-08-05 06:05:31 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve