【问题标题】:How to build MFOC from sources on Kali Linux?如何在 Kali Linux 上从源代码构建 MFOC?
【发布时间】:2019-07-19 02:12:06
【问题描述】:

我必须配置和制作GitHub | MFOC,但是当我运行./configure 时,它会说:

# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of gcc... gcc3
checking whether make supports nested variables... (cached) yes
#Here the error
./configure: line 3930: syntax error near unexpected token `libnfc,'
./configure: line 3930: `PKG_CHECK_MODULES(libnfc, libnfc >= $LIBNFC_REQUIRED_VERSION, , AC_MSG_ERROR([libnfc >= $LIBNFC_REQUIRED_VERSION is mandatory.]))'

我想到了 3 个可能的错误原因:

  1. 出现错误是因为请求的路径或名称之间存在差异。

事实上,synaptic 说我的 Kali Linux 中的 libnfc 是:

library: libnfc5, 1.7.1-b4
binaries: libnfc-bin, 1.7.1-b4

所以问题可能在于 libnfc 前 5 个

  1. 预期的路径不同

  2. Libnfc 1.7.1 不受支持,因为上次更新(ChangeLog 的第 16 行)适用于 1.7.0。

你能帮帮我吗?


我报告了configure的帮助,也许很有趣

# ./configure -help
`configure' configures mfoc 0.10.7 to adapt to many kinds of systems.

Usage: ./configure [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

Configuration:
  -h, --help              display this help and exit
      --help=short        display options specific to this package
      --help=recursive    display the short help of all the included packages
  -V, --version           display version information and exit
  -q, --quiet, --silent   do not print `checking ...' messages
      --cache-file=FILE   cache test results in FILE [disabled]
  -C, --config-cache      alias for `--cache-file=config.cache'
  -n, --no-create         do not create output files
      --srcdir=DIR        find the sources in DIR [configure dir or `..']

Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [PREFIX]

By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc.  You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.

For better control, use the options below.

Fine tuning of the installation directories:
  --bindir=DIR            user executables [EPREFIX/bin]
  --sbindir=DIR           system admin executables [EPREFIX/sbin]
  --libexecdir=DIR        program executables [EPREFIX/libexec]
  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
  --libdir=DIR            object code libraries [EPREFIX/lib]
  --includedir=DIR        C header files [PREFIX/include]
  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
  --infodir=DIR           info documentation [DATAROOTDIR/info]
  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
  --mandir=DIR            man documentation [DATAROOTDIR/man]
  --docdir=DIR            documentation root [DATAROOTDIR/doc/mfoc]
  --htmldir=DIR           html documentation [DOCDIR]
  --dvidir=DIR            dvi documentation [DOCDIR]
  --pdfdir=DIR            pdf documentation [DOCDIR]
  --psdir=DIR             ps documentation [DOCDIR]

Program names:
  --program-prefix=PREFIX            prepend PREFIX to installed program names
  --program-suffix=SUFFIX            append SUFFIX to installed program names
  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names

Optional Features:
  --disable-option-checking  ignore unrecognized --enable/--with options
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --enable-silent-rules   less verbose build output (undo: "make V=1")
  --disable-silent-rules  verbose build output (undo: "make V=0")
  --enable-dependency-tracking
                          do not reject slow dependency extractors
  --disable-dependency-tracking
                          speeds up one-time build

Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  LIBS        libraries to pass to the linker, e.g. -l<library>
  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
              you have headers in a nonstandard directory <include dir>
  CPP         C preprocessor

Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.

【问题讨论】:

  • 第 3930 行的 configure 脚本是否真的包含 PKG_CHECK_MODULES(libnfc, libnfc &gt;= $LIBNFC_REQUIRED_VERSION, , AC_MSG_ERROR([libnfc &gt;= $LIBNFC_REQUIRED_VERSION is mandatory.]))?这是一个应该被一些 shell 脚本代码替换的宏。您的autotools 版本可能有问题。
  • +1 提出一个与编程和开发有关的 Kali 问题
  • 请打开config.log,找到与libnfc5故障相关的部分,并把你的问题贴出来。它可能缺少libnfc5-devlibnfc5-devel 包,因此您没有所需的头文件。 $ apt-cache search libnfc 应该告诉你需要安装的包名。 Here 是它在 Ubuntu 上的样子。注意libnfc-dev 包。
  • @Bodo here 是我的配置,我无法推断错误。
  • @jww 在我的config.log 中没有关于 libnfc 的内容。我也试过安装 libnfc-dev 和 libnfc5-dbg(已经安装了 libnfc-bin、libnfc5),但没有成功。

标签: linux path configure


【解决方案1】:

错误消息并不意味着您的系统上的libnfc 有问题。 shell脚本configure有问题。

configure 脚本未对libnfc 执行检查。错误消息是关于 shell 脚本中的语法错误,该行本应执行此检查。

./configure: line 3930: syntax error near unexpected token `libnfc,'
./configure: line 3930: `PKG_CHECK_MODULES(libnfc, libnfc >= $LIBNFC_REQUIRED_VERSION, , AC_MSG_ERROR([libnfc >= $LIBNFC_REQUIRED_VERSION is mandatory.]))'

这与您在 pastebin 上显示的脚本中的行号不完全匹配。 这里的错误在第 3963 行。

脚本 sn-p 从第 3949 行开始

...
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
$as_echo "$am_cv_make_support_nested_variables" >&6; }
if test $am_cv_make_support_nested_variables = yes; then
   AM_V='$(V)'
 AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
else
 AM_V=$AM_DEFAULT_VERBOSITY
 AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
fi
AM_BACKSLASH='\'


# Checks for pkg-config modules.
LIBNFC_REQUIRED_VERSION=1.7.0
PKG_CHECK_MODULES(libnfc, libnfc >= $LIBNFC_REQUIRED_VERSION, , AC_MSG_ERROR([libnfc >= $LIBNFC_REQUIRED_VERSION is mandatory.]))

PKG_CONFIG_REQUIRES="libnfc"



{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
$as_echo_n "checking for inline... " >&6; }
if ${ac_cv_c_inline+:} false; then :
 $as_echo_n "(cached) " >&6
else
 ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
...

在注释行# Checks for pkg-config modules. 之前,它看起来像一个普通的配置脚本。

PKG_CHECK_MODULES(libnfc, libnfc &gt;= $LIBNFC_REQUIRED_VERSION, , AC_MSG_ERROR([libnfc &gt;= $LIBNFC_REQUIRED_VERSION is mandatory.])) 行错误。这是 autotools M5 宏代码,不是 shell 脚本。

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" &gt;&amp;5看来又正常了。

configure 脚本是从configure.inconfigure.ac 生成的。此源是使用特殊 autotools 宏的 M5 宏脚本。所有不是已知宏的文本都将原封不动地复制到输出中。

有问题的行 PKG_CHECK_MODULES(libnfc, libnfc &gt;= $LIBNFC_REQUIRED_VERSION, , AC_MSG_ERROR([libnfc &gt;= $LIBNFC_REQUIRED_VERSION is mandatory.])) 是一个 M5 宏调用 PKG_CHECK_MODULES() 带有几个参数,其中最后一个是另一个带有引号参数的宏调用 AC_MSG_ERROR()

我不知道为什么这会出现在配置脚本中,但这显然是错误的。可能configure.ac 脚本中存在错误,可能是使用错误版本的自动工具生成configure 脚本。

【讨论】:

    【解决方案2】:

    谢谢@Bodo,我只是克隆了错误的分支。我知道我是一个很棒的菜鸟,但我正在慢慢学习。再次非常感谢。

    【讨论】:

    • 如果解决方案是使用正确的分支,您应该在答案中添加详细信息,当您遇到错误时使用了哪个分支以及哪个分支解决了问题。这将使答案更有价值。删除“谢谢”和关于成为菜鸟的信息。这是不必要的。我还建议将标题编辑为以下内容:“PKG_CHECK_MODULES(libnfc, ..." 处的 MFOC 配置脚本中的语法错误”
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-06-26
    • 2019-11-10
    • 2011-06-17
    • 1970-01-01
    • 2018-04-11
    • 1970-01-01
    • 2019-02-17
    相关资源
    最近更新 更多