生成文件错误:在/ usr / bin中/劳工处:找不到-llibname和makedepend [英] makefile error: /usr/bin/ld: cannot find -llibname and makedepend

查看:184
本文介绍了生成文件错误:在/ usr / bin中/劳工处:找不到-llibname和makedepend的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图写我自己的makefile的小项目,我的项目由包含main.c中,在file1.c,file2.c中,那么header1.h src目录,终于header2.h这些文件使用一些从库非标准库,我已经创建的目录和非标头文件,库目录位于usr / lib目录/ pr__lib和头目录位于usr / include目录/ lib目录
所以我应该创建两个makefile.am一个将被位于src目录,另一个将在项目的根目录,如下图所示的src目录的makefile.am:

I am trying to write my own makefile for small project, my project consists of src directory that contains main.c, file1.c, file2.c, header1.h, and finally header2.h these files use some library from non standard libraries directory that I have created and non standard header file, the libraries directory is located in usr/lib/pr__lib and the header directory is located in usr/include/lib so I should create two makefile.am one will be located in src directory and the other one will be in root directory of the project the makefile.am of the src directory is as shown below:

program_NAME := myproject

AM_CPPFLAGS = \
   -DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \
   -DPACKAGE_SRC_DIR=\""$(srcdir)"\" \
   -DPACKAGE_DATA_DIR=\""$(pkgdatadir)"\"


bin_PROGRAMS = myproject_AutoProject

program_INCLUDE_DIRS := /usr/bin/srr__bin

program_LIBRARY_DIRS := /usr/lib/srr__lib

AM_CFLAGS = 

AM_CFLAGS += $(foreach includedir,$(program_INCLUDE_DIRS),-I$(includedir))

program_lib2 := \
      libsrr\
      libprdsl \
      libtwo \
      libhistogram \
      libhistogram_pic \
      libprlistofarrays \
      libprlistofarrays_pic \
      libprmalloc \
      libvreo 
AM_LDFLAGS = 

AM_LDFLAGS += $(foreach librarydir,$(program_LIBRARY_DIRS),-L$(librarydir))

AM_LDFLAGS += $(foreach library,$(program_lib2),-l$(library))

PRDSL_AutoProject_SOURCES = \
   main.c \
   file1.c \
   file2.c

depend :
    makedepend -$(CFLAGS) -$(PRDSL_AutoProject_SOURCES)

all: $(program_NAME)

第二makefile.am是,如下所示:

the second makefile.am is as shown below:

SUBDIRS = src

myproject_AutoProjectdocdir = ${prefix}/doc/PRDSL_AutoProject
myproject_AutoProjectdoc_DATA = \
  README\
  COPYING\
  AUTHORS\
  ChangeLog\
  INSTALL\
  NEWS


INTLTOOL_FILES = intltool-extract.in \
  intltool-merge.in \
  intltool-update.in

EXTRA_DIST = $(myproject_AutoProjectdoc_DATA) \
   $(INTLTOOL_FILES)

DISTCLEANFILES = intltool-extract \
   intltool-merge \
 intltool-update \
 po/.intltool-merge-cache


# Remove doc directory on uninstall
uninstall-local:
  -rm -r $(PRDSL_AutoProjectdocdir)

但我已经收到以下错误:

but i have received the below error:

 /usr/bin/ld: cannot find -llibsrr
 /usr/bin/ld:.......

和同为图书馆的休息!
我想,在这里取决于指挥的问题,谁能告诉我怎样才能自动创建的依赖,避免人为错误使用取决于命令

and the same for the rest of the libraries! I guess that the problem in the depend command here, can anyone tell me how to use the depend command in order to create the dependency automatically and avoid human errors

推荐答案

可以让这个变化,让我知道:

can you make this change and let me know:

PathToMySource=`pwd` 
Program_INCLUDE_DIRS := /usr/bin/srr__bin

program_LIBRARY_DIRS := /usr/lib/srr__lib

AM_CFLAGS = 

AM_CFLAGS += $(foreach includedir,$(program_INCLUDE_DIRS),-I$(includedir))

program_lib2 := \
      $(PathToMySource)/libsrr\
      $(PathToMySource)/libprdsl \
      $(PathToMySource)/libtwo \
      $(PathToMySource)/libhistogram \
      $(PathToMySource)/libhistogram_pic \
      $(PathToMySource)/libprlistofarrays \
      $(PathToMySource)/libprlistofarrays_pic \
      $(PathToMySource)/libprmalloc \
      $(PathToMySource)/libvreo 
AM_LDFLAGS = 

AM_LDFLAGS += $(foreach librarydir,$(program_LIBRARY_DIRS),-L$(librarydir))

AM_LDFLAGS += $(foreach library,$(program_lib2),-l$(library))

PRDSL_AutoProject_SOURCES = \
   main.c \
   file1.c \
   file2.c

depend :
    makedepend -$(CFLAGS) -$(PRDSL_AutoProject_SOURCES)

all: $(program_NAME)

我假定这两个文件夹是从哪里make文件预计将运行目录。

I am assuming that the folders are in the directory from where the make file is expected to run.

如果他们不请再添变数,并设置路径。然后使用该变量PathToMySource的地方。

If they are not please add another variable and set the path. then use that variable in the place of PathToMySource.

希望这有助于。

这篇关于生成文件错误:在/ usr / bin中/劳工处:找不到-llibname和makedepend的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆