Skip to content

Fix mmap detection with new autoconf, service files, ResolverCache and Thread locals - #59

Closed
duncanmcqueen wants to merge 4 commits into
ingelabs:masterfrom
duncanmcqueen:fix-build
Closed

duncanmcqueen wants to merge 4 commits into
ingelabs:masterfrom
duncanmcqueen:fix-build

Conversation

@duncanmcqueen

Copy link
Copy Markdown
Contributor

Summary

This pull request has two build fixes and two run-time fixes.

  • configure.ac: In the AC_CHECK_FUNCS list, statvfs \ has two spaces after the backslash. Thus the backslash quotes a space, not the newline. Autoconf 2.72 and later then check for " mmap" and not for "mmap". HAVE_MMAP is not defined, and FileChannel.map() fails. (OpenTypeFontPeer maps its font files, so all fonts fail.)
  • lib/Makefile.am: In an out-of-tree build, glibj.zip gets the old service files from the source tree, not the files that configure makes from the *.in templates. For example, the MixerProvider list is empty. Now the rule also copies the configured files from the build tree.
  • ResolverCache: The static initializer calculates the TTLs before it makes the cache. To read the security properties for the TTLs can resolve a host name, which uses the cache before it exists. Now the cache comes first.
  • Thread: Some VMs (for example Kaffe) make the Thread object of the main thread without a constructor. Then locals is null, and each ThreadLocal fails. Now getThreadLocals() makes the map when it is null.

Tests

I built GNU Classpath with these changes on Haiku (autoconf 2.73, automake 1.19, libtool 2.6) and used it with Kaffe. A command line test (collections, formatting, BigDecimal, regex, files, threads, ThreadLocal, processes, network) passes. I did not test on Linux.

AI assistance

An AI model (Claude Code, by Anthropic) wrote these changes and this text. The repository owner directed the work. Please review the changes as you review other contributions.

The commits do not have a Signed-off-by line. If you need one, the owner will add it.

🤖 Generated with Claude Code

duncanmcqueen and others added 4 commits October 14, 2026 08:46
In the AC_CHECK_FUNCS list, 'statvfs \' was followed by two spaces,
so the backslash quoted a space instead of the newline. Autoconf 2.72
and later then check for ' mmap' instead of 'mmap', HAVE_MMAP is not
defined, and FileChannel.map() fails (OpenTypeFontPeer maps its font
files this way).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: duncanmcqueen <206344294+duncanmcqueen@users.noreply.github.com>
The resources rule copies META-INF from the source tree and skips the
*.in templates. In an out-of-tree build the files that configure makes
from those templates are in the build tree, so glibj.zip got stale
copies from the source tree (for example an empty MixerProvider list).
Also copy the configured files from the build tree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: duncanmcqueen <206344294+duncanmcqueen@users.noreply.github.com>
The static initializer computed POSITIVE_TTL and NEGATIVE_TTL first.
Reading the security properties for them can resolve a host name,
which uses the cache before it exists (NullPointerException). Declare
the cache and the kill queue first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: duncanmcqueen <206344294+duncanmcqueen@users.noreply.github.com>
Some VMs (for example Kaffe) make the Thread object of the main
thread without running a constructor, so its locals field is null and
every ThreadLocal fails. Make the field non-final and create the map
in getThreadLocals() when it is null.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: duncanmcqueen <206344294+duncanmcqueen@users.noreply.github.com>
@guillerodriguez

Copy link
Copy Markdown
Contributor

Hi @duncanmcqueen, thanks a lot for this, and for the detailed write-up.

I’m happy to work with you and see if we can get these changes merged, but first I have one request: could you split this into separate PRs, one per fix? We try to keep each PR to a single topic. That way each one can be reviewed and discussed on its own, and merged as soon as it’s ready without waiting on the others.

Also, a way to reproduce each issue would be very helpful: steps to reproduce for the build fixes, or a small test case for the runtime ones.

Btw, in the PR description you mention a command line test. We use malva for testing Classpath, including in CI. You might want to take a look at it if you're interested.

@duncanmcqueen

Copy link
Copy Markdown
Contributor Author

Thank you for the review and for the information about malva. I split this pull request into one pull request for each fix:

Each pull request has steps to reproduce or a small test case, and the results before and after the change. I reproduced #62, #63 and #64 on Linux with JamVM and the master branch. The CI does not show #62 (Ubuntu 24.04 has autoconf 2.71) or #63 (the CI builds in the source tree).

#65 is different: it occurs only with Kaffe, which makes the main Thread object without a constructor. JamVM is not affected. The pull request gives the details.

The tests are standalone programs with a main() method, so they are similar to malva tests. If you want, I can also offer some of them to malva.

I close this pull request, because the four new pull requests replace it.

🤖 Generated with Claude Code

@guillerodriguez

Copy link
Copy Markdown
Contributor

Thank you. Let's continue the discussion in the individual PRs.

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.

2 participants