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

ifcopenshell: 240611 -> 0.7.10, fix build and activate most tests #312381

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

autra
Copy link
Contributor

@autra autra commented May 17, 2024

Description of changes

Fix the ifcopenshell build.

Fix #312380

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@autra
Copy link
Contributor Author

autra commented May 17, 2024

Ok now it's compiling, but I have a weird problem with the runtime lib. libxml2 is missing at runtime:

 ❯ ldd result/bin/IfcConvert
        linux-vdso.so.1 (0x00007ffed5cc0000)
        libTKernel.so.7 => /nix/store/p2y06mqk94i5sapgja08fvf9g5lzabxb-opencascade-occt-7.6.2/lib/libTKernel.so.7 (0x00007f73733f4000)
        libTKMath.so.7 => /nix/store/p2y06mqk94i5sapgja08fvf9g5lzabxb-opencascade-occt-7.6.2/lib/libTKMath.so.7 (0x00007f7373000000)
        libTKBRep.so.7 => /nix/store/p2y06mqk94i5sapgja08fvf9g5lzabxb-opencascade-occt-7.6.2/lib/libTKBRep.so.7 (0x00007f73732c5000)
        libTKGeomBase.so.7 => /nix/store/p2y06mqk94i5sapgja08fvf9g5lzabxb-opencascade-occt-7.6.2/lib/libTKGeomBase.so.7 (0x00007f7372a00000)
        libTKGeomAlgo.so.7 => /nix/store/p2y06mqk94i5sapgja08fvf9g5lzabxb-opencascade-occt-7.6.2/lib/libTKGeomAlgo.so.7 (0x00007f7372400000)
        libTKG3d.so.7 => /nix/store/p2y06mqk94i5sapgja08fvf9g5lzabxb-opencascade-occt-7.6.2/lib/libTKG3d.so.7 (0x00007f7372ed8000)
        libTKG2d.so.7 => /nix/store/p2y06mqk94i5sapgja08fvf9g5lzabxb-opencascade-occt-7.6.2/lib/libTKG2d.so.7 (0x00007f73729a1000)
        libTKShHealing.so.7 => /nix/store/p2y06mqk94i5sapgja08fvf9g5lzabxb-opencascade-occt-7.6.2/lib/libTKShHealing.so.7 (0x00007f7372000000)
        libTKTopAlgo.so.7 => /nix/store/p2y06mqk94i5sapgja08fvf9g5lzabxb-opencascade-occt-7.6.2/lib/libTKTopAlgo.so.7 (0x00007f7371c00000)
        libTKMesh.so.7 => /nix/store/p2y06mqk94i5sapgja08fvf9g5lzabxb-opencascade-occt-7.6.2/lib/libTKMesh.so.7 (0x00007f73722ed000)
        libTKPrim.so.7 => /nix/store/p2y06mqk94i5sapgja08fvf9g5lzabxb-opencascade-occt-7.6.2/lib/libTKPrim.so.7 (0x00007f737293a000)
        libTKBool.so.7 => /nix/store/p2y06mqk94i5sapgja08fvf9g5lzabxb-opencascade-occt-7.6.2/lib/libTKBool.so.7 (0x00007f7371600000)
        libTKBO.so.7 => /nix/store/p2y06mqk94i5sapgja08fvf9g5lzabxb-opencascade-occt-7.6.2/lib/libTKBO.so.7 (0x00007f7371200000)
        libTKFillet.so.7 => /nix/store/p2y06mqk94i5sapgja08fvf9g5lzabxb-opencascade-occt-7.6.2/lib/libTKFillet.so.7 (0x00007f7370e00000)
        libTKSTEP.so.7 => /nix/store/p2y06mqk94i5sapgja08fvf9g5lzabxb-opencascade-occt-7.6.2/lib/libTKSTEP.so.7 (0x00007f7370a00000)
        libTKSTEPBase.so.7 => /nix/store/p2y06mqk94i5sapgja08fvf9g5lzabxb-opencascade-occt-7.6.2/lib/libTKSTEPBase.so.7 (0x00007f7370600000)
        libTKSTEPAttr.so.7 => /nix/store/p2y06mqk94i5sapgja08fvf9g5lzabxb-opencascade-occt-7.6.2/lib/libTKSTEPAttr.so.7 (0x00007f7371a39000)
        libTKXSBase.so.7 => /nix/store/p2y06mqk94i5sapgja08fvf9g5lzabxb-opencascade-occt-7.6.2/lib/libTKXSBase.so.7 (0x00007f7370200000)
        libTKSTEP209.so.7 => /nix/store/p2y06mqk94i5sapgja08fvf9g5lzabxb-opencascade-occt-7.6.2/lib/libTKSTEP209.so.7 (0x00007f7371f57000)
        libTKIGES.so.7 => /nix/store/p2y06mqk94i5sapgja08fvf9g5lzabxb-opencascade-occt-7.6.2/lib/libTKIGES.so.7 (0x00007f736fc00000)
        libTKOffset.so.7 => /nix/store/p2y06mqk94i5sapgja08fvf9g5lzabxb-opencascade-occt-7.6.2/lib/libTKOffset.so.7 (0x00007f737004c000)
        libTKHLR.so.7 => /nix/store/p2y06mqk94i5sapgja08fvf9g5lzabxb-opencascade-occt-7.6.2/lib/libTKHLR.so.7 (0x00007f73710d9000)
        libTKBin.so.7 => /nix/store/p2y06mqk94i5sapgja08fvf9g5lzabxb-opencascade-occt-7.6.2/lib/libTKBin.so.7 (0x00007f7373290000)
        libhdf5_cpp.so.310 => /nix/store/l34mr0cav6k6798gfx99hz02w5wwv1as-hdf5-cpp-1.14.3/lib/libhdf5_cpp.so.310 (0x00007f7371580000)
        libhdf5.so.310 => /nix/store/l34mr0cav6k6798gfx99hz02w5wwv1as-hdf5-cpp-1.14.3/lib/libhdf5.so.310 (0x00007f736f600000)
        libz.so.1 => /nix/store/zph9xw0drmq3rl2ik5slg0n2frw9lw5m-zlib-1.3.1/lib/libz.so.1 (0x00007f7372eba000)
        libboost_system.so.1.79.0 => /nix/store/mcj6hbf8amfq4ii6kqi510d43xgjq6as-boost-1.79.0/lib/libboost_system.so.1.79.0 (0x00007f7373289000)
        libboost_program_options.so.1.79.0 => /nix/store/mcj6hbf8amfq4ii6kqi510d43xgjq6as-boost-1.79.0/lib/libboost_program_options.so.1.79.0 (0x00007f7371eeb000)
        libboost_regex.so.1.79.0 => /nix/store/mcj6hbf8amfq4ii6kqi510d43xgjq6as-boost-1.79.0/lib/libboost_regex.so.1.79.0 (0x00007f737152f000)
        libboost_thread.so.1.79.0 => /nix/store/mcj6hbf8amfq4ii6kqi510d43xgjq6as-boost-1.79.0/lib/libboost_thread.so.1.79.0 (0x00007f737291c000)
        libboost_date_time.so.1.79.0 => /nix/store/mcj6hbf8amfq4ii6kqi510d43xgjq6as-boost-1.79.0/lib/libboost_date_time.so.1.79.0 (0x00007f7372917000)
        libxml2.so.2 => not found
        libpcre.so.1 => /nix/store/pq0cj8f364jvv16yqvkc43cz2vwcwg03-pcre-8.45/lib/libpcre.so.1 (0x00007f7370d86000)
        libstdc++.so.6 => /nix/store/c2yb135iv4maadia5f760b3xhbh6jh61-gcc-13.2.0-lib/lib/libstdc++.so.6 (0x00007f736f200000)
        libm.so.6 => /nix/store/ddwyrxif62r8n6xclvskjyy6szdhvj60-glibc-2.39-5/lib/libm.so.6 (0x00007f737091d000)
        libgcc_s.so.1 => /nix/store/c2yb135iv4maadia5f760b3xhbh6jh61-gcc-13.2.0-lib/lib/libgcc_s.so.1 (0x00007f73722c8000)
        libc.so.6 => /nix/store/ddwyrxif62r8n6xclvskjyy6szdhvj60-glibc-2.39-5/lib/libc.so.6 (0x00007f736f013000)
        /nix/store/ddwyrxif62r8n6xclvskjyy6szdhvj60-glibc-2.39-5/lib/ld-linux-x86-64.so.2 => /nix/store/anlf335xlh41yjhm114swi87406mq5pw-glibc-2.38-44/lib64/ld-linux-x86-64.so.2 (0x00007f73735e5000)
        libpthread.so.0 => /nix/store/ddwyrxif62r8n6xclvskjyy6szdhvj60-glibc-2.39-5/lib/libpthread.so.0 (0x00007f7372910000)
        librt.so.1 => /nix/store/ddwyrxif62r8n6xclvskjyy6szdhvj60-glibc-2.39-5/lib/librt.so.1 (0x00007f737290b000)
        libdl.so.2 => /nix/store/ddwyrxif62r8n6xclvskjyy6szdhvj60-glibc-2.39-5/lib/libdl.so.2 (0x00007f7372904000)
        libTKCAF.so.7 => /nix/store/p2y06mqk94i5sapgja08fvf9g5lzabxb-opencascade-occt-7.6.2/lib/libTKCAF.so.7 (0x00007f7370556000)
        libTKBinL.so.7 => /nix/store/p2y06mqk94i5sapgja08fvf9g5lzabxb-opencascade-occt-7.6.2/lib/libTKBinL.so.7 (0x00007f73708bf000)
        libTKLCAF.so.7 => /nix/store/p2y06mqk94i5sapgja08fvf9g5lzabxb-opencascade-occt-7.6.2/lib/libTKLCAF.so.7 (0x00007f736fb04000)
        libTKCDF.so.7 => /nix/store/p2y06mqk94i5sapgja08fvf9g5lzabxb-opencascade-occt-7.6.2/lib/libTKCDF.so.7 (0x00007f73704f7000)
        libicudata.so.73 => /nix/store/qwnmd1a9zxfjqgkhv3jyyf86r9jm4gsq-icu4c-73.2/lib/libicudata.so.73 (0x00007f736d000000)
        libicui18n.so.73 => /nix/store/qwnmd1a9zxfjqgkhv3jyyf86r9jm4gsq-icu4c-73.2/lib/libicui18n.so.73 (0x00007f736cc00000)
        libicuuc.so.73 => /nix/store/qwnmd1a9zxfjqgkhv3jyyf86r9jm4gsq-icu4c-73.2/lib/libicuuc.so.73 (0x00007f736c800000)

I have no idea how to fix this problem, for me buildInputs was supposed to do the job (and it does so for opencascade)... @fehnomenal any idea?

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/fixing-ifcopenshell-libxml2-not-found-by-linker-at-runtime/45764/1

@autra
Copy link
Contributor Author

autra commented May 22, 2024

Ok so I fixed my libxml2 issue by making this a regular package and not a python package (see last temp commit). So it's something to do with the way python packages are made.

Can I - and should I - split the lib and the python packaging into 2 derivations? That would allow freecad to depend only on one of them for instance.

@autra
Copy link
Contributor Author

autra commented May 22, 2024

That being said, my end goal is freecad ifc support, and apparently this needs python bindings, so I might not personnally need the split.

@autra
Copy link
Contributor Author

autra commented May 23, 2024

I feel that I need mkDerivation (because it executes the patchElf phase) and buildPythonPackage. How can I combine the 2?

@autra
Copy link
Contributor Author

autra commented Jul 23, 2024

Result of nixpkgs-review pr 312381 run on x86_64-linux 1

2 packages failed to build:
  • python311Packages.ifcopenshell
  • python312Packages.ifcopenshell

@autra
Copy link
Contributor Author

autra commented Aug 2, 2024

I fixed a nixf-tidy error and added opencollada as buildInputs.

@fehnomenal
Copy link
Contributor

Thanks for taking the time to investigate all of this and also thanks for replacing me 👍🚀

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/fixing-ifcopenshell-libxml2-not-found-by-linker-at-runtime/45764/5

@autra
Copy link
Contributor Author

autra commented Sep 6, 2024

Result of nixpkgs-review pr 312381 run on x86_64-linux 1

2 packages built:
  • python311Packages.ifcopenshell
  • python312Packages.ifcopenshell

@autra
Copy link
Contributor Author

autra commented Sep 6, 2024

@natsukium hi! If I'm not mistaken, you're the code owner for this. Fehnomenal already approved it and I'm now maintainer. I think it's ready to get merged. Thanks!

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/4583

pkgs/development/python-modules/ifcopenshell/default.nix Outdated Show resolved Hide resolved
pkgs/development/python-modules/ifcopenshell/default.nix Outdated Show resolved Hide resolved
pkgs/development/python-modules/ifcopenshell/default.nix Outdated Show resolved Hide resolved
PYTHONPATH=../src/ifcopenshell-python/ python tests.py
popd
# like make test-safe, but also ignoring test/test_open.py which segfaults (this needs to be investigated)
pytest -p no:pytest-blender test --ignore=test/util/test_shape_builder.py --ignore=test/test_open.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use pytestCheckHook?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for this line or for the whole checkPhase? I remembered I couldn't make it work, but as I don't remember why, I'll try again :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've kept the python tests.py thing in a preCheck, and used pytestCheckHook. Can you check if the way I did it is ok? I'm not quite sure...

pkgs/development/python-modules/ifcopenshell/default.nix Outdated Show resolved Hide resolved
pkgs/top-level/python-packages.nix Show resolved Hide resolved
@autra
Copy link
Contributor Author

autra commented Sep 18, 2024

Result of nixpkgs-review pr 312381 run on x86_64-linux 1

2 packages built:
  • python311Packages.ifcopenshell
  • python312Packages.ifcopenshell

@autra
Copy link
Contributor Author

autra commented Sep 18, 2024

@SuperSandro2000 @Artturin thanks for the comments! I've adressed them, please review again 😺

pkgs/development/python-modules/ifcopenshell/default.nix Outdated Show resolved Hide resolved
Comment on lines 160 to 163
ifcopenshell_so_path=$out/${python.sitePackages}/ifcopenshell/_ifcopenshell_wrapper.cpython-${
lib.versions.major python.version + lib.versions.minor python.version
}-x86_64-linux-gnu.so
cp -v $ifcopenshell_so_path ./ifcopenshell
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ifcopenshell_so_path=$out/${python.sitePackages}/ifcopenshell/_ifcopenshell_wrapper.cpython-${
lib.versions.major python.version + lib.versions.minor python.version
}-x86_64-linux-gnu.so
cp -v $ifcopenshell_so_path ./ifcopenshell
cp $out/${python.sitePackages}/ifcopenshell/_ifcopenshell_wrapper.cpython-${ib.versions.major python.version + lib.versions.minor python.version}-x86_64-linux-gnu.so ./ifcopenshell

we probably also want to variablize the x86_64 or just use a wildcard

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does ${system} works in all cases here? (it would for x86_64-linux but I'm wary of differences for other plateforms)

pushd src/ifcopenshell-python
# The build process is here: https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.8.0/src/ifcopenshell-python/Makefile#L131
# NOTE: it has changed a *lot* between 0.7.0 and 0.8.0, it *may* change again (look for mathutils and basically all the things this Makefile does manually)
substituteInPlace pyproject.toml --replace-fail "0.0.0" "${version}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be done in postPatch

pkgs/development/python-modules/ifcopenshell/default.nix Outdated Show resolved Hide resolved
pkgs/development/python-modules/ifcopenshell/default.nix Outdated Show resolved Hide resolved
pkgs/development/python-modules/ifcopenshell/default.nix Outdated Show resolved Hide resolved
@autra autra force-pushed the fix_ifcopenshell_build branch 4 times, most recently from 4fd6b9a to b3a0f4e Compare September 30, 2024 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ifcopenshell build is broken
7 participants