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

fix #700 #701

Merged
merged 4 commits into from Apr 16, 2018
Merged

fix #700 #701

merged 4 commits into from Apr 16, 2018

Conversation

slyshykO
Copy link
Collaborator

Use CMAKE_INSTALL_PREFIX for install paths

Need to approve from @cedricboudinet and @Vascom

Use CMAKE_INSTALL_PREFIX for install paths
Copy link
Collaborator

@Vascom Vascom left a comment

Choose a reason for hiding this comment

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

CMAKE_INSTALL_PREFIX not needed.

CMakeLists.txt Outdated Show resolved Hide resolved
@slyshykO
Copy link
Collaborator Author

slyshykO commented Mar 30, 2018 via email

@Vascom
Copy link
Collaborator

Vascom commented Mar 30, 2018

I don't know how to remove it. But on clean installed build environment it has same error:

Installing: /builddir/build/BUILDROOT/stlink-1.5.0-1.fc27.x86_64/usr/usr/lib64/libstlink.so.1.5.0

Full build log https://kojipkgs.fedoraproject.org//work/tasks/5046/26055046/build.log
https://koji.fedoraproject.org/koji/taskinfo?taskID=26055046

P.S. Don't see to version 1.5.0, it use zip from your branch fix-linux-install.

@slyshykO slyshykO changed the title first try to fix #700 first try to fix #700 (WIP, not ready for merge) Mar 30, 2018
@Vascom
Copy link
Collaborator

Vascom commented Mar 30, 2018

Not work.
In CMakeCache.txt it has lines:

//No help, variable specified on the command line.
LIB_INSTALL_DIR:PATH=/usr/lib64

//Target include directory
STLINK_INCLUDE_PATH:PATH=/usr/usr/include

//Target lib directory
STLINK_LIBRARY_PATH:PATH=/usr/usr/lib64

@slyshykO
Copy link
Collaborator Author

Vasiliy. You pass to cmake those variables from a command line:
CMAKE_INSTALL_PREFIX:PATH=/usr
INCLUDE_INSTALL_DIR:PATH=/usr/include
LIB_INSTALL_DIR:PATH=/usr/lib64

Can you change that to:
CMAKE_INSTALL_PREFIX:PATH=/usr
INCLUDE_INSTALL_DIR:PATH=include
LIB_INSTALL_DIR:PATH=lib64

And I, respectively, will set in cmake only:
set(STLINK_LIBRARY_PATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}" CACHE PATH "Target lib directory")
set(STLINK_INCLUDE_PATH "${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}" CACHE PATH "Target include directory")

without any checks

Copy link
Collaborator

@Vascom Vascom left a comment

Choose a reason for hiding this comment

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

Wrong parameters expansion.

CMakeLists.txt Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
@Vascom
Copy link
Collaborator

Vascom commented Mar 30, 2018

Can you change that to:

I can't change it. You need just correct variables in "if("

@Vascom
Copy link
Collaborator

Vascom commented Mar 30, 2018

Now all OK.

@slyshykO
Copy link
Collaborator Author

Will wait for approving from Debian guy.

@xor-gate
Copy link
Member

xor-gate commented Mar 30, 2018

@bluca and @zoobab are the guys who did some debian packaging and could probably verify this works.

@bluca
Copy link
Contributor

bluca commented Mar 30, 2018

I'm not a CMake expert (in fact I have an intense dislike for it...), but something is not right:
as of #683 everything was working fine for me, with the following config:

cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=None -DCMAKE_INSTALL_SYSCONFDIR=/etc -DCMAKE_INSTALL_LOCALSTATEDIR=/var -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON -DCMAKE_LIBRARY_PATH=x86_64-linux-gnu -DSTLINK_UDEV_RULES_DIR=/lib/udev/rules.d

I got what I needed:

$ dpkg -c libstlink1_1.5.0+ds-1_amd64.deb 
drwxr-xr-x root/root         0 2018-03-16 16:56 ./
drwxr-xr-x root/root         0 2018-03-16 16:56 ./usr/
drwxr-xr-x root/root         0 2018-03-16 16:56 ./usr/lib/
drwxr-xr-x root/root         0 2018-03-16 16:56 ./usr/lib/x86_64-linux-gnu/
-rw-r--r-- root/root     80256 2018-03-16 16:56 ./usr/lib/x86_64-linux-gnu/libstlink.so.1.5.0
drwxr-xr-x root/root         0 2018-03-16 16:56 ./usr/share/
drwxr-xr-x root/root         0 2018-03-16 16:56 ./usr/share/doc/
drwxr-xr-x root/root         0 2018-03-16 16:56 ./usr/share/doc/libstlink1/
-rw-r--r-- root/root      2175 2018-03-16 16:56 ./usr/share/doc/libstlink1/changelog.Debian.gz
-rw-r--r-- root/root      2751 2018-02-19 19:00 ./usr/share/doc/libstlink1/changelog.gz
-rw-r--r-- root/root      9922 2018-03-16 16:56 ./usr/share/doc/libstlink1/copyright
lrwxrwxrwx root/root         0 2018-03-16 16:56 ./usr/lib/x86_64-linux-gnu/libstlink.so.1 -> libstlink.so.1.5.0

Building from this PR this doesn't work anymore, CMAKE_LIBRARY_PATH is ignored, this is where libraries are installed now:

$ find debian/tmp/usr/lib/
debian/tmp/usr/lib/
debian/tmp/usr/lib/libstlink.so.1
debian/tmp/usr/lib/libstlink.so.1.4.0
debian/tmp/usr/lib/libstlink.so
debian/tmp/usr/lib/pkgconfig
debian/tmp/usr/lib/pkgconfig/stlink.pc
debian/tmp/usr/lib/libstlink.a

Setting LIB_INSTALL_DIR:

cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=None -DCMAKE_INSTALL_SYSCONFDIR=/etc -DCMAKE_INSTALL_LOCALSTATEDIR=/var -DLIB_INSTALL_DIR=debian/tmp/usr/lib/x86_64-linux-gnu -DSTLINK_UDEV_RULES_DIR=/lib/udev/rules.d

Makes it even worse, not sure where that path is coming from:

$ find debian/tmp/usr/home
debian/tmp/usr/home
debian/tmp/usr/home/bluca
debian/tmp/usr/home/bluca/git
debian/tmp/usr/home/bluca/git/stlink
debian/tmp/usr/home/bluca/git/stlink/obj-x86_64-linux-gnu
debian/tmp/usr/home/bluca/git/stlink/obj-x86_64-linux-gnu/debian
debian/tmp/usr/home/bluca/git/stlink/obj-x86_64-linux-gnu/debian/tmp
debian/tmp/usr/home/bluca/git/stlink/obj-x86_64-linux-gnu/debian/tmp/usr
debian/tmp/usr/home/bluca/git/stlink/obj-x86_64-linux-gnu/debian/tmp/usr/lib
debian/tmp/usr/home/bluca/git/stlink/obj-x86_64-linux-gnu/debian/tmp/usr/lib/x86_64-linux-gnu
debian/tmp/usr/home/bluca/git/stlink/obj-x86_64-linux-gnu/debian/tmp/usr/lib/x86_64-linux-gnu/libstlink.so.1
debian/tmp/usr/home/bluca/git/stlink/obj-x86_64-linux-gnu/debian/tmp/usr/lib/x86_64-linux-gnu/libstlink.so.1.4.0
debian/tmp/usr/home/bluca/git/stlink/obj-x86_64-linux-gnu/debian/tmp/usr/lib/x86_64-linux-gnu/libstlink.so
debian/tmp/usr/home/bluca/git/stlink/obj-x86_64-linux-gnu/debian/tmp/usr/lib/x86_64-linux-gnu/pkgconfig
debian/tmp/usr/home/bluca/git/stlink/obj-x86_64-linux-gnu/debian/tmp/usr/lib/x86_64-linux-gnu/pkgconfig/stlink.pc
debian/tmp/usr/home/bluca/git/stlink/obj-x86_64-linux-gnu/debian/tmp/usr/lib/x86_64-linux-gnu/libstlink.a

Not sure what to change though, sorry

@Vascom
Copy link
Collaborator

Vascom commented Mar 30, 2018

@bluca You set
-DLIB_INSTALL_DIR=debian/tmp/usr/lib/x86_64-linux-gnu
Just change it to
-DLIB_INSTALL_DIR=/usr/lib/x86_64-linux-gnu/

@bluca
Copy link
Contributor

bluca commented Mar 30, 2018

That works, thanks (as I said, not CMake expert).

Note that headers have changed path too - that is fine if they are static and arch-independent

@Vascom
Copy link
Collaborator

Vascom commented Mar 30, 2018

@bluca Headers always arch independent and placed to /usr/include/stlink.

@xor-gate
Copy link
Member

xor-gate commented Apr 2, 2018

@bluca I understand the frustration of cmake compared to autoconf build system. But it is unmaintainable and hard to write and read for developers in a cross platform way, it is easier to understand for packaging people (almost standard build parameters). Are we good now with this PR? What about the defaults without using any build parameters does it work for make install ?

@joede
Copy link
Contributor

joede commented Apr 12, 2018

@slyshykO had asked me to test his branch. It doesn't work for me here with Debian 9! IMO the debian/*.install files are wrong.

   dh_install -O--buildsystem=cmake
dh_install: Cannot find (any matches for) "usr/lib/*/lib*.a" (tried in "." and "debian/tmp")
dh_install: libstlink-dev missing files: usr/lib/*/lib*.a
dh_install: Cannot find (any matches for) "usr/lib/*/pkgconfig/*" (tried in "." and "debian/tmp")
dh_install: libstlink-dev missing files: usr/lib/*/pkgconfig/*
dh_install: Cannot find (any matches for) "usr/lib/*/lib*.so" (tried in "." and "debian/tmp")
dh_install: libstlink-dev missing files: usr/lib/*/lib*.so
dh_install: Cannot find (any matches for) "usr/lib/*/lib*.so.*" (tried in "." and "debian/tmp")
dh_install: libstlink1 missing files: usr/lib/*/lib*.so.*
dh_install: missing files, aborting
debian/rules:14: die Regel für Ziel „binary“ scheiterte

@bluca
Copy link
Contributor

bluca commented Apr 12, 2018

The install files are correct, as mentioned above the cmake options are changing in an incompatible way so debian/rules needs to be updated accordingly

@joede
Copy link
Contributor

joede commented Apr 12, 2018

@bluca the removal of the wildcard in lib/*/ may be fixed by your CMake changes. I'm no CMake expert. What is wrong with the cmake usage for debian/rules? And why are the wildcards inside the path needed?

But there are at least two glitches in the .install files.

  1. as far as I know the pathes must be relative and not absolute! So I removed the leading /!
  2. the -dev package should not have the .so file included. This is installed by the library package.

@bluca
Copy link
Contributor

bluca commented Apr 12, 2018

@slyshykO could you please also apply this patch together with your changes:

--- a/debian/rules
+++ b/debian/rules
@@ -15,5 +15,5 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 
 override_dh_auto_configure:
        dh_auto_configure -- \
-    -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) \
+    -DLIB_INSTALL_DIR=/usr/lib/$(DEB_HOST_MULTIARCH) \
     -DSTLINK_UDEV_RULES_DIR='/lib/udev/rules.d'

What is wrong with the cmake usage for debian/rules?

The CMake options are being changed so the CMake parameter used in d/rules doesn't work anymore. The fix is above.

And why are the wildcards inside the path needed?

Multiarch, see section 9.1.1.4 of the Policy: https://www.debian.org/doc/debian-policy/

as far as I know the pathes must be relative and not absolute! So I removed the leading /!

dh_install works fine with either, but feel free to change that if you wish

the -dev package should not have the .so file included. This is installed by the library package.

The unversioned symlink goes into the -dev package, see section 8.4 of the Policy:
https://www.debian.org/doc/debian-policy/#development-files

@joede
Copy link
Contributor

joede commented Apr 12, 2018

@slyshykO you should use =/usr/lib/$(DEB_HOST_MULTIARCH) instead of =$(DEB_HOST_MULTIARCH). ;-)

@joede
Copy link
Contributor

joede commented Apr 12, 2018

@bluca after the last change of @slyshykO, I was able to built .deb Debian packages from his repository. Looks good so far. ;-)

Is somebody using a Github repository as source for apt? IMO it would be nice to have a source for this new packages. ;-)

@bluca
Copy link
Contributor

bluca commented Apr 12, 2018

I've uploaded it to Debian, it will be available after it's been reviewed (no ETA), afterwards I'll upload to stretch-backports as well

@joede
Copy link
Contributor

joede commented Apr 12, 2018

@bluca stlink is neither in testing nore in unstable yet. How can it be uploaded to stretch-backports?

@slyshykO slyshykO changed the title first try to fix #700 (WIP, not ready for merge) first try to fix #700 Apr 12, 2018
@slyshykO slyshykO changed the title first try to fix #700 fix #700 Apr 12, 2018
@bluca
Copy link
Contributor

bluca commented Apr 12, 2018

That's what I meant with "afterwards" - once it's approved and it's in unstable/testing

@slyshykO
Copy link
Collaborator Author

@xor-gate , I think, it is ready for merge.

@xor-gate xor-gate merged commit 8893533 into stlink-org:master Apr 16, 2018
joede pushed a commit to joede/stlink that referenced this pull request Apr 17, 2018
@slyshykO slyshykO deleted the fix-linux-install branch May 12, 2019 07:45
@Nightwalker-87 Nightwalker-87 added this to the v1.5.1 milestone Feb 23, 2020
@Nightwalker-87 Nightwalker-87 linked an issue Mar 18, 2020 that may be closed by this pull request
@stlink-org stlink-org locked as resolved and limited conversation to collaborators Apr 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Installation issue under linux
6 participants