【问题标题】:redoing install program (Linux)重做安装程序 (Linux)
【发布时间】:2015-04-29 00:29:36
【问题描述】:

我分叉了 setroot 并将其重命名为 mhsetroot。当我在运行 32 位 linux (Chrunchbang) 系统时添加所有新功能时。现在我得到了一台带有 Crunchbang 的新 64 位笔记本电脑。它也应该运行 32 位。但它不会使用 ./configure - make - sudo make install 安装我的程序。

它第一次说我的 .o 文件不兼容或类似的东西。所以我重新编译它,然后使用这条线再次尝试(第二天)

gcc `-m32 imlib2-config --cflags` `imlib2-config --libs` -o mhsetroot32 mhsetroot-v1.6.2.c

然后将 .o 文件的名称更改为与前一个文件一致,然后进行 ./configure。那行得通,但是,现在在我运行第一个“make”之后,我现在得到了这个错误。

  dude@crunchbang64:~/downloads/mhsetroot-v1.6.2$ make
Making all in src
make[1]: Entering directory `/home/dude/downloads/mhsetroot-v1.6.2/src'
gcc -g -O2  -Wall -g -O2   -o mhsetroot mhsetroot-v1.6.2.o  -L/usr/lib      -lImlib2 -L/usr/lib/x86_64-linux-gnu -lfreetype -lz -lX11 -lXext -ldl -lm
mhsetroot-v1.6.2.o: In function `_fini':
(.fini+0x0): multiple definition of `_fini'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crti.o:   (.fini+0x0): first defined here
mhsetroot-v1.6.2.o: In function `__data_start':
(.data+0x0): multiple definition of `__data_start'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crt1.o: (.data+0x0): first defined here
mhsetroot-v1.6.2.o: In function `__data_start':
(.data+0x8): multiple definition of `__dso_handle'
/usr/lib/gcc/x86_64-linux-gnu/4.7/crtbegin.o:(.data+0x0): first defined here
mhsetroot-v1.6.2.o:(.rodata+0x0): multiple definition of `_IO_stdin_used'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crt1.o:(.rodata.cst4+0x0): first defined here
mhsetroot-v1.6.2.o: In function `_start':
(.text+0x0): multiple definition of `_start'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux- gnu/crt1.o:(.text+0x0): first defined here
mhsetroot-v1.6.2.o: In function `_init':
(.init+0x0): multiple definition of `_init'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crti.o:(.init+0x0): first defined here
/usr/lib/gcc/x86_64-linux-gnu/4.7/crtend.o:(.tm_clone_table+0x0): multiple definition of `__TMC_END__'
mhsetroot-v1.6.2.o:(.data+0x10): first defined here
/usr/bin/ld: error in mhsetroot-v1.6.2.o(.eh_frame); no .eh_frame_hdr table will be created.
collect2: error: ld returned 1 exit status
make[1]: *** [mhsetroot] Error 1
make[1]: Leaving directory `/home/dude/downloads/mhsetroot-v1.6.2/src'
make: *** [all-recursive] Error 1
dude@crunchbang64:~/downloads/mhsetroot-v1.6.2$ 

因为我在运行 32 位 linux 时所做的只是找到了一个旧的安装 makefile - 然后整个事情只是修改它以与我的程序一起工作,所以现在我该怎么做才能让它再次在我的64位Linux?

【问题讨论】:

  • 如果你想要一个 32 位的可执行文件,你必须将 -m32 添加到 both 编译 链接行。您在上面的链接行中没有它。正如 Etan 指出的那样,您的示例非常糟糕,因此它显然不是您实际使用的:请直接从终端使用剪切和粘贴到问题,而不是尝试手动重新输入。您在转录中犯的错字将从根本上削弱我们提供帮助的能力。
  • 复制粘贴到代码区
  • 我说的是你的编译行,在第一个代码示例中,正如 Etan 在下面指出的那样。您的第二个代码示例显示 LINK 行,但不显示 compile 行。该链接失败了,但正如 Etan 指出的那样,它可能由于编译步骤中的错误而失败。您在此处引用的编译步骤显然无效,因此我们不确定链接行中使用的目标文件是如何创建的,因此我们无法提供帮助。

标签: c++ linux makefile 64-bit 32bit-64bit


【解决方案1】:

这个

`-m32 imlib2-config --cflags`

不正确并且不会起作用,因此这不是您实际使用的命令。

gcc 行也不会创建目标文件,它会创建二进制文件。

您离开 -c 参数以停止编译。

这很可能是问题所在,因为您接着尝试将一个二进制文件链接到另一个二进制文件。

【讨论】:

  • 我不熟悉 C++,就像一年前我第一次添加到 setroot 程序时一样,所以我真的不记得我在命令行中编译它的所有内容,但是我放了什么在编译它的代码区域给了我一个没有 .o 扩展名的文件。
  • 这个命令gcc -m32 `imlib2-config --cflags` `imlib2-config --libs` -o mhsetroot32 mhsetroot-v1.6.2.c 将从mhsetroot-v1.6.2.c 文件创建一个mhsetroot32 二进制文件(请注意,我移动了第一个反引号)。如果这就是您所需要的,那么只需尝试运行它。如果您需要mhsetroot.o 文件(链接到其他二进制文件),则需要将-c 添加到该命令行以防止链接,然后您可以稍后将该mhsetroot.o 文件链接到二进制文件中。此外,如果您尝试构建 64 位二进制文​​件,则根本不需要 -m32
  • 我不确定是否可以将其制成 64 位二进制文​​件,只是因为代码是用 32 位编写的。我认为将其设为 64 位并不重要。它所做的一切都是在我添加到它的任何选项中将图像设置到桌面,然后也改变桌面上的颜色,程序。我认为对于这个程序来说,保持 32 位是可以的。
猜你喜欢
  • 1970-01-01
  • 2014-02-17
  • 1970-01-01
  • 2021-01-27
  • 1970-01-01
  • 1970-01-01
  • 2012-04-17
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多