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

CI: add tests for various MSYS2 environments #132

Closed
wants to merge 3 commits into from

Conversation

mayeut
Copy link
Contributor

@mayeut mayeut commented Jan 6, 2024

This PR adds CI tests for various MSYS2 environments (msys, mingw64, clang32 & clang64).

It's based on top of 17a9ab9 and also adds a fix for mingw makefile builds.

Resolves #127.

@aklomp
Copy link
Owner

aklomp commented Jan 6, 2024

Nice, thanks! I think there's a dependency on #131 though; it would be nice to fix that one first so that we don't need to comment out the 32-bit builds.

@mayeut
Copy link
Contributor Author

mayeut commented Jan 7, 2024

I could check that #125 fixes the 32-bit build.
It would require one more commit here to pass the makefile check as all symbols are prefixed by _. I'll add this commit.

@mayeut
Copy link
Contributor Author

mayeut commented Jan 7, 2024

@aklomp, if you're ok with the changes here, I think the next steps are either:

aklomp and others added 3 commits January 8, 2024 08:27
As of v0.5.1, the `base64' demo program no longer compiled under MinGW because
MinGW does not emulate the `writev(2)' system call.

Fix this by detecting MinGW at compile time and optionally emulating
`writev(2)' as a series of `write(2)' calls.

Resolves aklomp#127.
@mayeut
Copy link
Contributor Author

mayeut commented Jan 8, 2024

@aklomp, I rebased on master and removed the comment on ming 32-bit.

.github/workflows/test.yml Outdated Show resolved Hide resolved
- { msystem: mingw64, env: mingw-w64-x86_64- }
- { msystem: ucrt64, env: mingw-w64-ucrt-x86_64- }
# - { msystem: clang32, env: mingw-w64-clang-i686- } disabled, lld does not support the "-r" option
# - { msystem: clang64, env: mingw-w64-clang-x86_64- } disabled, lld does not support the "-r" option
Copy link
Owner

Choose a reason for hiding this comment

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

Does it support -i or --relocatable? Both are synonyms of -r.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. The feature is supported for ELF & Mach-O targets but not for Windows.

@@ -15,7 +17,9 @@ endif

test: clean test_base64 benchmark
./test_base64
ifeq (, $(findstring mingw, $(TARGET))) # no "/dev/urandom" on Windows
Copy link
Owner

Choose a reason for hiding this comment

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

There's a really old pull request, #6, which fixes this on Windows. Now that we have a provisional CI environment for Windows, I can try to revive that branch and see if I can get the benchmark to work.

Having a working Windows benchmark would also be great for checking in CI that certain changes did not introduce speed regressions on that platform.

sed -e 's/^/_/' $< > $@
else
cp -f $< $@
endif
Copy link
Owner

Choose a reason for hiding this comment

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

Honestly I'm not a big fan of this compatibility block, though I understand why it's needed. In the longer term I think we should try to get rid of the exports file entirely and rely on compiler/linker features to mark functions as hidden or visible.

Copy link
Contributor

Choose a reason for hiding this comment

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

You mean like annotating these symbols as BASE64_SYMBOL_PRIVATE?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't like this either but if we're to keep the current semantic, it's needed.
It's not the same as BASE64_SYMBOL_PRIVATE:
BASE64_SYMBOL_PRIVATE only acts on the visibility attribute of GLOBAL symbols e.g. even if base64_stream_encode_plain is marked as hidden it's still linkable (if building a static library or bare object).
--keep-global-symbols acts on LOCAL/GLOBAL attribute. It effectively marks symbols that are not in the list as LOCAL & those are not linkable anymore (as if we only had 1 translation unit - simulated by ld -r - and the function was declared static).

I wouldn't mind if the makefile produced the same things as the CMake build does for a static library (just something like ar -o libbase64.a *.o, getting rid of the ld -r and objcopy).

Another option is not to support makefile builds for Windows at all.

Copy link
Owner

@aklomp aklomp Jan 8, 2024

Choose a reason for hiding this comment

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

My idea for the future roadmap is basically to engineer the library such that all functions start with akbase64_ (which is probably what I will rename this library to, see #103), and that all functions are declared static, except for those that are part of the public API. Those two measures should remove all potential naming conflicts in practice. Then we can also get rid of the exports file.

Until then, I suggest we keep going as usual, so using this Makefile hack/complication out of necessity.

@aklomp aklomp changed the title #127: bin/base64: fix compilation on MinGW bin/base64: fix compilation on MinGW Jan 9, 2024
@aklomp aklomp changed the title bin/base64: fix compilation on MinGW CI: add tests for various MSYS2 environments (msys, mingw64, clang32 & clang64) Jan 9, 2024
@aklomp aklomp changed the title CI: add tests for various MSYS2 environments (msys, mingw64, clang32 & clang64) CI: add tests for various MSYS2 environments Jan 9, 2024
@aklomp aklomp closed this in 6756832 Jan 9, 2024
@aklomp aklomp added this to the v0.5.2 milestone Jan 10, 2024
@mayeut mayeut deleted the msys2-ci branch March 15, 2024 22:13
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.

Build of 0.5.1 broken with MinGW
3 participants