Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

where can I find the crossguid version used ? #10

Open
teto opened this issue May 3, 2021 · 14 comments
Open

where can I find the crossguid version used ? #10

teto opened this issue May 3, 2021 · 14 comments

Comments

@teto
Copy link

teto commented May 3, 2021

I am trying to package copasi for www.nixos.org. I've made good progress but I stumble on a libcrossguid error

note: keeping build directory '/tmp/nix-build-copasi-4.30.drv-0'
error: builder for '/nix/store/l8cj1n44s68ixhzhwl3xb6ax1vclpdh4-copasi-4.30.drv' failed with exit code 2;
       last 10 log lines:
       >                  from /build/source/copasi/CopasiDataModel/CDataModel.h:18,
       >                  from /build/source/copasi/CopasiDataModel/CDataModel.cpp:16:
       > /nix/store/jfbc3pmpgrjg14j4p3l40jfqn174947i-libcrossguid-2019-05-29/include/crossguid/guid.hpp:55:32: error: expected ')' before 'fromString'
       >    55 |  explicit Guid(std::string_view fromString);
       >       |               ~                ^~~~~~~~~~~
       >       |                                )
       > make[2]: *** [copasi/CMakeFiles/libCOPASISE-core.dir/build.make:134: copasi/CMakeFiles/libCOPASISE-core.dir/MIRIAM/CCreator.cpp.o] Error 1
       > make[2]: *** [copasi/CMakeFiles/libCOPASISE-core.dir/build.make:82: copasi/CMakeFiles/libCOPASISE-core.dir/CopasiDataModel/CDataModel.cpp.o] Error 1
       > make[1]: *** [CMakeFiles/Makefile2:162: copasi/CMakeFiles/libCOPASISE-core.dir/all] Error 2
       > make: *** [Makefile:182: all] Error 2
       For full logs, run 'nix log /nix/store/l8cj1n44s68ixhzhwl3xb6ax1vclpdh4-copasi-4.30.drv'.

using crossguid ca1bf4b810e2d188d04cb6286f957008ee1b7681 (from May 2019). I tried to look in this repo what version was used but had a hard time finding it.

@fbergmann
Copy link
Member

Yes, we use an older version (around the 25th of August 2018). That did not yet use std::string_view, I believe this one should work:

graeme-hill/crossguid@5eb8378

@teto
Copy link
Author

teto commented May 3, 2021

Thanks that seems to fix it. So basically I have to check in every folder of src/ to see the version ?
All dependencies look rather outdated and it's painful for packaging. clapack seems to be 3.2.1 while nixpkgs references 3.9.0.
Any reason to remain on older versions ?

@fbergmann
Copy link
Member

The reason we remained at the older version for crossguid / zipper was that at the time we were not ready to use c++17. But i'll discuss with the team as to what can be done.

@teto
Copy link
Author

teto commented May 3, 2021

that would be awesome thanks. And with nix, you would have a package available everywhere nix is available (ubuntu/arch etc).

@shoops
Copy link
Member

shoops commented May 3, 2021

You should be able to compile COPASI with the new version of zipper and grossguid by removing the section:

if (CMAKE_MAJOR_VERSION LESS 3 OR CMAKE_MINOR_VERSION LESS 1)
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-std=c++11")
else()
set(CMAKE_CXX_STANDARD 11)
endif()

in CMakeLists.txt. We keep it to enforce backwards compatibility as Frank said.

@teto
Copy link
Author

teto commented May 3, 2021

Most linux distributions enforce the use of upstream libraries so using copasi-dependencies is to create a distrib package is out of question (I understand it can be useful for a windows build though).
Right now I tried with lapack 3.9.0 but it fails with.

[ 14%] Building CXX object copasi/CMakeFiles/libCOPASISE-core.dir/elementaryFluxModes/CEFMAlgorithm.cpp.o
In file included from /nix/store/l2yczm923k25j0798nxqypnifa9map6v-lapack-3-dev/include/lapack.h:11,
                 from /build/source/copasi/lapack/lapackwrap.h:1253,
                 from /build/source/copasi/elementaryFluxModes/CBitPatternMethod.cpp:34:
/nix/store/l2yczm923k25j0798nxqypnifa9map6v-lapack-3-dev/include/lapack.h:102:16: error: conflicting declaration of C function 'int lsame_(char*, char*, int, int)'
  102 | lapack_logical LAPACK_lsame( char* ca,  char* cb,
      |                ^~~~~~~~~~~~
In file included from /build/source/copasi/lapack/blaswrap.h:77,
                 from /build/source/copasi/elementaryFluxModes/CBitPatternMethod.cpp:33:
/build/source/copasi/lapack/blas.h:49:9: note: previous declaration 'logical lsame_(char*, char*)'
   49 | logical lsame_(char *ca, char *cb);
      |         ^~~~~~
[ 15%] Building CXX object copasi/CMakeFiles/libCOPASISE-core.dir/elementaryFluxModes/CEFMMethod.cpp.o
[ 15%] Building CXX object copasi/CMakeFiles/libCOPASISE-core.dir/elementaryFluxModes/CEFMProblem.cpp.o
make[2]: *** [copasi/CMakeFiles/libCOPASISE-core.dir/build.make:888: copasi/CMakeFiles/libCOPASISE-core.dir/elementaryFluxModes/CBitPatternMethod.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /nix/store/l2yczm923k25j0798nxqypnifa9map6v-lapack-3-dev/include/lapack.h:11,
                 from /build/source/copasi/lapack/lapackwrap.h:1253,
                 from /build/source/copasi/elementaryFluxModes/CBitPatternTreeMethod.cpp:39:
/nix/store/l2yczm923k25j0798nxqypnifa9map6v-lapack-3-dev/include/lapack.h:102:16: error: conflicting declaration of C function 'int lsame_(char*, char*, int, int)'
  102 | lapack_logical LAPACK_lsame( char* ca,  char* cb,
      |                ^~~~~~~~~~~~
In file included from /build/source/copasi/lapack/blaswrap.h:77,
                 from /build/source/copasi/elementaryFluxModes/CBitPatternTreeMethod.cpp:38:
/build/source/copasi/lapack/blas.h:49:9: note: previous declaration 'logical lsame_(char*, char*)'
   49 | logical lsame_(char *ca, char *cb);
      |         ^~~~~~

@fbergmann
Copy link
Member

When encountering issues like that before, we added the cmake options:

   -DF2C_INTEGER=<integer as defined in f2c.h> -DF2C_LOGICAL=<logical as defined in f2c.h> 

to define the same types as your system lapack. I hope that would resolve it.

I was wondering, since Fedora went through probably similar issues, maybe you could look at their build output:

https://koji.fedoraproject.org/koji/buildinfo?buildID=1729885

@shoops
Copy link
Member

shoops commented May 3, 2021

I compile on OpenSuse Tumbleweed with lapack 3.9.0-1.1 without encountering the above issue. I also have lapack-devel 3.9.0-1.1 are you missing it?

@teto
Copy link
Author

teto commented May 3, 2021

setting up DF2C_INTEGER didn't change a thing (I copied the fedora setup). Maybe the compiler is setup with more hardening than on opensuse. Commenting out the line fixes it

diff --git a/copasi/lapack/blas.h b/copasi/lapack/blas.h
index 8c143e131..445aa2cfc 100644
--- a/copasi/lapack/blas.h
+++ b/copasi/lapack/blas.h
@@ -46,7 +46,7 @@ integer isamax_(integer *n, real *sx, integer *incx);
 /* Function */
 integer izamax_(integer *n, doublecomplex *zx, integer *incx);
 /* Function */
-logical lsame_(char *ca, char *cb);
+/* logical lsame_(char *ca, char *cb); */
 
 /* Subroutine */
 int caxpy_(integer *n, complex *ca, complex *cx, integer *incx, complex *cy, integer *incy);

After that I get

/home/teto/nova/COPASI/copasi/layout/CLBase.cpp:17:10: fatal error: sbml/packages/layout/sbml/BoundingBox.h: No such file or directory
  17 | #include <sbml/packages/layout/sbml/BoundingBox.h>
     |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

according to src/libSBML/VERSION.txt it needs sbml 5.19.1 . I've cloned libsbml and yes the file exists but there is no tag for 5.19.1, just for 5.19.0.

Thank you all for the prompt answers so far, it has been really helpful and makes me love the copasi community already ;)
I find it troublesome to bundle dependencies compared to e.g, refer to external dependencies as is done here https://github.com/neovim/neovim/blob/ad811444424f573c4dc10b203f8f42adb3c5fdf4/third-party/CMakeLists.txt#L137 (it's straightforward to see the versions used).

@fbergmann
Copy link
Member

LibSBML does have a number of source archives, with a varying number of additional packages. It would seem you have installed one without the Layout Package. For example from the release page:

https://sourceforge.net/projects/sbml/files/libsbml/5.19.0/stable/

if you installed the 'core' file, then you would have libSBML, but no packages. If you installed from core-plus-packages, it would have the layout and render package that COPASI uses as well. There is no dependency on 5.19.1, we just used it as it will compilation on c++17.

@teto
Copy link
Author

teto commented May 4, 2021

Thanks I found the "-DWITH_ALL_PACKAGES=ON" flag right after posting.
I've got a new error when building libNUML.

error: builder for '/nix/store/9qh6qc877b8rzkxlj03zabflilanakws-NuML-1.1.4.drv' failed with exit code 2;
       last 10 log lines:
       > (.text+0x140): multiple definition of `Dimension::getElementName[abi:cxx11]() const'; CMakeFiles/numl.dir/numl/Dimension.cpp.o:Dimension.cpp:(.text+0x230): first defined here
       > /nix/store/5xyjd2qiily84lcv2w2grmwsb8r1hqpr-binutils-2.35.1/bin/ld: /nix/store/fxz6fvyibxdibmr6ycp1jpasibfkjj55-libsbml-5.19.0/lib/libsbml-static.a(Dimension.cpp.o): in function `Dimension::clone() const [clone .localalias]':
       > (.text+0x7d0): multiple definition of `Dimension::clone() const'; CMakeFiles/numl.dir/numl/Dimension.cpp.o:Dimension.cpp:(.text+0xa0): first defined here
       > collect2: error: ld returned 1 exit status
       > make[2]: *** [src/CMakeFiles/numl.dir/build.make:419: src/libnuml.so.1.1.4] Error 1
       > make[1]: *** [CMakeFiles/Makefile2:190: src/CMakeFiles/numl.dir/all] Error 2
       > make[1]: *** Waiting for unfinished jobs....
       > [100%] Linking CXX static library libnuml-static.a
       > [100%] Built target numl-static
       > make: *** [Makefile:171: all] Error 2

I guess that's because my sbml is now too recent. This repo contains src/libSBML/VERSION.txt with 5.19.1 as a reference but where can I find the exact revision to use ? I am confused as to which source to look at : is the libsbml upstream in this repo, sourceforge or github ?

Both libsbml and libnuml seem to build both static and dynamic libraries. Do you know if I can disable static libraries with -DBUILD_SHARED_LIBS=ON for instance ?

@fbergmann
Copy link
Member

Unfortunately the arrays package does define a duplicated symbol, that one has not been officially approved, so I would compile libSBML using the stable packages only (-DWITH_STABLE_PACKAGES=ON). Alternatively if you do want to allow for the arrays package, then the workaround would be to enable the C++ namespaces (-DWITH_CPP_NAMESPACE=ON).

LibSBML recently moved its code base from sf to github, however we placed the release binaries on sourceforge, as there were too many of different files built, so the github release page would have been overloaded.

And yes, you can disable the static builds if you need via (-DLIBSBML_SKIP_STATIC_LIBRARY=ON / -DLIBNUML_SKIP_STATIC_LIBRARY=ON)

@teto
Copy link
Author

teto commented May 5, 2021

Thank you your recommendations solved both issues.

Something I've noticed that troubles me is that I comple copasi rev 1db9373589ea1e1afc6a36759f7f363cfe84a838 (4.30), yet the CMake tells me Building COPASI 4.12.65 (Release), do I miss anything (btw is this a version you would advise me to package ?) ?

-- -----------------------------------------------------------
 Building COPASI 4.12.65 (Release)

 32%] Building CXX object copasi/CMakeFiles/libCOPASISE-core.dir/layout/CListOfLayouts.cpp.o
[ 32%] Building CXX object copasi/CMakeFiles/libCOPASISE-core.dir/layout/SBMLDocumentLoader.cpp.o
[ 33%] Building CXX object copasi/CMakeFiles/libCOPASISE-core.dir/lna/CLNAMethod.cpp.o
[ 33%] Building CXX object copasi/CMakeFiles/libCOPASISE-core.dir/lna/CLNAProblem.cpp.o
[ 33%] Building CXX object copasi/CMakeFiles/libCOPASISE-core.dir/lna/CLNATask.cpp.o
[ 33%] Building CXX object copasi/CMakeFiles/libCOPASISE-core.dir/lyap/CLyapMethod.cpp.o
[ 33%] Building CXX object copasi/CMakeFiles/libCOPASISE-core.dir/lyap/CLyapProblem.cpp.o
/build/source/copasi/lna/CLNAMethod.cpp: In member function 'int CLNAMethod::calculateCovarianceMatrixReduced()':
/build/source/copasi/lna/CLNAMethod.cpp:264:10: error: cannot convert 'long int*' to 'int*'
  264 |          pbwork,
      |          ^~~~~~
      |          |
      |          long int*
In file included from /build/source/copasi/lapack/lapackwrap.h:1253,
                 from /build/source/copasi/lna/CLNAMethod.cpp:31:
/nix/store/01ip1fy74az7nivwyy40r3rp5ncygbbq-liblapack-3.9.0/include/lapack.h:1128:60: note:   initializing argument 14 of 'void dgees_(const char*, const char*, LAPACK_D_SELECT2, const int*, double*, const int*, int*, double*, double*, double*, const int*, double*, const int*, int*, int*)'
 1128 |     double* work, lapack_int const* lwork, lapack_logical* BWORK,
      |                                                            ^
/build/source/copasi/lna/CLNAMethod.cpp:289:10: error: cannot convert 'long int*' to 'int*'
  289 |          pbwork,
      |          ^~~~~~
      |          |
      |          long int*
In file included from /build/source/copasi/lapack/lapackwrap.h:1253,
                 from /build/source/copasi/lna/CLNAMethod.cpp:31:
/nix/store/01ip1fy74az7nivwyy40r3rp5ncygbbq-liblapack-3.9.0/include/lapack.h:1128:60: note:   initializing argument 14 of 'void dgees_(const char*, const char*, LAPACK_D_SELECT2, const int*, double*, const int*, int*, double*, double*, double*, const int*, double*, const int*, int*, int*)'
 1128 |     double* work, lapack_int const* lwork, lapack_logical* BWORK,
      |                                                            ^
/build/source/copasi/lna/CLNAMethod.cpp:356:10: error: cannot convert 'long int*' to 'int*'
  356 |          pbwork,
      |          ^~~~~~
      |          |
      |          long int*
In file included from /build/source/copasi/lapack/lapackwrap.h:1253,
                 from /build/source/copasi/lna/CLNAMethod.cpp:31:
/nix/store/01ip1fy74az7nivwyy40r3rp5ncygbbq-liblapack-3.9.0/include/lapack.h:1128:60: note:   initializing argument 14 of 'void dgees_(const char*, const char*, LAPACK_D_SELECT2, const int*, double*, const int*, int*, double*, double*, double*, const int*, double*, const int*, int*, int*)'
 1128 |     double* work, lapack_int const* lwork, lapack_logical* BWORK,
      |                                                            ^
/build/source/copasi/lna/CLNAMethod.cpp:381:10: error: cannot convert 'long int*' to 'int*'
  381 |          pbwork,
      |          ^~~~~~
      |          |
      |          long int*
In file included from /build/source/copasi/lapack/lapackwrap.h:1253,
                 from /build/source/copasi/lna/CLNAMethod.cpp:31:
/nix/store/01ip1fy74az7nivwyy40r3rp5ncygbbq-liblapack-3.9.0/include/lapack.h:1128:60: note:   initializing argument 14 of 'void dgees_(const char*, const char*, LAPACK_D_SELECT2, const int*, double*, const int*, int*, double*, double*, double*, const int*, double*, const int*, int*, int*)'
 1128 |     double* work, lapack_int const* lwork, lapack_logical* BWORK,
      |                                                            ^
make[2]: *** [copasi/CMakeFiles/libCOPASISE-core.dir/build.make:2045: copasi/CMakeFiles/libCOPASISE-core.dir/lna/CLNAMethod.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:162: copasi/CMakeFiles/libCOPASISE-core.dir/all] Error 2

@shoops as you see I am using https://github.com/Reference-LAPACK/lapack/tree/v3.9.0 too. What version of Copasi are you compiling against ?

And just for information here is my current copasi package (I've packaged dependencies too elsewhere):

{
stdenv
, lib
, fetchFromGitHub, fetchurl, cmake, libxml2
, libsbml
# , qtbase , qttools
, lapack
, cppunit
, expat
, librdf_raptor
, libcrossguid
, libSEDML
, libCombine
, pkg-config
, liblapack
}:

stdenv.mkDerivation rec {
  pname = "copasi";
  version = "4.30";

  src = fetchFromGitHub {
    repo = "copasi";
    owner = "copasi";
    # this is not a good rev
    # rev = "release/Version-4.31";
    # sha256 = "sha256-xnOUIOcjPwl47jiVRTr+pTOgq5Pf7vW1Zbta9lL1b2g=";
    rev = "1db9373589ea1e1afc6a36759f7f363cfe84a838";
    sha256 = "sha256-ARZkybk4miWx7fQlUidm+PPQ6irHqwUfy6xvpjLiXAc=";
  };

  nativeBuildInputs = [
    cmake
    pkg-config
  ];

  #cmake -DBUILD_GUI=OFF -DCMAKE_INSTALL_PREFIX=~/copasi -DCOPASI_DEPENDENCY_DIR=../copasi-dependencies/bin ../COPASI
  cmakeFlags = [
    # "-DSELECT_QT=Qt5" #
    "-DBUILD_GUI=OFF"
    "-DCOMBINE_INCLUDE_DIR=${libCombine}/include"
    "-DBUILD_UI_DEPS=ON"  # defaults to ON
    # "-DCLAPACK_LIBRARIES=${lapack}/lib"
    "-DENABLE_JIT=OFF"  # compile math expressions
    "-DCOPASI_INSTALL_C_API=ON"
    "-DF2C_INTEGER=int"
    "-DF2C_LOGICAL=long"
    # "-Dcrossguid_DIR=${libcrossguid}"
    # "-DBUILD_clapack=off" # fortran to c conversion of lapack, not packaged
  ];

  patches = [
    ./copasi.patch
  ];

  buildInputs = [
    # lapack # clapack listed not present , lapack is
    liblapack # 3.9.0
    libcrossguid
    cppunit
    expat
    librdf_raptor  # "raptor" ?
    libSEDML
    libsbml
    libCombine
    # SBW
    # Qt libraries QWT, QWT3D and the Qt MML widget. Instructions for building the dependencies are described here:
    # qtbase qttools
    libxml2.dev
  ];

  meta = {
    homepage = "https://github.com/copasi/COPASI";
    description = "COPASI is a software application for simulation and analysis of biochemical networks and their dynamics.";
    license = lib.licenses.artistic2;
    maintainers = with lib.maintainers; [ teto ];
  };
}

with copasi.patch :

diff --git a/copasi/lapack/blas.h b/copasi/lapack/blas.h
index 8c143e131..445aa2cfc 100644
--- a/copasi/lapack/blas.h
+++ b/copasi/lapack/blas.h
@@ -46,7 +46,7 @@ integer isamax_(integer *n, real *sx, integer *incx);
 /* Function */
 integer izamax_(integer *n, doublecomplex *zx, integer *incx);
 /* Function */
-logical lsame_(char *ca, char *cb);
+/* logical lsame_(char *ca, char *cb); */
 
 /* Subroutine */
 int caxpy_(integer *n, complex *ca, complex *cx, integer *incx, complex *cy, integer *incy);

@fbergmann
Copy link
Member

In your configuration you used cmake to define: -DF2C_LOGICAL=long

so this is where the issue comes from. So this one would appear to have to be int, so that the types match according to your error message.

as for the version, the actual version information is generated by the use of a script, in the source folder. So please invoke

./gitTools/UpdateCopasiVersion

in the source folder prior to building. We are close to releasing version 4.31 from the respective branch soonish so i would go with that one. (We are in the testing of the final snapshot).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants