컴파일 오류

컴파일 오류

안녕하세요. 몇 가지 테스트를 실행해야 합니다. 내가 찾은 CP ABE 툴킷, 저는 Linux의 완전 초보자입니다. 사용하기 시작한 지 며칠이 되었으니 양해해 주시기 바랍니다. 내가 발견했다이 비디오 튜토리얼그것은 매우 도움이 되어서 설치하게 만들었습니다: -m4 매크로 처리 언어 -gmp 라이브러리 -pbc 라이브러리 -libcrypt -libssl -libglib2.0 -libbswabe 라이브러리

나는 비디오의 모든 구절을 따라했지만 make 후에 cpabe 패키지를 컴파일해야 할 때 이 오류가 나타납니다(튜토리얼에서는 그렇지 않은 것 같습니다).

~/Downloads/cpabe-0.11$ make
gcc -c -o setup.o setup.c -O3 -Wall -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include -I/usr/include/pbc -I/usr/local/include/pbc -DPACKAGE_NAME=\"cpabe\" -DPACKAGE_TARNAME=\"cpabe\" -DPACKAGE_VERSION=\"0.11\" -DPACKAGE_STRING=\"cpabe\ 0.11\" -DPACKAGE_BUGREPORT=\"[email protected]\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_FCNTL_H=1 -DHAVE_STDDEF_H=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DLSTAT_FOLLOWS_SLASHED_SYMLINK=1 -DHAVE_VPRINTF=1 -DHAVE_LIBCRYPTO=1 -DHAVE_LIBCRYPTO=1 -DHAVE_STRCHR=1 -DHAVE_STRDUP=1 -DHAVE_MEMSET=1 -DHAVE_GMP=1 -DHAVE_PBC=1 -DHAVE_BSWABE=1
gcc -c -o common.o common.c -O3 -Wall -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include -I/usr/include/pbc -I/usr/local/include/pbc -DPACKAGE_NAME=\"cpabe\" -DPACKAGE_TARNAME=\"cpabe\" -DPACKAGE_VERSION=\"0.11\" -DPACKAGE_STRING=\"cpabe\ 0.11\" -DPACKAGE_BUGREPORT=\"[email protected]\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_FCNTL_H=1 -DHAVE_STDDEF_H=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DLSTAT_FOLLOWS_SLASHED_SYMLINK=1 -DHAVE_VPRINTF=1 -DHAVE_LIBCRYPTO=1 -DHAVE_LIBCRYPTO=1 -DHAVE_STRCHR=1 -DHAVE_STRDUP=1 -DHAVE_MEMSET=1 -DHAVE_GMP=1 -DHAVE_PBC=1 -DHAVE_BSWABE=1
common.c: In function ‘suck_file’:
common.c:137:2: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
  fread(a->data, 1, s.st_size, f);
  ^
common.c: In function ‘read_cpabe_file’:
common.c:211:2: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
  fread((*aes_buf)->data, 1, len, f);
  ^
common.c:218:2: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
  fread((*cph_buf)->data, 1, len, f);
  ^
gcc -o cpabe-setup setup.o common.o -O3 -Wall -lglib-2.0 -Wl,-rpath /usr/local/lib -lgmp -Wl,-rpath /usr/local/lib -lpbc -lbswabe -lcrypto -lcrypto 
/usr/bin/ld: /usr/local/lib/libpbc.so: undefined reference to symbol '__gmpz_init'
/usr/local/lib/libgmp.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:34: recipe for target 'cpabe-setup' failed
make: *** [cpabe-setup] Error 1

감사해요

답변1

Makefile을 열고 다음 줄을 찾으세요.

LDFLAGS = -O3 -Wall \
        -lglib-2.0   \
        -Wl,-rpath /usr/local/lib -lgmp \
        -Wl,-rpath /usr/local/lib -lpbc \
        -lbswabe \
        -lcrypto -lcrypto

이제 -lgmp옆에 추가하면 -lcrypto성공할 것입니다.

LDFLAGS = -O3 -Wall \
        -lglib-2.0   \
        -Wl,-rpath /usr/local/lib -lgmp \
        -Wl,-rpath /usr/local/lib -lpbc \
        -lbswabe \
        -lcrypto -lcrypto -lgmp

관련 정보