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

pcg-c fails to build unless 128-bit ops are supported (as e.g. on NetBSD/powerpc) #32

Open
he32 opened this issue Feb 17, 2023 · 5 comments

Comments

@he32
Copy link

he32 commented Feb 17, 2023

This popped up on my radar due to a build failure on NetBSD/powerpc. This platform
does not have native support for 128-bit integer operations.

gcc -O2 -D_FORTIFY_SOURCE=2 -O3 -std=c99 -I../include  -c -o pcg-global-32.o pcg-global-32.c
In file included from pcg-global-32.c:33:
../include/pcg_variants.h:2178:33: error: 'PCG_STATE_SETSEQ_64_INITIALIZER' undeclared here (not in a function)
 2178 | #define PCG32_INITIALIZER       PCG_STATE_SETSEQ_64_INITIALIZER
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pcg-global-32.c:35:38: note: in expansion of macro 'PCG32_INITIALIZER'
   35 | static pcg32_random_t pcg32_global = PCG32_INITIALIZER;
      |                                      ^~~~~~~~~~~~~~~~~
gmake[1]: *** [<builtin>: pcg-global-32.o] Error 1

Inspecting include/pcg_variants.h reveals that PCG_HAS_128BIT_OPS ends up
as undefined on this platform, due to lack of __SIZEOF_INT128__ being defined, and
hence PCG_STATE_SETSEQ_64_INITIALIZER also ends up being undefined, as it's
only defined if PCG_HAS_128BIT_OPS is defined.

@rdebath
Copy link

rdebath commented Jul 2, 2023

You don't seem to have checked out the current version as this was fixed in 2017.

@he32
Copy link
Author

he32 commented Jul 2, 2023

You don't seem to have checked out the current version as this was fixed in 2017.

That's entirely possibly. I'm referring to the latest published C version, 0.94, which appears to have this issue. Has there been a later release of that code base? https://www.pcg-random.org/download.html appears to say "no".

@rdebath
Copy link

rdebath commented Jul 3, 2023

Ah, I see, so the zip on the website needs updating or pointing at this repository for the zip. I didn't notice because I looked at the code here and then downloaded the most recent version.

For example: https://github.com/imneme/pcg-c/archive/refs/heads/master.zip

@he32
Copy link
Author

he32 commented Jul 3, 2023

Ah, I see, so the zip on the website needs updating or pointing at this repository for the zip. I didn't notice because I looked at the code here and then downloaded the most recent version.

For example: https://github.com/imneme/pcg-c/archive/refs/heads/master.zip

I come at this problem working on the packaging system originating at NetBSD, pkgsrc. Having a clearly identifyable release is vastly preferable to "just use the tip of the head of this repository", as the latter is clearly not uniquely identifyable, and prone to change as time passes.

I hope you're not allergic to making a full release? At the minimum, a tag should be created in the repository to mark exactly which point corresponds to this release, but of course a "full" 0.95 release would be preferable.

@rdebath
Copy link

rdebath commented Jul 3, 2023

This isn't my repo, so like you I can only suggest to @imneme to label up a release.

However, for you now, Git is designed to be able to uniquely identify any commit. It is usual to choose a commit for your submodule and freeze your reference at that commit.

Also for the commit of the current master Github will create a zip if you ask for the URL
https://github.com/imneme/pcg-c/archive/83252d9c23df9c82ecb42210afed61a7b42402d7.zip
They will also provide you with zips (if you need them) for any unique commit.

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

No branches or pull requests

2 participants