【问题标题】:Makefile unable to install softwareMakefile 无法安装软件
【发布时间】:2014-04-12 18:02:19
【问题描述】:

所以我试图编辑一个 makefile 以在 Unix 系统上安装软件,但我似乎做错了什么,因为 make install 一直失败。

这是我运行make install后得到的结果:

/usr/sbin/install -m 555 audit /export/home/student/epoll390/bin/audit cp: audit 
and /export/home/student/epoll390/bin/audit are identical *** 
Error code 2 make: Fatal error: Command failed for target `install' 

如果有人能提供一些关于我做错了什么的见解,我将不胜感激。生成文件如下。

# Make file for audit

# Location to install binary. Default is /usr/local/bin. You may
# prefer to install it in /usr/bin or /sbin
BINDIR  = /export/home/student/epoll390/bin
#BINDIR=/usr/bin
#BINDIR=/usr/sbin

# Location to install man page. Default is /usr/local/man. You may
# prefer to install it in /usr/man
MANDIR  = /export/home/student/epoll390/bin
#MANDIR = /usr/man

# Compiler to use
CC  = gcc

# Linker to use
LD  = gcc

# Preprocessor options
CPPFLAGS = -DGETOPTLONG

# Compile and link options
# On a.out systems you might want to add -N when linking
# RPM_OPT_FLAGS can be set by rpm tool
# ...For production code
CFLAGS  = -Wall -O3 $(RPM_OPT_FLAGS)
LDFLAGS = -s
# ...For debug
#CFLAGS = -Wall -g
#LDFLAGS = -g

audit:  audit.o
    $(LD) $(LDFLAGS) -o audit audit.o

audit.o: audit.c
    $(CC) $(CPPFLAGS) $(CFLAGS) -c audit.c

install: audit
    /usr/sbin/install -m 555 audit $(BINDIR)/audit
    /usr/sbin/install -m 444 audit.1 $(MANDIR)/man1/audit.1

clean:
    $(RM) audit audit.o core *~ results

# check in
ci: clean
    -ci -l *

dist:   clean
    cd .. ; tar --exclude RCS -czvf audit-0.2.tar.gz audit-0.2

【问题讨论】:

  • 您说具体来说,... 但您提供的描述绝非具体。请显示您输入的实际命令和您收到的确切错误消息(剪切和粘贴)。这类转述的问题描述无助于我们为您提供帮助。
  • 对不起,我没有更具描述性。这是我运行 make install 后得到的结果: /usr/sbin/install -m 555 audit /export/home/student/epoll390/bin/audit cp: audit and /export/home/student/epoll390/bin/audit are相同的 *** 错误代码 2 make:致命错误:目标“安装”的命令失败
  • 另外,我试图在不使用 configure 的情况下执行此操作,以便了解 makefile 中实际发生的情况。

标签: unix makefile installation solaris


【解决方案1】:

错误消息向我表明您在目录/export/home/student/epoll390/bin 中运行make install,这恰好是您设置为BINDIR 的内容。因此,cp(被install 程序巧妙地伪装)拒绝执行它(通常正确)认为的错误,即将文件复制到自身。

要修复,请在该目录中运行make clean,创建/home/student/epoll390/audit,将所有源文件和makefile 移动到新目录中,cd 移动到新目录中,然后重试。

【讨论】:

    猜你喜欢
    • 2017-11-02
    • 2020-05-15
    • 2020-09-26
    • 2020-09-02
    • 2021-10-06
    • 2023-03-09
    • 1970-01-01
    相关资源
    最近更新 更多