Skip to content

Conversation

@LipuFei
Copy link
Contributor

@LipuFei LipuFei commented Feb 22, 2019

This commit should work in both docker (using centos7 with cmake 3.13) and the current build/CI servers (with cmake <3.12).

  • Requires CMake 3.6+
  • Cleanups and Fixes for FindSIP
  • Fix find Python to prefer Python 3 found in CMAKE_PREFIX_PATH

@LipuFei LipuFei changed the title Fixes for building in docker CURA-6187 Fixes for building in docker Feb 22, 2019
@LipuFei
Copy link
Contributor Author

LipuFei commented Apr 2, 2019

CURA-6188 Also added GitLab CI files.

@thopiekar
Copy link
Contributor

thopiekar commented Apr 4, 2019

(Regarding your question whether I can test the PR 😉)

Sure! Excuse that I was not replying recently.
I got very busy with my (main) job again.

@thopiekar
Copy link
Contributor

thopiekar commented Apr 4, 2019

Up and running: https://thopiekar.eu:5443/cura/cdk/pipelines/314
Short explanation:

  • My fork works in 3 stages:
    • Build of all build tools
    • Build of all development tools (to do tests)
    • Build of Ultimaker software

However, I never came to the point, where software distributions are done, eg. AppImage for Linux, NSIS for Windows, etc.
So my fork is basically a mix of cura-build and -environment with extra software. Also can cache download, etc.
If you are interested in any further I can give you more details.

CMakeLists.txt Outdated

# FIXME: Remove the code for CMake <3.12 once we have switched over completely.
# FindPython3 is a new module since CMake 3.12. It deprecates FindPythonInterp and FindPythonLibs. The FindPython3
# module is copied from the CMake repository here so in CMake <3.12 we can still use it.
Copy link
Member

Choose a reason for hiding this comment

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

I(/we) assume this is still 'fixme' because we don't want to rely on the copy once we're over to 3.12+?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Our current (old) systems are still using CMake < 3.12, but in the docker image, it's CMake >= 3.12. This FIXME is to keep compatibility for now. Once the old systems are retired, we can remove this FIXME.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The comments are not entirely correct. I've updated them in e15df83.

@Ghostkeeper Ghostkeeper merged commit e15df83 into master Apr 17, 2019
@Ghostkeeper Ghostkeeper deleted the WIP_fix_docker branch April 17, 2019 14:53
@hroncok
Copy link
Contributor

hroncok commented Jun 25, 2019

Any chance I can force the Python module to be installed to /usr/lib64/python3.7/site-packages instead of /usr/lib/python3.7/site-packages? It used to work automatically, but now it stopped.

I've tried with:

-DPYTHON_SITE_PACKAGES_DIR=/usr/lib64/python3.7/site-packages
-DPython3_SITELIB=/usr/lib64/python3.7/site-packages
-DPython3_SITEARCH=/usr/lib64/python3.7/site-packages

But it always ends up in /usr/lib/python3.7/site-packages

@LipuFei
Copy link
Contributor Author

LipuFei commented Jun 25, 2019

@hroncok You can try CMAKE_INSTALL_LIBDIR=lib (see https://cmake.org/cmake/help/v3.12/module/GNUInstallDirs.html)

EDIT: CMAKE_INSTALL_LIBDIR=lib64

@hroncok
Copy link
Contributor

hroncok commented Jun 25, 2019

Doesn't help:

-DCMAKE_INSTALL_LIBDIR=lib64

-- Installing: /builddir/build/BUILDROOT/libarcus-4.1.0-1.fc31.x86_64/usr/lib/python3.7/site-packages/Arcus.so
-- Installing: /builddir/build/BUILDROOT/libarcus-4.1.0-1.fc31.x86_64/usr/lib64/libArcus.so.1.1.0
-- Installing: /builddir/build/BUILDROOT/libarcus-4.1.0-1.fc31.x86_64/usr/lib64/libArcus.so.3
-- Installing: /builddir/build/BUILDROOT/libarcus-4.1.0-1.fc31.x86_64/usr/lib64/libArcus.so
-- Installing: /builddir/build/BUILDROOT/libarcus-4.1.0-1.fc31.x86_64/usr/include/Arcus/Socket.h
-- Installing: /builddir/build/BUILDROOT/libarcus-4.1.0-1.fc31.x86_64/usr/include/Arcus/SocketListener.h
-- Installing: /builddir/build/BUILDROOT/libarcus-4.1.0-1.fc31.x86_64/usr/include/Arcus/Types.h
-- Installing: /builddir/build/BUILDROOT/libarcus-4.1.0-1.fc31.x86_64/usr/include/Arcus/ArcusExport.h
-- Installing: /builddir/build/BUILDROOT/libarcus-4.1.0-1.fc31.x86_64/usr/include/Arcus/MessageTypeStore.h
-- Installing: /builddir/build/BUILDROOT/libarcus-4.1.0-1.fc31.x86_64/usr/include/Arcus/Error.h
-- Installing: /builddir/build/BUILDROOT/libarcus-4.1.0-1.fc31.x86_64/usr/lib64/cmake/Arcus/Arcus-targets.cmake
-- Installing: /builddir/build/BUILDROOT/libarcus-4.1.0-1.fc31.x86_64/usr/lib64/cmake/Arcus/Arcus-targets-noconfig.cmake
-- Installing: /builddir/build/BUILDROOT/libarcus-4.1.0-1.fc31.x86_64/usr/lib64/cmake/Arcus/ArcusConfig.cmake
-- Installing: /builddir/build/BUILDROOT/libarcus-4.1.0-1.fc31.x86_64/usr/lib64/cmake/Arcus/ArcusConfigVersion.cmake

@LipuFei
Copy link
Contributor Author

LipuFei commented Jun 25, 2019

@hroncok I think this has to do with where the python3.7 libraries are installed. Because the python modules are installed in usr/lib/..., it simply uses that path to install the Arcus python modules. Maybe you can try a trick to create a lib64 symbolic link pointing to lib or the other way around.

@hroncok
Copy link
Contributor

hroncok commented Jun 25, 2019

I'm afraid I don't understand. This is an extension module and hence need to be installed in sitearch. sitearch is determined by distutils.sysconfig.get_python_lib(plat_specific=1), instead it is installed into sitelib (plat_specific=0).

The /builddir/build/BUILDROOT/libarcus-4.1.0-1.fc31.x86_64/usr/directory is empty before I do make install DESTDIR=/builddir/build/BUILDROOT/libarcus-4.1.0-1.fc31.x86_64.

Maybe you can try a trick to create a lib64 symbolic link pointing to lib or the other way around.

How does that help? I can "trick" it by mving that file after make install, I'm just looking for a less hackish solution.

@Ghostkeeper
Copy link
Contributor

I think the bug in this case lies in the FindPython script that we're using. This detects the installation folder that you need changed. On Cura's side we can only make hacks around that script, but the real bug is in CMake itself here.

@hroncok
Copy link
Contributor

hroncok commented Jun 27, 2019

That macro should give you proper Python_SITEARCH. Where do you instruct cmake to install the Python extension? I don't really know cmake, but maybe you need to tell it it belongs to Python_SITEARCH?

@Ghostkeeper
Copy link
Contributor

The code that causes the plug-in to be installed is this line:

add_sip_python_module(Arcus python/Socket.sip Arcus)

This calls upon a CMake function in the Sip import of CMake. The only documentation of this function that I found online was here: https://api.kde.org/cmake/modules.html (search for add_sip_python_module).

@hroncok
Copy link
Contributor

hroncok commented Jun 27, 2019

This looks suspicious:

INSTALL(TARGETS ${_logical_name} DESTINATION "${Python3_SITELIB}/${_parent_module_path}")

@hroncok
Copy link
Contributor

hroncok commented Jun 27, 2019

Changing that to Python3_SITEARCH fixes the problem. I'd report that to the upstream of those macros, but I have no idea where is that.

@Ghostkeeper
Copy link
Contributor

Aha, good find. I thought that add_sip_python_module came from the find_package(SIP REQUIRED) line, but it's not from there apparently.

The upstream of those macros is @sedwards2009 who was since hired by Ultimaker (by sheer coincidence)... But I doubt that he's still involved in this. What exact change did you make, and perhaps you'd like to get recognition of your change by making a PR? 😄

@hroncok
Copy link
Contributor

hroncok commented Jun 27, 2019

I can definitively send a PR that just changes it here (and possible in libsavitar), I just assumed those are vendored/bundled/copied from somewhere else.

hroncok added a commit to hroncok/libArcus that referenced this pull request Jun 27, 2019
The sitearch directory is used for compiled code, such as this extension module.

See Ultimaker#94 (comment)
@hroncok
Copy link
Contributor

hroncok commented Jun 27, 2019

🎉 #99 🎉

hroncok added a commit to hroncok/libSavitar that referenced this pull request Jun 27, 2019
The sitearch directory is used for compiled code, such as this extension module.

See Ultimaker/libArcus#94 (comment)
@hroncok
Copy link
Contributor

hroncok commented Jun 27, 2019

And Ultimaker/libSavitar#18

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

Successfully merging this pull request may close these issues.

6 participants