Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 05 May 2015 20:14:33 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   [Bug 199929] [NEW PORT] math/cryptominisat
Message-ID:  <bug-199929-13-snI555UDyJ@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-199929-13@https.bugs.freebsd.org/bugzilla/>
References:  <bug-199929-13@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=199929

--- Comment #4 from Jan Beich <jbeich@FreeBSD.org> ---
Created attachment 156406
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=156406&action=edit
PYTHON as separate ports, v0

(In reply to 6yearold from comment #3)
> (In reply to Jan Beich from comment #1)
>>WARN: /usr/ports/math/cryptominisat/pkg-plist: [8]: installing shared
>>libraries, please define USE_LDCONFIG as appropriate
>>Maybe set SOVERSION, so the library path can be cached by ldconfig(8)
>>and used not only via RPATH.
> Yup, but what's the proper way to do this? Make a symlink at post-install?

After testing it works fine with just USE_LDCONFIG. Broken ldconfig -r
output can be ignored as it doesn't affect LIB_DEPENDS implementation
for a few years. If you still want SOVERSION try:

  set_target_properties(libcryptominisat4 PROPERTIES
  ...
  SOVERSION 0
  )

>>USES=python with no version specified is for ports that support both
>>python2 and python3. CMakeLists.txt seems to disagree:
>
> As with find_package(Boost 1.46) case, this version number is a minimum version
> required. Since cryptominisat author doesn't check for actual version of python
> that have been found, i thought it should work with any python that is 2.7+.

Try building with:

  # in make.conf
  DEFAULT_VERSIONS = python=3.4

which would either not find suitable python version or fail as

  pycryptosat.cpp:68:10: error: use of undeclared identifier 'PyInt_Check'
      if (!IS_INT(lit))  {
           ^
  pycryptosat.cpp:21:21: note: expanded from macro 'IS_INT'
  #define IS_INT(x)  (PyInt_Check(x) || PyLong_Check(x))
                      ^
  pycryptosat.cpp:366:11: error: no member named 'ob_type' in 'Solver'
      self->ob_type->tp_free((PyObject*)self);
      ~~~~  ^
  pycryptosat.cpp:409:5: error: cannot initialize a member subobject of type
'Py_ssize_t' (aka 'long') with
        an lvalue of type 'const char [19]'
      "pycryptosat.Solver",             /*tp_name*/
      ^~~~~~~~~~~~~~~~~~~~
  pycryptosat.cpp:412:5: error: cannot initialize a member subobject of type
'printfunc' (aka 'int
        (*)(PyObject *, FILE *, int)') with an rvalue of type 'destructor' (aka
'void (*)(PyObject *)'):
        different number of parameters (3 vs 1)
      (destructor)Solver_dealloc, /*tp_dealloc*/
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
  pycryptosat.cpp:427:5: error: cannot initialize a member subobject of type
'const char *' with an rvalue
        of type 'unsigned long'
      Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /usr/local/include/python3.4/object.h:647:29: note: expanded from macro
'Py_TPFLAGS_DEFAULT'
  #define Py_TPFLAGS_DEFAULT  ( \
                              ^
  pycryptosat.cpp:428:5: error: cannot initialize a member subobject of type
'traverseproc' (aka 'int
        (*)(PyObject *, visitproc, void *)') with an lvalue of type 'const char
[15]'
      "Solver objects",           /* tp_doc */
      ^~~~~~~~~~~~~~~~
  pycryptosat.cpp:435:5: error: cannot initialize a member subobject of type
'struct PyMemberDef *' with an
        lvalue of type 'PyMethodDef [4]'
      Solver_methods,             /* tp_methods */
      ^~~~~~~~~~~~~~
  pycryptosat.cpp:436:5: error: cannot initialize a member subobject of type
'struct PyGetSetDef *' with an
        lvalue of type 'PyMemberDef [1]'
      Solver_members,            /* tp_members */
      ^~~~~~~~~~~~~~
  pycryptosat.cpp:443:5: error: cannot initialize a member subobject of type
'allocfunc' (aka 'PyObject
        *(*)(struct _typeobject *, Py_ssize_t)') with an rvalue of type
'initproc' (aka 'int (*)(PyObject *,
        PyObject *, PyObject *)'): different number of parameters (2 vs 3)
      (initproc)Solver_init,      /* tp_init */
      ^~~~~~~~~~~~~~~~~~~~~
  pycryptosat.cpp:445:5: error: cannot initialize a member subobject of type
'freefunc'
        (aka 'void (*)(void *)') with an lvalue of type
        'PyObject *(PyTypeObject *, PyObject *, PyObject *)': different number
of parameters (1 vs 3)
      Solver_new,                 /* tp_new */
      ^~~~~~~~~~
  pycryptosat.cpp:458:9: error: non-void function 'initpycryptosat' should
return a value [-Wreturn-type]
          return;
          ^
  pycryptosat.cpp:460:9: error: use of undeclared identifier 'Py_InitModule3'
      m = Py_InitModule3("pycryptosat", module_methods,
          ^

Also, USES+=python:build doesn't account for libpython dependency.

  $ readelf -d .../pycryptosat.so | fgrep NEEDED
   0x0000000000000001 (NEEDED)             Shared library:
[libcryptominisat4.so]
   0x0000000000000001 (NEEDED)             Shared library: [libpython2.7.so.1]
   0x0000000000000001 (NEEDED)             Shared library: [libc++.so.1]
   0x0000000000000001 (NEEDED)             Shared library: [libcxxrt.so.1]
   0x0000000000000001 (NEEDED)             Shared library: [libm.so.5]
   0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
   0x0000000000000001 (NEEDED)             Shared library: [libc.so.7]

>> Why not create a separate USE_PYTHON=distutils port that depends on this one?
> I don't see why it's required. The setup.py script is still configured by
> CMake, so, from my understanding, i would have to run either cmake or setup.py
> manually.

It was merely a suggestion (not requirement) to:
- let the ports framework set the build environment for you
- provide python bindings for package users

I'm attaching an example with all of the mentioned issues addressed.
Hopefully, slave deduplication doesn't make the approach hard
to understand.

-- 
You are receiving this mail because:
You are the assignee for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-199929-13-snI555UDyJ>