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

Add all the lzham lib files for msvc builds. #23907

Merged
merged 4 commits into from May 16, 2024

Conversation

soroosh-sdi
Copy link
Contributor

Specify library name and version: lzham/cci.20220103

Adding all lzham library static libs to the cpp_info.libs
I describe the issue I found in the bug #23647.


@CLAassistant
Copy link

CLAassistant commented May 7, 2024

CLA assistant check
All committers have signed the CLA.

@conan-center-bot

This comment has been minimized.

Copy link
Contributor

github-actions bot commented May 7, 2024

Hooks produced the following warnings for commit adad64e
lzham/cci.20220103@#da0c965c672d6f2c30f5a360aa36bb8d
post_package(): WARN: [APPLE RELOCATABLE SHARED LIBS (KB-H077)] install_name dir of these shared libs is not @rpath: liblzhamcomp.dylib, liblzhamdecomp.dylib, liblzhamdll.dylib

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

Copy link
Contributor

github-actions bot commented May 8, 2024

Hooks produced the following warnings for commit 31992f1
lzham/cci.20220103@#c7d19375dcd3ff26dc1ca002c28953da
post_package(): WARN: [APPLE RELOCATABLE SHARED LIBS (KB-H077)] install_name dir of these shared libs is not @rpath: liblzhamcomp.dylib, liblzhamdecomp.dylib, liblzhamdll.dylib

@RubenRBS RubenRBS self-assigned this May 9, 2024
RubenRBS
RubenRBS previously approved these changes May 9, 2024
@jcar87 jcar87 self-assigned this May 10, 2024
@jcar87
Copy link
Contributor

jcar87 commented May 15, 2024

Hi @soroosh-sdi , thank you for opening this PR and for the detailed description of the bug in #23647.

Upon reading the reported issue, this was telling:

In my project I successfully build again lzham's statically, but when I wanted to run the executable it fails and says it needs lzham's dll..

a static build of lzham should not result in missing DLLs from it. Looking further into this, it appears that on windows when shared=False this is building shared libraries, which is wrong. This PR doesn't actually fix this issue, it would just hide it further or potentially fail elsewhere -I'm not sure Conan 2 would propagate the runtime directories (PATH env var) if the library is reporting to be static. This is why it's very useful that you have opened an issue describing the problem, thank you for doing that! We will fix the underlying cause to address this.

on the other hand, and by no means a blocker - with the proposed changes there would be 5 consecutive copy() invocations that could be handled in a loop for better readability. Will address this too - it's just stylistic and not a major concern.

@jcar87
Copy link
Contributor

jcar87 commented May 15, 2024

Hi @soroosh-sdi - I've pushed changes to your branch to fix the handling of static/shared on Windows. The Visual Studio solution was building both the shared and static variants, all were being copied, and the package_info was always pointing to link to the shared library, which was causing your issues. I've amended the recipe such that when shared=False, only the static library is built and packaged, and only the static libraries are advertised in package_info()

Additionally:

  • added validate() method to fail on other windows architectures that are not supported (like arm)
  • fixed handling of x86 architecture (x86_64 was hardcoded when it shouldn't have been)
  • fixed issue where the vcxproj files were overriding the msvc runtime set by MSBuildToolchain
  • fixed potential issue where the consumer of the static libraries may fail to link if using a different compiler toolset than the one used to produce the object files in the static libraries

tested all the following variants on windows with msvc:

conan create . --version=cci.20220103 -s arch=x86 -s build_type=Debug
conan create . --version=cci.20220103 -s arch=x86 -s build_type=Release
conan create . --version=cci.20220103 -s arch=x86 -o "*:shared=True" -s build_type=Debug
conan create . --version=cci.20220103 -s arch=x86 -o "*:shared=True" -s build_type=Release

conan create . --version=cci.20220103 -s arch=x86_64 -s build_type=Debug
conan create . --version=cci.20220103 -s arch=x86_64 -s build_type=Release
conan create . --version=cci.20220103 -s arch=x86_64 -o "*:shared=True" -s build_type=Debug
conan create . --version=cci.20220103 -s arch=x86_64 -o "*:shared=True" -s build_type=Release

please note that you would have to include lzham.h instead of the specific shared or static ones. if you want to test this locally you'll have to fetch from the remote and reset your local branch.

@soroosh-sdi
Copy link
Contributor Author

Hi @jcar87
Thanks for taking a deep look at problem and resolving the root cause.
I took a quick look at your changes and I totally agree with it.
I'm on vacation and will not have access to my build machine for three weeks, wanted to make sure you tested it with conan2 as well.

@conan-center-bot

This comment has been minimized.

Copy link
Contributor

Hooks produced the following warnings for commit 9ca33a0
lzham/cci.20220103@#5fedf5d4b3ac6838c03438336f6fe973
post_package(): WARN: [APPLE RELOCATABLE SHARED LIBS (KB-H077)] install_name dir of these shared libs is not @rpath: liblzhamcomp.dylib, liblzhamdecomp.dylib, liblzhamdll.dylib

@conan-center-bot
Copy link
Collaborator

Conan v1 pipeline ✔️

All green in build 5 (fe2414a6c8d7d673ea93db0314ac405312715563):

  • lzham/cci.20220103:
    All packages built successfully! (All logs)

Conan v2 pipeline ✔️

Note: Conan v2 builds are now mandatory. Please read our discussion about it.

All green in build 5 (fe2414a6c8d7d673ea93db0314ac405312715563):

  • lzham/cci.20220103:
    All packages built successfully! (All logs)

@conan-center-bot conan-center-bot merged commit 257ca31 into conan-io:master May 16, 2024
13 checks passed
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.

None yet

8 participants