Error binding gmp while compiling cpabe package from source code

In the end, I spent several hours compiling the cpabe package from its source code in Ubuntu 12.10 with the gmp and pbc dependencies. The following error message seemed to be a problem for many people on the Internet (even to compile other packages that require installing libgmp as a dependency!). However, I could not find a suitable solution there:

... /usr/bin/ld: /usr/local/lib/libpbc.so: undefined reference to symbol '__gmpz_init' /usr/bin/ld: note: '__gmpz_init' is defined in DSO /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libgmp.so so try adding it to the linker command line /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libgmp.so: could not read symbols: Invalid operation collect2: ld returned 1 exit status 
+8
compilation linker ubuntu gmp
source share
4 answers

This may be trivial for some of you, but policy_lang.y does not have a semicolon on line 67, so compilation fails:

  policy_lang.y: In function 'yyparse': policy_lang.y:67:38: error: expected ';' before '}' token result: policy { final_policy = $1 } 

It can be fixed by changing line 67 to

  result: policy { final_policy = $1; } 
+5
source share

Adding lgmp was necessary, but all the other libraries used were also necessary to link. I finally solved the problem by specifying these libraries in the LDFLAGS environment variable when issuing the make command. Thus, after installing gmp, pbc, bswabe or any other necessary dependencies, the compilation steps were as follows:

  • ./configure -with-pbc-include = path -with-pbc-lib = path (paths where pbc.h and libpbc are installed)

  • do LDFLAGS = "- lgmp -lpbc -lcrypto -L / usr / lib / x86_64-linux-gnu -lglib -lbswabe -lgmp"

  • make install

+4
source share

Mine was MarAlavi's little change, for linux Mint 16:

  • ./configure -with-pbc-include= path -with-pbc-lib= path (paths where pbc.h and libpbc were set)
  • make LDFLAGS="-lgmp -lpbc -lcrypto -L/usr/lib/x86_64-linux-gnu -lglib-2.0 -lbswabe -lgmp"
  • make install

Pay attention to " -lglib-2.0 ".

+2
source share

try adding it to the linker command line

Have you tried adding -lgmp to the link command line, as the error suggests?

0
source share

All Articles