Polymake crashes when including linalg.h

Questions and problems about using polymake go here.
aitor
Posts: 3
Joined: 22 Dec 2014, 20:34

Polymake crashes when including linalg.h

Postby aitor » 22 Dec 2014, 20:45

Hi everyone,

I am developing a small function written in C++ with polymake. All the code compiles and executes fine, but when I add the line

Code: Select all

#include "polymake/linalg.h"
the code still compiles but gives the following error on the execution in polymake:

Code: Select all

make[1]: se ingresa al directorio «/home/aitor/Documentos/MAMME/DAG/psychic-ninja/code/build.x86_64/apps/polytope» make[1]: se sale del directorio «/home/aitor/Documentos/MAMME/DAG/psychic-ninja/code/build.x86_64/apps/polytope» polymake: ERROR: Shared module compilation failed; see the error log below cc1plus: error fatal: src/gale_complexity.cc: No existe el archivo o el directorio compilación terminada. make: *** [/tmp/poly9404Taaaa0001.o] Error 1
it says that the source file src/gale_complexity.cc does not exist, but it seems that when I remove back the inclusion of "linalg.h" then it does.

Do you know what is going on?

Thank you in advance.

User avatar
gawrilow
Main Author
Posts: 423
Joined: 25 Dec 2010, 17:40

Re: Polymake crashes when including linalg.h

Postby gawrilow » 23 Dec 2014, 12:28

polymake sometimes wants to generate and compile missing glue code for data exchange between C++ and perl worlds. To see more clearly what's going on, please increase the verbosity level before you call your function:

Code: Select all

$Verbose::cpp=2;
If the error happens already at start-up, you can place this setting in your preference file ~/.polymake/prefer.pl (it's already there, but commented out and contains the default value 0).

BTW, there were some errors in this area fixed only in the recent "perpetual beta" snapshots. If you are using the release 2.13, I would recommend to upgrade to the current snapshot first. Should the error persist after the upgrade, please post here the entire output produced during the auto-compilation, that is, the generated C++ code and the compiler commands.

PS: I suppose, gale_complexity.cc is the name of your module - or does it come from an extension?
How do you organize your code, have you founded an own extension or are you linking against the callable library?

aitor
Posts: 3
Joined: 22 Dec 2014, 20:34

Re: Polymake crashes when including linalg.h

Postby aitor » 23 Dec 2014, 16:00

Thanks for replying so fast. I changed the verbose option to 2 in prefer.pl and here's the complete output:

Code: Select all

polymake: WARNING: Compiling temporary shared module, please be patient... #include <unistd.h> namespace { void delete_temp_file() __attribute__((destructor)); void delete_temp_file() { unlink("/tmp/poly2938N1_aaaa0001.so"); } } #include "polymake/SparseMatrix.h" #include "polymake/Rational.h" #include "polymake/IncidenceMatrix.h" namespace polymake { namespace common { namespace { template <typename T0, typename T1> FunctionInterface4perl( new_X, T0,T1 ) { perl::Value arg0(stack[1]); WrapperReturnNew(T0, (arg0.get<T1>()) ); }; FunctionInstance4perl(new_X, SparseMatrix< Rational, NonSymmetric >, perl::Canned< const pm::ListMatrix<pm::SparseVector<pm::Rational> > >); } } } make: se ingresa al directorio «/home/aitor/.polymake/wrappers.0/build.x86_64/apps/common» g++ -c -o /tmp/poly2938Taaaa0001.o -fPIC -I/home/aitor/.polymake/wrappers.0/include/app-wrappers -I/home/aitor/.polymake/wrappers.0/include/apps -I/home/aitor/Documentos/MAMME/DAG/psychic-ninja/code/include/app-wrappers -I/home/aitor/Documentos/MAMME/DAG/psychic-ninja/code/include/apps -march=native -ftemplate-depth-200 -Wall -Wno-strict-aliasing -Wno-parentheses -DPOLYMAKE_APPNAME=common -DNDEBUG -DPOLYMAKE_DEBUG=0 -O3 -I/home/aitor/.polymake/wrappers.0/apps/common -I/usr/local/share/polymake/apps/common -I/home/aitor/Documentos/MAMME/DAG/psychic-ninja/code/apps/common -include src/gale_complexity.cc /tmp/poly2938Taaaa0001.cc make: se sale del directorio «/home/aitor/.polymake/wrappers.0/build.x86_64/apps/common» polymake: Compilation failed: cc1plus: error fatal: src/gale_complexity.cc: No existe el archivo o el directorio compilación terminada. make: *** [/tmp/poly2938Taaaa0001.o] Error 1 Retrying with alternative source code. polymake: WARNING: Compiling temporary shared module, please be patient... #include <unistd.h> namespace { void delete_temp_file() __attribute__((destructor)); void delete_temp_file() { unlink("/tmp/poly2938N1_aaaa0001.so"); } } #include "polymake/SparseMatrix.h" #include "polymake/Rational.h" #include "polymake/IncidenceMatrix.h" namespace polymake { namespace common { namespace { template <typename T0, typename T1> FunctionInterface4perl( new_X, T0,T1 ) { perl::Value arg0(stack[1]); WrapperReturnNew(T0, (arg0.get<T1>()) ); }; DisabledFunction4perl(new_X, SparseMatrix< Rational, NonSymmetric >, perl::Canned< const pm::ListMatrix<pm::SparseVector<pm::Rational> > >); } } } make: se ingresa al directorio «/home/aitor/.polymake/wrappers.0/build.x86_64/apps/common» g++ -c -o /tmp/poly2938Taaaa0001.o -fPIC -I/home/aitor/.polymake/wrappers.0/include/app-wrappers -I/home/aitor/.polymake/wrappers.0/include/apps -I/home/aitor/Documentos/MAMME/DAG/psychic-ninja/code/include/app-wrappers -I/home/aitor/Documentos/MAMME/DAG/psychic-ninja/code/include/apps -march=native -ftemplate-depth-200 -Wall -Wno-strict-aliasing -Wno-parentheses -DPOLYMAKE_APPNAME=common -DNDEBUG -DPOLYMAKE_DEBUG=0 -O3 -I/home/aitor/.polymake/wrappers.0/apps/common -I/usr/local/share/polymake/apps/common -I/home/aitor/Documentos/MAMME/DAG/psychic-ninja/code/apps/common -include src/gale_complexity.cc /tmp/poly2938Taaaa0001.cc make: se sale del directorio «/home/aitor/.polymake/wrappers.0/build.x86_64/apps/common» polymake: ERROR: Shared module compilation failed; see the error log below cc1plus: error fatal: src/gale_complexity.cc: No existe el archivo o el directorio compilación terminada. make: *** [/tmp/poly2938Taaaa0001.o] Error 1
Indeed, I have 2.13 version of polymake installed, but I would prefer to stick to it instead of installing a perpetual beta. The only thing I am doing is including the linalg package, so it should not be a major problem, isn't it?

Thank you!

User avatar
gawrilow
Main Author
Posts: 423
Joined: 25 Dec 2010, 17:40

Re: Polymake crashes when including linalg.h

Postby gawrilow » 23 Dec 2014, 17:50

The major problem is not linalg.h itself but a bug in polymake which has sometimes led to a wrong compiler command.
The release is already 1 year old, and I hope the bug has been fixed in the meanwhile.
Anyway, you haven't replied to my last questions in PS. They may be relevant if the bug is observable in the snapshot too.

aitor
Posts: 3
Joined: 22 Dec 2014, 20:34

Re: Polymake crashes when including linalg.h

Postby aitor » 23 Dec 2014, 18:27

So, if I have to install the new snapshot, how can I do this without "stepping" onto my version of polymake? (I'm on Ubuntu)
This is quite simple, just fetch it to a separate location. You can maintain several polymake versions in parallel as long as they live in separate directory trees and you don't force an older version to read data files produced by a later one. polymake automatically converts data files from older versions, but does not apply reverse transformations.

User avatar
gawrilow
Main Author
Posts: 423
Joined: 25 Dec 2010, 17:40

Re: Polymake crashes when including linalg.h

Postby gawrilow » 23 Dec 2014, 19:05

Then the chances are good that this bug is indeed fixed.
The next release is scheduled for coming February, AFAIK. If you are not going to wait that long, please upgrade to the snapshot.

If it's absolutely not feasible for you, you should find the places in your code where it tries to store a ListMatrix as a `big' object property or where it tries to read a property into a ListMatrix. Some functions defined in linalg.h do return ListMatrix objects. Convert it explicitly to a SparseMatrix in your code, then polymake won't need to create additional wrappers.


Return to “Helpdesk”