Skip to content

Fix compiling for linux arm64#650

Merged
MegaMech merged 9 commits into
HarbourMasters:mainfrom
JeodC:main
Apr 22, 2026
Merged

Fix compiling for linux arm64#650
MegaMech merged 9 commits into
HarbourMasters:mainfrom
JeodC:main

Conversation

@JeodC
Copy link
Copy Markdown
Contributor

@JeodC JeodC commented Feb 9, 2026

This pull request contains several changes.

  1. In HMAS.cpp a typedef mismatch causes linux arm64 builds to fail. It has been altered in HMAS.h to pass.
  2. In CMakeLists.txt there was no definition to enable BUILD_MK64 with the externally compiled torch, which would cause torch to throw an error on trying to make mk64.o2r. This definition has been added.
  3. In macros.h ALIGNED16 and ALIGNED8 were empty. I added the alignment to the macros so they do something, and I added ALIGNED4096 so the 256MB allocation is set at the start of the virtual memory page.
  4. Added the ALIGNED16 macro to the memory pool in memory.c
  5. In CMakeLists.txt added USE_OPENGLES define
  6. Changed to memset

An opt-in for segmented addresses is missing somewhere, see: Kenix3/libultraship#1004

@JeodC JeodC marked this pull request as draft February 9, 2026 18:42
@JeodC JeodC force-pushed the main branch 2 times, most recently from 283c6ee to 2cb6709 Compare February 9, 2026 22:03
@JeodC JeodC marked this pull request as ready for review February 10, 2026 00:57
@JeodC JeodC changed the title Fix compiling for arm64 Fix compiling for linux arm64 Feb 11, 2026
@JeodC JeodC closed this Apr 21, 2026
@coco875
Copy link
Copy Markdown
Contributor

coco875 commented Apr 21, 2026

Why this pr have been close ?

@JeodC
Copy link
Copy Markdown
Contributor Author

JeodC commented Apr 21, 2026

Why this pr have been close ?

Did you want it reopened? It's been a few months with no comments or reviews.

@coco875
Copy link
Copy Markdown
Contributor

coco875 commented Apr 21, 2026

Forget to review and don't have much time to work on spaghettikart in general. Don't hesitate to ping me on discord if you don't see any review. Will do a review now

@coco875 coco875 reopened this Apr 21, 2026
@JeodC
Copy link
Copy Markdown
Contributor Author

JeodC commented Apr 21, 2026

Forget to review and don't have much time to work on spaghettikart in general. Don't hesitate to ping me on discord if you don't see any review. Will do a review now

It's gone under my radar as well, no worries. I'll reopen and do a rebase sometime soon. Figured in the months since that some of these might have already been fixed or changed.

Copy link
Copy Markdown
Contributor

@coco875 coco875 left a comment

Choose a reason for hiding this comment

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

Look mostly good

Comment thread CMakeLists.txt Outdated
Comment thread src/racing/memory.c
@JeodC
Copy link
Copy Markdown
Contributor Author

JeodC commented Apr 21, 2026

Rebased 8 commits, resolving CMakeLists.txt conflicts (indentation churn from #680 "Fix Windows Build" + removed a find_package(OpenGL) block upstream had reintroduced).

Dropped both -Wno-macro-redefined and -Wno-inconsistent-missing-override.

Removed the redundant target_compile_definitions(... USE_OPENGLES=1) block from the GLES branch. The generator expression $<$<BOOL:${USE_OPENGLES}>:USE_OPENGLES> in add_compile_definitions is now the single source of truth for that define.

Fixed broken text substitution in the "Use memset over deprecated bzero" commit: the original commit blindly replaced bzero -> memset in include/stubs.h and src/os/bstring.h, producing invalid C:

#define memset(b, 0, len) ...: 0 isn't a valid macro parameter name, and the body self-references memset (infinite recursion).
extern void memset(void*, 0, size_t): 0 isn't a valid parameter type.

Since no callers use bzero anymore, I just removed the now-unused shim/declaration in both files instead.


This still has a runtime crash on linux arm64 since Kenix3/libultraship#1004 didn't land. I'll see what I can find out for it, if there's a solution without modifying LUS at all.

coco875
coco875 previously approved these changes Apr 21, 2026
Copy link
Copy Markdown
Contributor

@coco875 coco875 left a comment

Choose a reason for hiding this comment

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

LGTM

Comment thread courses/harbour/ship2_model.c
Comment thread include/stubs.h Outdated
@MegaMech MegaMech merged commit 10f10f1 into HarbourMasters:main Apr 22, 2026
6 of 8 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.

ARM64 SIGSEGV in gfx_set_timg_handler_rdp on Harbour — possible unresolved segment address

3 participants