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

primesieve: new package #22577

Merged
merged 9 commits into from
Mar 7, 2024
Merged

Conversation

Ahajha
Copy link
Contributor

@Ahajha Ahajha commented Jan 29, 2024

Specify library name and version: primesieve/11.2

This is a continuation of #14530, which was essentially already ready. I've just updated the package to 11.2.

Resolves #14529


@CLAassistant
Copy link

CLAassistant commented Jan 29, 2024

CLA assistant check
All committers have signed the CLA.

@conan-center-bot

This comment has been minimized.

@AbrilRBS AbrilRBS self-assigned this Jan 31, 2024
Copy link
Member

@AbrilRBS AbrilRBS left a comment

Choose a reason for hiding this comment

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

Quick review

recipes/primesieve/all/conanfile.py Show resolved Hide resolved
Comment on lines 62 to 106
int main()
{
std::vector<uint64_t> primes;
generate_n_primes(25, &primes);
std::cout << "primes.size() = " << primes.size();
check(primes.size() == 25);

for (uint64_t i = 0; i < primes.size(); i++)
{
std::cout << "primes[" << i << "] = " << primes[i];
check(primes[i] == small_primes[i]);
}

primes.clear();

generate_n_primes(19, 18446744073709550672ull, &primes);
std::cout << "primes.size() = " << primes.size();
check(primes.size() == 19);

for (uint64_t i = 0; i < primes.size(); i++)
{
std::cout << "primes[" << i << "] = " << primes[i];
check(primes[i] == large_primes[i]);
}

std::string errorMsg;

try
{
std::vector<uint16_t> primes16;
generate_n_primes(10, (1 << 16) - 10, &primes16);
}
catch (const primesieve_error& e)
{
errorMsg = e.what();
}

std::cout << "Detect 16-bit overflow: " << errorMsg;
check(!errorMsg.empty());

std::cout << std::endl;
std::cout << "All tests passed successfully!" << std::endl;

return 0;
}
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 simplify this by a lot? test_packages should limit themselves to small tests checking that the library was correctly packaged - no need to be generating primes here :)

Copy link
Contributor Author

@Ahajha Ahajha Jan 31, 2024

Choose a reason for hiding this comment

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

The library is intended to generate prime numbers, that said this is definitely complicated. I can probably have it generate just one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, program just generates and prints 5 primes.

@conan-center-bot

This comment has been minimized.

@Ahajha
Copy link
Contributor Author

Ahajha commented Feb 4, 2024

@kimwalisch FYI, the PR from a few years ago was never merged, I'm continuing it now in hopes that we can actually add it.

Side question for you, you require C++11, which GCC 5 does support, but the package seems to fail when using it. Any idea why? Do you want to support this version?

@Alex-PLACET I'm continuing your work, which requires you to have the CLA signed (I think it has 4 month expiration or so), would you mind doing that when you get the chance? No rush, still working on getting things fixed.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

Copy link
Contributor

github-actions bot commented Feb 4, 2024

Hooks produced the following warnings for commit bae1235
primesieve/11.2@#114610158235b0df0e1d4db1a94271e9
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library './lib/libprimesieve.so' links to system library 'm' but it is not in cpp_info.system_libs.

@conan-center-bot

This comment has been minimized.

@kimwalisch
Copy link

kimwalisch commented Feb 4, 2024

Side question for you, you require C++11, which GCC 5 does support, but the package seems to fail when using it. Any idea why? Do you want to support this version?

Yes, primesieve requires full C++11 (or later) support. Some old GCC compilers only partially support C++11 (e.g. std::align from C++11 is not supported by these compilers) and therefore they fail to build primesieve. E.g. I know that GCC 4.9 cannot compile primesieve.

But if the C++ compiler is able to build primesieve, then it must work correctly at runtime (otherwise this is a bug). If you are experiencing primesieve runtime errors then I am interested in seeing those logs.

@Ahajha
Copy link
Contributor Author

Ahajha commented Feb 4, 2024

But if the C++ compiler is able to build primesieve, then it must work correctly at runtime (otherwise this is a bug). If you are experiencing primesieve runtime errors then I am interested in seeing those logs.

Conan test packages are only intended to test if the package itself works. Usually this is verifying a simple example compiles, links, and executes without errors. The test package here just generates a handful of prime numbers, which is a simple enough test that it probably won't show any errors unless the packaging is wrong on our end.

Occasionally there is a bug report which involves how it is packaged as the cause of the bug, but those tend to be uncommon.

@Alex-PLACET
Copy link
Contributor

@Ahajha, a big thank you for picking up where I left off on my PR. I completely forgot to keep it going. Appreciate your help!

rm(self, "*.la", os.path.join(self.package_folder, "lib"))
rm(self, "*.pdb", os.path.join(self.package_folder, "lib"))
rm(self, "*.pdb", os.path.join(self.package_folder, "bin"))
if is_msvc(self) and self.options.shared:
Copy link
Member

Choose a reason for hiding this comment

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

Any insight into this rename? It looks funny that it gets generated with this name in the first place :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems this is set to avoid issues when packaging both static and shared libraries in the same package. This doesn't apply to us, so I think it's fine to do this? Unless we have a way of telling Conan that this is how it's done.

https://github.com/kimwalisch/primesieve/blob/master/CMakeLists.txt#L138

Copy link
Member

Choose a reason for hiding this comment

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

Please, keep the original name, it should work as usual, right? I remember having other projects having this same prefix when exporting dll libs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would fail without this change, I presume it tries to look for "primesieve".lib but it's "primesieve.dll".lib. I'm fine with changing it back, I just don't know how I would get it to work.

Copy link
Contributor

Choose a reason for hiding this comment

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

@uilianries @RubenRBS Many more recipes are doing this rename. You can run a grep and see this ad-hoc helper function fix_msvc_libname. The problem is coming from the hook error:

primesieve/11.2: WARN: Using the new toolchains and generators without specifying a build profile (e.g: -pr:b=default) is discouraged and might cause failures and unexpected behavior
[HOOK - conan-center.py] post_package_info(): ERROR: [LIBRARY DOES NOT EXIST (KB-H054)] Component primesieve::primesieve library 'primesieve' is listed in the recipe, but not found installed at self.cpp_info.libdirs. Make sure you compiled the library correctly. If so, then the library name should probably be fixed. Otherwise, then the component should be removed. (https://github.com/conan-io/conan-center-index/blob/master/docs/error_knowledge_base.md#KB-H054-LIBRARY-DOES-NOT-EXIST) 
ERROR: 
	ConanException: [HOOK - conan-center.py] post_package_info(): Some checks failed running the hook, check the output

@Ahajha We just created an issue to review this process conan-io/hooks#528 Let's figure out if there is a bug in the hooks so we can use the original library name instead of the renamed one.

Copy link
Member

@uilianries uilianries left a comment

Choose a reason for hiding this comment

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

Thank you for your PR, it's looking good, just few comments. This PR can be reduced a bit.

Comment on lines +53 to +55

if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) <= "5":
raise ConanInvalidConfiguration("GCC<=5 is currently not supported. Contributions with fixes are welcome.")
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
if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) <= "5":
raise ConanInvalidConfiguration("GCC<=5 is currently not supported. Contributions with fixes are welcome.")

I used to work with GCC 4.7 with C++11 minimal support. GCC 4.8 has a really good coverage of C++11. Usually, we don't add restriction to compiler version when the project only requires C++11

Copy link
Contributor Author

Choose a reason for hiding this comment

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

GCC 5 fails to build, not sure why though. @kimwalisch mentioned above that 4.9 is known not to work, for example.

rm(self, "*.la", os.path.join(self.package_folder, "lib"))
rm(self, "*.pdb", os.path.join(self.package_folder, "lib"))
rm(self, "*.pdb", os.path.join(self.package_folder, "bin"))
if is_msvc(self) and self.options.shared:
Copy link
Member

Choose a reason for hiding this comment

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

Please, keep the original name, it should work as usual, right? I remember having other projects having this same prefix when exporting dll libs

recipes/primesieve/all/conanfile.py Outdated Show resolved Hide resolved
recipes/primesieve/all/test_v1_package/CMakeLists.txt Outdated Show resolved Hide resolved
@conan-center-bot
Copy link
Collaborator

Conan v1 pipeline ✔️

All green in build 6 (c85ed30d89ea7fb721c28c54b370680340785e0f):

  • primesieve/11.2:
    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 6 (c85ed30d89ea7fb721c28c54b370680340785e0f):

  • primesieve/11.2:
    All packages built successfully! (All logs)

Copy link
Contributor

@franramirez688 franramirez688 left a comment

Choose a reason for hiding this comment

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

As this is not an isolated case, I think that we can move it forward and wait for the hooks issue which could solve many other PRs.

@conan-center-bot conan-center-bot merged commit 0bff285 into conan-io:master Mar 7, 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.

[request] primesieve/8.0
8 participants