The cpabe library, implemented in C, has two components, the cpabe main source and libbswabe library which acts as a dependency. Both of which can be found here
The libbswabe library installed well enough, however, while making the cpabe source. the following occured
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/lib/gcc/x86_64-linux-gnu/9/../../../../lib/libpbc.so: undefined reference to symbol '__gmpz_clear'
/usr/bin/ld: /lib/libgmp.so.3: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [Makefile:34: cpabe-setup] Error 1
My system is an Ubuntu 20.04 LTS, and I have PBC and all the neccessary dependencies installed. However, I am quite new to this configure
, make
, sudo make install
thing. So I need to know what I did wrong.
2
Answers
You putted -lpbc after -lgmp. The order is important, put -lgmp after -lpbc.
If you have library a that depends on library b then the order must be -la -lb.
You can use some of these two repositories:
https://github.com/GD14/cpabe
https://github.com/rkuma013/Bethencourt_CPABE
They have a better updated code than cpabe-0.11…
And you can edit to Makefile after ./configure execution and change order lines about -lgmp and -lpbc (how to Harkaitz showed), where:
From:
-Wl,-rpath /usr/local/lib -lgmp
-Wl,-rpath /usr/local/lib -lpbc
->To this order:
The make and make install commands will work OK.