致命错误:打开依赖文件

时间:2017-02-05 03:38:03

标签: c git makefile public-key-encryption contiki

我正在尝试在contiki os上使用ECC库 但我得到了依赖的错误。我认为问题出在我的Makefile上,但我不确定哪里出错了。

我是从源代码https://github.com/nist-emntg/ecc-light-certificate下载的,但是在git submodule update克隆源后我使用git时出现问题,因此我手动下载并将contiki文件粘贴到contiki文件夹中。
这可能是问题吗?

错误消息

> make TARGET=cooja clean 
rm -f *~ *core core *.srec \
    *.lst *.map \
    *.cprg *.bin *.data contiki*.a *.firmware core-labels.S *.ihex *.ini \
    *.ce *.co
rm -rf 
rm -rf obj_cooja

> make sender-node.cooja TARGET=cooja 
  CC        sender-node.c
sender-node.c: In function 'process_thread_sender_node_process':
sender-node.c:104:11: warning: unused variable 'pubKey' [-Wunused-variable]
mkdir obj_cooja
  CC        ../../../platform/cooja/./contiki-cooja-main.c
../../../platform/cooja/./contiki-cooja-main.c: In function 'contiki_init':
../../../platform/cooja/./contiki-cooja-main.c:230:14: warning: variable 'shortaddr' set but not used [-Wunused-but-set-variable]
../../../platform/cooja/./contiki-cooja-main.c:288:5: warning: passing argument 1 of 'rimeaddr_copy' from incompatible pointer type [enabled by default]
../../../core/./net/rime/rimeaddr.h:79:6: note: expected 'union rimeaddr_t *' but argument is of type 'uint8_t *'
mv contiki-cooja-main.o obj_cooja/mtype371.o
  CC        ../../../../ecc/ecc.c
../../../../ecc/ecc.c:700:1: fatal error: opening dependency file obj_cooja/../../../../ecc/ecc.d: No such file or directory
compilation terminated.
make: *** [obj_cooja/../../../../ecc/ecc.o] Error 1
Process returned error code 2

这是我的makefile

all: sender-node receiver-node root-node
extra: example tools tests
CONTIKI=../../..

WITH_UIP6=1
UIP_CONF_IPV6=1

include $(CONTIKI)/../Makefile.curve
CURVE_DIR=$(CONTIKI)/../ecc/curve-params
CFLAGS+= -DUIP_CONF_IPV6_RPL\
         -DSHA2_USE_INTTYPES_H \
         -DWITH_SHA256 \
         -D$(DOMAIN_PARAMS) \
         -DTHIRTYTWO_BIT_PROCESSOR \
         -DDOMAIN_PARAMS=$(DOMAIN_PARAMS)

CFLAGS+=-DPROJECT_CONF_H=\"project-conf.h\"

PROJECT_SOURCEFILES += $(CONTIKI)/../ecc/ecc.c $(CONTIKI)/../ecc/ecdsa.c $(CONTIKI)/../ecc/nn.c $(CONTIKI)/../sha2/sha2.c $(CONTIKI)/../certificate/certificate.c
PROJECTDIRS += sha2 ecc $(CURVE_DIR) certificate

include $(CONTIKI)/../ecc/curve-params/Makefile.curve_params

# mc1322x is little endian only
ifeq ($(TARGET),econotag)
CFLAGS+= -DWORDS_LITTLEENDIAN
endif

ifdef WITH_COMPOWER
APPS+=powertrace
CFLAGS+= -DCONTIKIMAC_CONF_COMPOWER=1 -DWITH_COMPOWER=1 -DQUEUEBUF_CONF_NUM=4
endif

ifdef SERVER_REPLY
CFLAGS+=-DSERVER_REPLY=$(SERVER_REPLY)
endif
ifdef PERIOD
CFLAGS+=-DPERIOD=$(PERIOD)
endif

include $(CONTIKI)/Makefile.include
example:
    make -C example

tools:
    make -C tools

tests:
    make -C tests

1 个答案:

答案 0 :(得分:1)

  

但是我从源代码git clone后使用git子模块更新时遇到问题,所以我手动下载并将contiki文件粘贴到contiki文件夹中。

你不能只下载任何contiki文件,因为子模块的想法是引用另一个repo的确切SHA1。

再次尝试克隆主要回购,这次使用--recursive(并确保使用最新的Git 2.11.1)

cd /path/to/ly/local/clone/of/ecc-light-certificate 
cd ..
move ecc-light-certificate ecc-light-certificate.old
git clone --recursive https://github.com/nist-emntg/ecc-light-certificate

错误是:

no such remote ref 7a493c44edb6952bf82fc808b9dd91c30d49c871 
Fetched in submodule path 'contiki', but it did not contain 7a493c44edb6952bf82fc808b9dd91c30d49c871.  
Direct fetching of that commit failed

首先:https://github.com/tcheneau/contiki@7a493c44edb6952bf82fc808b9dd91c30d49c871确实存在。

但是,查看其commit page 7a493c4,您可以看到它不属于任何分支或标记:它仍然保存在GitHub远程仓库中,但获取默认(因为,同样,没有分支或标签包含它)

您需要在nist-emntg/ecc-light-certificate/issues项目上打开一个问题,以提醒他们关于子模块contiki的不存在的提交参考。

如果您查找该提交消息,您会发现原始commit 1396dfd中的fix-native-build branch

C:\Users\vonc\prog\git\ecc-light-certificate\contiki>git log --all --grep="prevent the native target"
commit 1396dfd817424eb7d3218cc6c51186f80b032e9f
Author: Tony Cheneau <tony.cheneau@nist.gov>
Date:   Fri Oct 25 17:53:27 2013 -0400

    Fix a typo (?) that would prevent the native target from building the examples.

这是典型的樱桃选择。

要解决您当前的情况,请直接签出正确的提交:

C:\Users\vonc\prog\git\ecc-light-certificate\contiki>git checkout 1396dfd817424eb7d3218cc6c51186f80b032e9f
Checking out files: 100% (3223/3223), done.
Note: checking out '1396dfd817424eb7d3218cc6c51186f80b032e9f'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 1396dfd81... Fix a typo (?) that would prevent the native target from building the examples.

C:\Users\vonc\prog\git\ecc-light-certificate\contiki>git st
HEAD detached at 1396dfd81
nothing to commit, working tree clean