progirep / planet

PLANET: a Piece-wise LineAr feed-forward NEural network verification Tool
42 stars 8 forks source link

How to compile planet? #1

Closed edwardxu0 closed 6 years ago

edwardxu0 commented 6 years ago

I am having trouble compiling planet on Linux.

Could you provide a makefile?

If not, which lp slove library are you using? Could you point me the link?

bunelr commented 6 years ago

What problems do you encounter?

The following worked for me (copy pasted from the instructions in my repository

cd planet/src
# sudo apt install valgrind qt5-qmake libglpk-dev # if necessary 
qmake
make
# if you encounter linker issues, move -lsuitesparseconfig to the end of the flag list

(the last comment is because I was sometimes seeing some linker error. Moving the flag "-lsuitesparseconfig" to the end of the list in the src/Tool.pro file solved it (after rerunning the makefile generation)

edwardxu0 commented 6 years ago

Thank you so much for the quick response, Rudy.


On Ubuntu 18.04 When it says, /usr/bin/x86_64-linux-gnu-ld: cannot find -lltdl'. install the missing library, libltdl-dev.

On Ubuntu 16.04, Move -lsuitesparseconfig to the end of the flag list when you have some linker issues.

bunelr commented 6 years ago

Have you tried installing the library that seems to be missing? (libltdl-dev)

progirep commented 6 years ago

Hi @edwardxu0 and @bunelr.

Sorry for forgetting to add the command to actually build the tool to the README file. It has not been added. The "libltdl-dev" package was indeed an additional dependency that is now also listed as such in the README file. That package is needed by the GNU linear programming toolkit, and it's a bit weird that it is not listed as a dependency of it in the package manager (perhaps because it is only needed for static builds).

tianshubao1 commented 6 years ago

I got the error

collect2: error: ld returned 1 exit status Makefile:167: recipe for target 'planet' failed make: *** [planet] Error 1

when I typed make in terminal

progirep commented 6 years ago

Hi @tianshubao1 - Could you copy&paste a bit more of the error messages that you get? The "ld returned 1 exit status" line informs you that a linker error happened earlier. Seeing the actual linker error would be helpful.

Also, could you add which type of system you are using (type of Linux, Mac, etc.)? For compilation/linking errors, this information is typically helpful.

tianshubao1 commented 6 years ago

Thanks for the prompt reply. I am using ubuntu 16.04, Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz.

I typed make in src directory.

g++ -m64 -Wl,-O1 -o planet Options.o Solver.o System.o main.o verifierContext.o supersetdatabase.o -static -lglpk -lgmp -lumfpack -lsuitesparseconfig -lcholmod -lamd -lcolamd -lccolamd -lcamd -lz -lltdl -ldl /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libltdl.a(dlopen.o): In function vm_open': (.text+0x5e): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libamd.a(amd_i_order.o): In functionamd_order': (.text+0xfe): undefined reference to SuiteSparse_malloc' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libamd.a(amd_i_order.o): In functionamd_order': (.text+0x110): undefined reference to SuiteSparse_malloc' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libamd.a(amd_i_order.o): In functionamd_order': (.text+0x21a): undefined reference to SuiteSparse_malloc' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libamd.a(amd_i_order.o): In functionamd_order': (.text+0x279): undefined reference to SuiteSparse_free' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libamd.a(amd_i_order.o): In functionamd_order': (.text+0x283): undefined reference to SuiteSparse_free' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libamd.a(amd_i_order.o): In functionamd_order': (.text+0x28d): undefined reference to SuiteSparse_free' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libamd.a(amd_i_order.o): In functionamd_order': (.text+0x297): undefined reference to SuiteSparse_free' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libamd.a(amd_i_order.o): In functionamd_order': (.text+0x29f): undefined reference to SuiteSparse_free' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libamd.a(amd_i_order.o):(.text+0x2fb): more undefined references toSuiteSparse_free' follow /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libamd.a(amd_i_order.o): In function amd_order': (.text+0x389): undefined reference toSuiteSparse_malloc' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libamd.a(amd_i_order.o): In function amd_order': (.text+0x3a1): undefined reference toSuiteSparse_malloc' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libamd.a(amd_i_order.o): In function amd_order': (.text+0x46b): undefined reference toSuiteSparse_free' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libamd.a(amd_i_order.o): In function amd_order': (.text+0x475): undefined reference toSuiteSparse_free' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libamd.a(amd_i_order.o): In function amd_order': (.text+0x47f): undefined reference toSuiteSparse_free' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libamd.a(amd_i_order.o): In function amd_order': (.text+0x487): undefined reference toSuiteSparse_free' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libamd.a(amd_i_order.o): In function amd_order': (.text+0x48f): undefined reference toSuiteSparse_free' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libcolamd.a(colamd.o): In function print_report': (.text+0x3): undefined reference toSuiteSparse_config' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libcolamd.a(colamd.o): In function print_report': (.text+0x4a): undefined reference toSuiteSparse_config' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libcolamd.a(colamd.o): In function print_report': (.text+0xab): undefined reference toSuiteSparse_config' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libcolamd.a(colamd.o): In function print_report': (.text+0xd3): undefined reference toSuiteSparse_config' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libcolamd.a(colamd.o): In function print_report': (.text+0xed): undefined reference toSuiteSparse_config' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libcolamd.a(colamd.o):(.text+0x10c): more undefined references to `SuiteSparse_config' follow collect2: error: ld returned 1 exit status Makefile:167: recipe for target 'planet' failed make: *** [planet] Error 1

progirep commented 6 years ago

I unfortunately do not have access to a Ubuntu 16.04 machine (any more).

Could you try running the following command (in the "src" folder)?

g++ -m64 -Wl,-O1 -o planet Options.o Solver.o System.o main.o verifierContext.o supersetdatabase.o -static -lglpk -lgmp -lumfpack -lcholmod -lamd -lcolamd -lccolamd -lcamd -lsuitesparseconfig -lz -lltdl -ldl

It's the same as the one that did not work, except that the order of the libraries is now different.

tianshubao1 commented 6 years ago

It seems it works now. I got an extra file in the folder after tying the command you gave me.

Then I type make again. It said nothing to make.

progirep commented 6 years ago

The extra file should be the executable (if "make" says that there is nothing to make).

I do not know why Ubuntu 16.04 vs. Ubuntu 18.04 makes a difference here. Either the way linking works has slightly changed, or it is because of a change in the GLPK libraries.

I'm closing this issue for now. Please let me/us know if you have further questions.