我正在尝试通过在git-credential-libsecret.c
上运行/usr/share/doc/git/contrib/credential/libsecret
来编译sudo make
中的Makefile
。
但是,此操作失败,并显示以下输出:
gcc -g -O2 -Wall -pthread -I/usr/include/libsecret-1 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -o git-credential-libsecret.o -c git-credential-libsecret.c
git-credential-libsecret.c: In function ‘keyring_get’:
git-credential-libsecret.c:87:2: error: unknown type name ‘SecretService’
SecretService *service = NULL;
^
git-credential-libsecret.c:95:2: warning: implicit declaration of function ‘secret_service_get_sync’ [-Wimplicit-function-declaration]
service = secret_service_get_sync(0, NULL, &error);
^
git-credential-libsecret.c:95:10: warning: assignment makes pointer from integer without a cast [enabled by default]
service = secret_service_get_sync(0, NULL, &error);
^
git-credential-libsecret.c:103:2: warning: implicit declaration of function ‘secret_service_search_sync’ [-Wimplicit-function-declaration]
items = secret_service_search_sync(service,
^
git-credential-libsecret.c:106:9: error: ‘SECRET_SEARCH_LOAD_SECRETS’ undeclared (first use in this function)
SECRET_SEARCH_LOAD_SECRETS | SECRET_SEARCH_UNLOCK,
^
git-credential-libsecret.c:106:9: note: each undeclared identifier is reported only once for each function it appears in
git-credential-libsecret.c:106:38: error: ‘SECRET_SEARCH_UNLOCK’ undeclared (first use in this function)
SECRET_SEARCH_LOAD_SECRETS | SECRET_SEARCH_UNLOCK,
^
git-credential-libsecret.c:117:3: error: unknown type name ‘SecretItem’
SecretItem *item;
^
git-credential-libsecret.c:118:3: error: unknown type name ‘SecretValue’
SecretValue *secret;
^
git-credential-libsecret.c:122:3: warning: implicit declaration of function ‘secret_item_get_secret’ [-Wimplicit-function-declaration]
secret = secret_item_get_secret(item);
^
git-credential-libsecret.c:122:10: warning: assignment makes pointer from integer without a cast [enabled by default]
secret = secret_item_get_secret(item);
^
git-credential-libsecret.c:123:3: warning: implicit declaration of function ‘secret_item_get_attributes’ [-Wimplicit-function-declaration]
attributes = secret_item_get_attributes(item);
^
git-credential-libsecret.c:123:14: warning: assignment makes pointer from integer without a cast [enabled by default]
attributes = secret_item_get_attributes(item);
^
git-credential-libsecret.c:131:3: warning: implicit declaration of function ‘secret_value_get_text’ [-Wimplicit-function-declaration]
s = secret_value_get_text(secret);
^
git-credential-libsecret.c:131:5: warning: assignment makes pointer from integer without a cast [enabled by default]
s = secret_value_get_text(secret);
^
git-credential-libsecret.c:138:3: warning: implicit declaration of function ‘secret_value_unref’ [-Wimplicit-function-declaration]
secret_value_unref(secret);
^
make: *** [git-credential-libsecret.o] Error 1
据我所知,这些错误是由unknown type name
问题引起的,随着unknown type
的使用在以后“错误地”使用,这些错误不断加剧。
但是,据我所知,这些类型在源文件中提供的位置中定义得很好:
grep -Enr "#include.*secret\.h" git-credential-libsecret.c
30:#include <libsecret/secret.h>
每次gcc
调用都会在/usr/include/libsecret-1
上找到,实际上:
ls /usr/include/libsecret-1/libsecret
secret-attributes.h secret-enum-types.h secret-item.h secret-paths.h secret-schema.h secret-service.h secret-value.h
secret-collection.h secret.h secret-password.h secret-prompt.h secret-schemas.h secret-types.h
此标头本身未定义SecretService
(grep -E "^typedef" secret.h
不给出任何内容),因为SecretService
是在secret-service.h
中定义的:
grep -nE "^typedef.*SecretService;" /usr/include/libsecret-1/libsecret/secret-service.h
53:typedef struct _SecretService SecretService;
secret-service
中包含secret.h
:
grep -En "^#include.*service" /usr/include/libsecret-1/libsecret/secret.h
40:#include <libsecret/secret-service.h>
对SecretItem
和SecretValue
的类似调查也得出相同的结果。
我想念什么吗?为什么文件无法按预期生成?