Page MenuHomeWildfire Games

Fix for Trac #6797 - OSX Build Errors w/ SDL and FCollada
Needs ReviewPublic

Authored by jpshack on Aug 3 2023, 4:06 AM.

Details

Reviewers
Itms
Trac Tickets
#6797
Summary

A user reports two build issues on OS X. An outdate SDL version and missing reference to math library in
FCollada.

Test Plan

The reporter confirmed that guidance in the ticket addressed his issue with the build. I
independently reproduced the error and verified that guidance in the ticket addresses the issue. T

The FCollada changes should be verified against other OSes.

Diff Detail

Repository
rP 0 A.D. Public Repository
Branch
trac-6797
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 22206
Build 54255: arc lint + arc unit

Event Timeline

jpshack created this revision.Aug 3 2023, 4:06 AM
Owners added a subscriber: Restricted Owners Package.Aug 3 2023, 4:06 AM
jpshack requested review of this revision.Aug 3 2023, 4:06 AM
jpshack edited the test plan for this revision. (Show Details)Aug 3 2023, 6:11 PM
jpshack edited the test plan for this revision. (Show Details)

Why not math.h to follow other headers?

sera added a subscriber: sera.Aug 3 2023, 8:08 PM

Thanks for the patch, glad someone who can reproduce the issues picking this up.

Updating sdl is a valid workaround and probably desirable on it's own, still removing the offending -Werror might be preferable or this issue will crop up sooner or later again.

If this is your first contribution you should also add yourself to the contributors file.

libraries/source/fcollada/src/FCollada/FUtils/Platforms.h
131–132

isinf isn't used internally, so just removing the definition here should work

Why not math.h to follow other headers?

I have tried with headers only but I get `'cmath.h' file not found. An old issue at https://github.com/actions/runner-images/issues/2274 has some pointers but I given comments from @sera, I'll see about removing the definition instead of trying to track this down.

This comment was removed by jpshack.
jpshack updated this revision to Diff 22113.Aug 4 2023, 12:46 AM
jpshack edited the test plan for this revision. (Show Details)
  • Instead of adding cmath to fix Trac #6797, remove unused isinf definition.

I have tried with headers only but I get `'cmath.h' file not found. An old issue at https://github.com/actions/runner-images/issues/2274 has some pointers but I given comments from @sera, I'll see about removing the definition instead of trying to track this down.

cmath is a C++ library (cstdio, climits, etc), C pair is math.h (stdio.h, limits.h, etc).

Updating sdl is a valid workaround and probably desirable on it's own, still removing the offending -Werror might be preferable or this issue will crop up sooner or later again.

For more context a similar comment is made in the original issue:

SDL adds "-Wdeclaration-after-statement -Werror=declaration-after-statement" to CFLAGS, so it's not about the C standard used but that likely this diagnostic became supported on recent Apple clang (what I suspect is used here) and so now the build fails.

Updating SDL2 certainly isn't bad but sed-ing / patching out all forced Werror should be done anyway.

Do I need to address the above for this patch to be accepted?

sera added a comment.Aug 5 2023, 6:15 PM

If you are comfortable in patching out Werror then go ahead, otherwise the patch LGTM, tho can't test it as I don't have a mac.

Also you should add yourself to binaries/data/mods/public/gui/credits/texts/programming.json

I had this same issue building 0ad.
The patch allows me to build all the necessary libraries, but I am left with the following error when i run update_workspaces.sh.

==== Building zip-lib (release) ====
==== Building lua-lib (release) ====
==== Building zlib-lib (release) ====
Creating obj/Release/zlib-lib
adler32.c
mkstemp.c
compress.c
../../contrib/libzip/mkstemp.c:76:8: error: call to undeclared function 'getpid'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        pid = getpid();
              ^
1 error generated.
make[1]: *** [obj/Release/zip-lib/mkstemp.o] Error 1
make: *** [zip-lib] Error 2
make: *** Waiting for unfinished jobs....
crc32.c
deflate.c
gzclose.c
gzlib.c
gzread.c
gzwrite.c
infback.c
inffast.c
inflate.c
inftrees.c
trees.c
uncompr.c
zutil.c
Linking zlib-lib
ERROR: Premake build failed

The patch allows me to build all the necessary libraries, but I am left with the following error when i run update_workspaces.sh.

Yes. I am seeing exactly this as well and I have not figured it out yet. I have opened a new ticket #6847 to track this next issue.

jpshack updated this revision to Diff 22115.Aug 7 2023, 1:00 AM
  • Instead of adding cmath to fix Trac #6797, remove unused isinf definition.
  • Added jpshack to contributors file.
Owners added a subscriber: Restricted Owners Package.Aug 7 2023, 1:00 AM
wraitii added a subscriber: wraitii.Aug 9 2023, 3:34 PM

Would be good to have Stan's opinion on this, I believe he's the most up-to-date on the Fcollada 'port' that we essentially maintain.

The SDL upgrade looks reasonable to me, but it's one of the more 'dangerous' libraries to upgrade so will need to test this.

Stan added a subscriber: Stan.Aug 11 2023, 11:41 AM

I think the Fcollada fix is okay, we could ask the guy maintaining the rdb fork what he thinks about it.
If @vladislavbelov thinks it's okay too I have no objections.

Regarding the SDL is this the minimum working version?
We should check whether they did not add a lot of flags to turn off new features that might interfere with the game. Also work started on SDl3