tulip-control / dd

Binary Decision Diagrams (BDDs) in pure Python and Cython wrappers of CUDD, Sylvan, and BuDDy
https://pypi.org/project/dd
Other
181 stars 39 forks source link

error when linking to CUDD built by user #23

Closed RajeshDevarajInd closed 7 years ago

RajeshDevarajInd commented 7 years ago

I've downloaded CUDD-2.5.1 separately and installed it using make. Then, I've downloaded "dd-master" and issued the following command in the terminal:

~/dd-master$ sudo python setup.py install --cudd="/home/cse/cudd-2.5.1"

I got the following error message:

/usr/bin/ld: /home/cse/cudd-2.5.1/cudd/libcudd.a(cuddAPI.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/home/cse/cudd-2.5.1/cudd/libcudd.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

I'm unable to rectify this error. I'm using Ubuntu-16.04, X86_64 machine with Python 2.7.12, gcc version 5.4.0. Kindly help me to install dd-master successfully.

johnyf commented 7 years ago

Thank you for the feedback. This error appears to be caused by compiling CUDD without -fPIC. As the first line says, please "recompile with -fPIC". The error is from the linker (ld). PIC means position-independent code and is an option needed when libcudd is incorporated in the (most likely dynamic library) that Python is trying to compile when setup.py is run.

To find how to pass this and other options to CUDD's makefile, please consult the flags passed to CUDD by the script download.py: https://github.com/johnyf/dd/blob/5a6097e892a3a69c6e50ab904d173d9326bc7288/download.py#L60. In a few days I plan to release dd == 0.4.3, which uses CUDD v3.0.0. The build is more automated for that version of CUDD, but adding -fPIC will still be needed, as noted in 6c4805ec604664e91ba17ec44a1ddc1f3076b2df.

Also, the option to pass --fetch to setup.py is still available, in case you prefer that approach. The new option for passing a path allows an existing CUDD build to be used, e.g., to be shared for building programs other than dd.