Skip to content

Fix symlink install versioned shared library - #216

Merged
dirk-thomas merged 2 commits into
ament:masterfrom
JafarAbdi:pr-fix_versioned_so
Jan 29, 2020
Merged

dirk-thomas merged 2 commits into
ament:masterfrom
JafarAbdi:pr-fix_versioned_so

Conversation

@JafarAbdi

Copy link
Copy Markdown
Contributor

Fix #214

From doing some online research I found that the versioning extension is just for shared libraries in Linux so the other checks don't need any change

@JafarAbdi
JafarAbdi force-pushed the pr-fix_versioned_so branch from b6c8a6b to 38c4eb2 Compare January 17, 2020 13:40
@dirk-thomas

Copy link
Copy Markdown
Contributor

Please see my comment on the original ticket about a simple wildcard to be marching to broadly. Instead use a now specific regex to only capture the intended version suffices.

@JafarAbdi

JafarAbdi commented Jan 29, 2020 •

Copy link
Copy Markdown
Contributor Author

@dirk-thomas Sorry for the delay again does the following regex ok .? \.so(\.[0-9]+)?(\.[0-9]+)?(\.[0-9]+)?$ I'm not an regex expert but I think this should works, see for testing

EDIT: Found a better one ^\\.so(\\.[0-9]+)*$ (Thanks to @nbbrooks) and it turned out that I have to use double-backslashs see

@dirk-thomas

Copy link
Copy Markdown
Contributor

You can simplify your regex without allowing an arbitrary amount of version parts (e.g. .1.2.3.4 shouldn't pass according to your original test examples): \.so(\.\d+){0,3}

@dirk-thomas dirk-thomas added the in progress Actively being worked on (Kanban column) label Jan 29, 2020
@nbbrooks

Copy link
Copy Markdown

If we don't want to allow multiple .#, then how about
\.so(\.\d+)?$

@JafarAbdi

Copy link
Copy Markdown
Contributor Author

@dirk-thomas CMake regex doesn't support curly brackets see

@JafarAbdi

Copy link
Copy Markdown
Contributor Author

If we don't want to allow multiple .#, then how about
\.so(\.\d+)?$

It should only pass the following extensions .so, .so.major, .so.major.minor, or .so.major.minor.patch

@nbbrooks

Copy link
Copy Markdown

Gotcha. In that case, without curly braces support I think your initial solution works best.

@JafarAbdi

Copy link
Copy Markdown
Contributor Author

Example with the last updated regex

cmake_minimum_required(VERSION 3.1.3)
project(testing_project)

set(exts
	".so.1100"
	".so.1.2.4"
	".so.10.2.4"
	".so.1.20.4"
	".so.1.2.40"
	".so.2.1"
	".so.2.1.2.1.2"
	".sos.2"
	".sos"
	".so"
	".so.1"
	".so.2.0.0"
	".so.1.s"
	"sso.1.s"
	".so.s.1"
	".so.1.2.s"
)

foreach(ext ${exts})
    if(ext MATCHES "\.so(\.[0-9]+)?(\.[0-9]+)?(\.[0-9]+)?$")
    	message("Pass: ${ext}")
    else()
    	message("Fail: ${ext}")
    endif()
endforeach()

The output

Pass: .so.1100
Pass: .so.1.2.4
Pass: .so.10.2.4
Pass: .so.1.20.4
Pass: .so.1.2.40
Pass: .so.2.1
Fail: .so.2.1.2.1.2
Fail: .sos.2
Fail: .sos
Pass: .so
Pass: .so.1
Pass: .so.2.0.0
Fail: .so.1.s
Fail: sso.1.s
Fail: .so.s.1
Fail: .so.1.2.s

@JafarAbdi
JafarAbdi force-pushed the pr-fix_versioned_so branch from d453a4e to 8e74da9 Compare January 29, 2020 19:23
@JafarAbdi

Copy link
Copy Markdown
Contributor Author

Why the Fpr__ament_cmake__ubuntu_focal_amd64 check fails .?

@dirk-thomas

Copy link
Copy Markdown
Contributor

Why the Fpr__ament_cmake__ubuntu_focal_amd64 check fails .?

Unfortunately the PR testing for Foxy isn't working yet. You can ignore that status. I will trigger a set of manual CI builds once the patch is ready.

@dirk-thomas

Copy link
Copy Markdown
Contributor

CI Linux build: Build Status

@dirk-thomas dirk-thomas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the improvement.

@dirk-thomas
dirk-thomas merged commit 0fd5578 into ament:master Jan 29, 2020
@dirk-thomas dirk-thomas removed the in progress Actively being worked on (Kanban column) label Jan 29, 2020
@ivanpauno

ivanpauno commented Jan 31, 2020 •

Copy link
Copy Markdown

I'm locally getting errors like:

CMake Warning (dev) at ament_cmake_symlink_install_targets_0_.cmake:1 (ament_cmake_symlink_install_targets):
  Syntax error in cmake code at

    /home/ivanpauno/ros2_ws/build/tracetools/ament_cmake_symlink_install/ament_cmake_symlink_install.cmake:243

  when parsing string

    \.so(\.[0-9]+)?(\.[0-9]+)?(\.[0-9]+)?$

  Invalid escape sequence \.

  Policy CMP0010 is not set: Bad variable reference syntax is an error.  Run
  "cmake --help-policy CMP0010" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.
Call Stack (most recent call first):
  ament_cmake_symlink_install/ament_cmake_symlink_install.cmake:320 (include)
  cmake_install.cmake:41 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

Though I don't see that in the CI logs.

@JafarAbdi

Copy link
Copy Markdown
Contributor Author

@ivanpauno Does replacing it with \\.so(\.[0-9]+)?(\.[0-9]+)?(\.[0-9]+)?$ gives the error .?

@ivanpauno

Copy link
Copy Markdown

@ivanpauno Does replacing it with \\.so(\.[0-9]+)?(\.[0-9]+)?(\.[0-9]+)?$ gives the error .?

Yeah, I've tried same error.

@JafarAbdi

Copy link
Copy Markdown
Contributor Author

@ivanpauno Could you please share the instruction to reproduce it .?

@dirk-thomas

Copy link
Copy Markdown
Contributor

See #217 for the fix.

@dirk-thomas

Copy link
Copy Markdown
Contributor

Could you please share the instruction to reproduce it

As the output above shows the CMake warning appears when building the tracetools package.

scpeters pushed a commit to scpeters/ament_cmake that referenced this pull request Nov 19, 2020
* Fix symlink install versioned shared library

Signed-off-by: JafarAbdi <[email protected]>

* Update ament_cmake_symlink_install.cmake.in

Signed-off-by: JafarAbdi <[email protected]>
scpeters pushed a commit to scpeters/ament_cmake that referenced this pull request Nov 20, 2020
* Fix symlink install versioned shared library

Signed-off-by: JafarAbdi <[email protected]>

* Update ament_cmake_symlink_install.cmake.in

Signed-off-by: JafarAbdi <[email protected]>
Signed-off-by: Steve Peters <[email protected]>
hidmic pushed a commit that referenced this pull request Nov 20, 2020
* Fix symlink install versioned shared library

Signed-off-by: JafarAbdi <[email protected]>

* Update ament_cmake_symlink_install.cmake.in

Signed-off-by: JafarAbdi <[email protected]>
hidmic pushed a commit that referenced this pull request Nov 20, 2020
* Fix symlink install versioned shared library

Signed-off-by: Jafar Abdi <[email protected]>

* Update ament_cmake_symlink_install.cmake.in

Signed-off-by: Jafar Abdi <[email protected]>
jacobperron pushed a commit that referenced this pull request Nov 20, 2020
* Fix symlink install versioned shared library

Signed-off-by: JafarAbdi <[email protected]>

* Update ament_cmake_symlink_install.cmake.in

Signed-off-by: JafarAbdi <[email protected]>
Signed-off-by: Steve Peters <[email protected]>
mjcarroll pushed a commit that referenced this pull request Nov 30, 2020
) (#217) (#310)

* Fix symlink install versioned shared library (#216)

* Fix symlink install versioned shared library

Signed-off-by: Jafar Abdi <[email protected]>

* Update ament_cmake_symlink_install.cmake.in

Signed-off-by: Jafar Abdi <[email protected]>

* fix escaping of regex (#217)

Signed-off-by: Dirk Thomas <[email protected]>

Co-authored-by: Jafar Abdi <[email protected]>
Co-authored-by: Dirk Thomas <[email protected]>
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.

Bug in ament_cmake_symlink_install

4 participants