LibreDWG / libredwg

Official mirror of libredwg. With CI hooks and nightly releases. PR's ok
https://savannah.gnu.org/projects/libredwg/
GNU General Public License v3.0
974 stars 233 forks source link

building libredwg with conda fails #101

Closed looooo closed 3 years ago

looooo commented 5 years ago

I am trying to build libredwg with conda-build but this fails due to python linking:

ac_python_libdir=$PREFIX/lib/python3.7/config-3.7m-x86_64-linux-gnu
ac_python_library=libpython3.7m.a
ac_python_soname=libpython3.7m.a
use the --enable-frameworked shared library
-L$PREFIX/lib/python3.7/config-3.7m-x86_64-linux-gnu -lpython3.7
checking for Python site-packages path... $PREFIX/lib/python3.7/site-packages
checking python extra libraries...  -lpthread -ldl  -lutil -lrt
checking python extra linking flags... -Xlinker -export-dynamic
configure: error: in `/opt/conda/conda-bld/libredwg_1553605983551/work':
checking consistency of all components of python development environment... no
configure: error: 
  Could not link test program to Python. Maybe the main Python library has been
  installed in some non-standard library path. If so, pass it to configure,
  via the LDFLAGS environment variable.
  Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"
  ============================================================================
   ERROR!
   You probably have to install the development version of the Python package
   for your distribution.  The exact name of this package varies among them.
  ============================================================================

Setting LDFLAGS didn't help either. I wonder what's wrong here. I think conda-build needs static python linking. Maybe this is not supported by libredwg?

rurban commented 5 years ago

Does $PREFIX/lib/python3.7/config-3.7m-x86_64-linux-gnu exist? The problem is that there exists no stable autoconf python probe. You need to either disable python or provide the proper LDFLAGS. LDFLAGS="-L$PREFIX/lib/python3.7/config-3.7m-x86_64-linux-gnu -lpython3.7m" might work.

looooo commented 5 years ago

yes exists:

ls $PREFIX/lib/python3.7/config-3.7m-x86_64-linux-gnu/  
config.c  config.c.in  install-sh  libpython3.7m.a  Makefile  makesetup  __pycache__  python-config.py  python.o  Setup  Setup.local

Doesn't yet work with this configuration:

./configure LDFLAGS="-L$PREFIX/lib/python3.7/config-3.7m-x86_64-linux-gnu -lpython3.7m"

I would like to test the python interface. So building without python is not my goal.

edit.: changed path in a wrong way.

rurban commented 5 years ago

conda certainly is broken. $PREFIX should be /usr/local not a subdir.

looooo commented 5 years ago

sry, I guess this was my fault by replacing some parts of the path with $PREFIX in a wrong way. I edited my comment.

tadeu commented 5 years ago

@looooo, could you post your recipe? Also, if possible, a full output from a build. You can also create a "work in progress" (WIP) pull-request for conda-forge, so that the errors may be resolved incrementally.

looooo commented 5 years ago

good idea: https://github.com/conda-forge/staged-recipes/pull/8055

rurban commented 5 years ago

python can be linked static or dynamic, there's not much difference. I just need to find the library and it's name.

Cool, I see now a bigger picture, conda being a kind of meta CI service for multiple platforms, right? I see what I can do, but for now I can only watch.

Note that current master is not yet packaging worthy, but tests fine. I am in the middle of a rearchitecturing (dynapi) for more import filters (mainly dxf2dwg). This will need at least two months.

looooo commented 5 years ago

I am currently using version 0.7.

Cool, I see now a bigger picture, conda being a kind of meta CI service for multiple platforms, right?

conda is a package-manager. conda-build are the build tools to create conda-packages. And conda-forge is the organisation which makes it possible to use different ci's to build conda-packages.

looooo commented 5 years ago

for python2 it seems like python was detected the right way. But for python3 also the ci's report the same error.

I am wondering about this line (from the python3 build):

use the --enable-frameworked shared library
rurban commented 5 years ago

I added the --enable-frameworked probe to the m4 autoconf-archive probe, because the old one didn't work then. Now I saw someone updated it again. You can try that instead: https://github.com/autoconf-archive/autoconf-archive/blob/master/m4/ax_python_devel.m4

It would be cool to have a conda package for libredwg

looooo commented 5 years ago

I tried it, but I guess more files need to be updated:

CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh $SRC_DIR/build-aux/missing aclocal-1.16 -I m4
/home/conda/feedstock_root/build_artifacts/libredwg_1553633354798/work/build-aux/missing: line 81: aclocal-1.16: command not found
WARNING: 'aclocal-1.16' is missing on your system.
looooo commented 5 years ago

@rurban Can you point me to the diff of the configuration files.

rurban commented 5 years ago

With this error you need to run autoreconf --install --symlink -I m4 first. In fact the configure recipe in the conda build.sh should do a sh autogen.sh; ./configure

The ax_python_devel.m4 replacement is enough, but you never know what else is missing on the smoker or build machine.

looooo commented 5 years ago

Ok, I added the install instructions and use latest sources from the master-branch. I am still seeing the issue with the python configuration (I deleted the patch which updats ax_python_devel.m4)

Is it possible to update the configure files directly in the master branch?

rurban commented 5 years ago

Yes, I'm just smoking it...

Nope, the default probe breaks cygwin. Have to work on it again.

looooo commented 5 years ago

good work :+1: . linux seems to work now (locally) Now let's see what the ci's say. https://anaconda.org/freecad/libredwg

rurban commented 5 years ago

linux seems ok, but this is easy. I'd like to see mingw64 also, because this would be the most popular platform.

looooo commented 5 years ago

osx is also good. No idea about mingw64. I don't understand how to use autotools for this toolchain. But for me this isn't a show stopper.

rurban commented 4 years ago

Hi @looooo Can you please verify that master as of 4b99edb0ea26e99ef65c5fe68670e6b1f9382d44 works on conda. (0.10.1.3756) This is the 0.11 release candidate.

looooo commented 4 years ago

https://github.com/conda-forge/libredwg-feedstock/pull/49

seems to work. python bindings for windows are still disabled. also I saw problems after merging previous pr. I will report back once I know more about it.

edit: packages are uploaded to anaconda. The ci reports that the upload fails, but actually it is working. Not sure what is wrong here (but it is not related to libredwg). https://github.com/conda-forge/libredwg-feedstock/issues/35

regarding the windows-python bindings: should we try this again, or is the state still the same. (As nobody currently is using the python bindings I guess this is not of big importance...)

looooo commented 4 years ago

@rurban I see some big differences in package-size: win: ~8mb (no python bindings) osx: ~24mb linux: ~52mb

https://anaconda.org/conda-forge/libredwg/files?version=0.11

any ideas why the difference is that big? I guess I should exclude the static library from the package but still the shared-library is about 60.8mb (uncompressed).

looooo commented 4 years ago

also basic import / export does not work anymore:

Warning: dxf2dwg is still experimental.
Reading DXF file /tmp/tmpcelg85pc/test.dxf
Warning: Unknown HEADER.DIMSTYLE STANDARD dxf:3
Warning: Unknown HEADER.CMLSTYLE STANDARD dxf:2
ERROR: Unexpected DXF end-of-file
Warning: Unknown HEADER.DIMSTYLE STANDARD dxf:3
Warning: Unknown HEADER.CMLSTYLE STANDARD dxf:2
Warning: Object handle not found, 1/1 in 31 objects
Warning: Object handle not found, 12/C in 31 objects
Writing DWG file /home/lo/Schreibtisch/test.dwg
rurban commented 4 years ago

Can I have this DXF?

rurban commented 4 years ago

The size increase is expected. Many more objects were added.

looooo commented 4 years ago

test.dxf.zip

You need to remove the .zip extension. (Github doesn't allow to upload dxf).

This is a simple line created with freecad and exported to dxf. I am using this ibredwg version:

libredwg                  0.11             py38hbb43d70_0    conda-forge
rurban commented 4 years ago

This cannot be downloaded, because it is passed through zipinfo by the server. Maybe make a real zip for it. Forget it, got it now with perl's lwp-request -U

rurban commented 4 years ago

The problem with this DXF is the missing final EOL in the dxf.

  0
EOF

If the dxfwriter adds a final "\n" or "\r\n" it will not display the ERROR: Unexpected DXF end-of-file

Other than that, this error can be ignored, because the EOF is already assumed, and the conversion goes fine.

Regarding the two missing TEXT and DIMSTYLE's STANDARD warnings: The texts do get the correct handles 71 attached. The warning can be ignored because at that time those handles are not known, and will be resolved later.

The remaining problems are the missing handles for HEADER.DIMSTYLE STANDARD (79) and HEADER.CMLSTYLE STANDARD, which are harmless, because they are default. Will fix them later.

rurban commented 3 years ago

For new errors please a new ticket