Bug 214553 - devel/godot: fails to build on aarch64
Summary: devel/godot: fails to build on aarch64
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Jan Beich
URL:
Keywords: needs-patch
Depends on:
Blocks: 201763
  Show dependency treegraph
 
Reported: 2016-11-16 00:54 UTC by Jan Beich
Modified: 2016-11-20 21:13 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (FreeBSD)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer freebsd_triage 2016-11-16 00:54:30 UTC
In file included from platform/x11/godot_x11.cpp:30:
In file included from platform/x11/os_x11.h:33:
In file included from core/os/input.h:32:
In file included from core/object.h:32:
In file included from core/list.h:32:
In file included from core/os/memory.h:33:
core/safe_refcount.h:330:2: error: This platform cannot use safe refcount, compile with NO_THREADS or implement it.
#error This platform cannot use safe refcount, compile with NO_THREADS or implement it.
 ^
core/safe_refcount.h:338:3: error: unknown type name 'REFCOUNT_T'
  REFCOUNT_T count;
  ^
core/safe_refcount.h:365:22: error: unknown type name 'REFCOUNT_GET_T'
                return static_cast<REFCOUNT_GET_T>( count );
                                   ^

http://thunderx1.nyi.freebsd.org/data/110arm64-default/426137/logs/godot-tools-2.1.log
Comment 2 Shane 2016-11-16 17:08:56 UTC
I expect adding CXXFLAGS_aarch64= -DNO_THREADS to Makefile should allow the build to work.

For a full fix - in core/safe_refcount.h:209
https://github.com/godotengine/godot/blob/master/core/safe_refcount.h#L209
there is asm code for arm - does the arm asm code also work for aarch64, so we can add aarch64 to the #if test or does an aarch64 version need to be made?
Comment 3 Jan Beich freebsd_committer freebsd_triage 2016-11-16 23:58:56 UTC
(In reply to Shane from comment #2)
> I expect adding CXXFLAGS_aarch64= -DNO_THREADS to Makefile should allow the
> build to work.

Correct. Tested on 110aarch64 via poudriere + qemu-user-static. This may also unbreak other non-x86 platforms e.g., sparc64. However, mips has many ${ARCH} variants[1] which makes you wonder if NO_THREAD conditional should be reordered to be a #warning rather than #error.

> For a full fix - in core/safe_refcount.h:209
> https://github.com/godotengine/godot/blob/master/core/safe_refcount.h#L209
> there is asm code for arm - does the arm asm code also work for aarch64, so we
> can add aarch64 to the #if test or does an aarch64 version need to be made?

According to an upstream issue[2] aarch64 may need "some new lines of code in the reference counter classes, as they have different implementations in asm depending on the cpu arch".

  In file included from platform/x11/context_gl_x11.cpp:29:
  In file included from platform/x11/context_gl_x11.h:41:
  In file included from core/os/os.h:32:
  In file included from core/ustring.h:33:
  In file included from core/vector.h:37:
  In file included from core/os/memory.h:33:
  core/safe_refcount.h:245:6: error: unrecognized instruction mnemonic
                           "    strex   %1, %0, [%2]    \n"
                            ^
  <inline asm>:3:5: note: instantiated into assembly here
      strex   x9, x8, [x0]
      ^

In order to reproduce even on x86 try adding "-target aarch64--freebsd" e.g.,

  $ clang++ -target aarch64--freebsd -DGLEW_NO_GLU -DRTAUDIO_ENABLED -DFREETYPE_ENABLED -DENABLE_DEPRECATED -DTYPED_METHOD_BIND -DOPENGL_ENABLED -DOSS_ENABLED -DX11_ENABLED -DUNIX_ENABLED -DGLES2_ENABLED -DGLES_OVER_GL -DMUSEPACK_ENABLED-DSQUISH_ENABLED -DVORBIS_ENABLED -DOPUS_ENABLED -DTHEORA_ENABLED -DTHEORALIB_ENABLED -DPNG_ENABLED -DDDS_ENABLED -DPVR_ENABLED -DJPG_ENABLED -DWEBP_ENABLED -DSPEEX_ENABLED -DGDSCRIPT_ENABLED -DMINIZIP_ENABLED -DXML_ENABLED -DETC1_ENABLED -DGLEW_ENABLED -DGLEW_STATIC -D_THREAD_SAFE -Icore -Icore/math -Itools -Idrivers -I. -Iplatform/x11 -I/usr/local/include -I/usr/local/include/freetype2 -Iplatform/x11 -c platform/x11/context_gl_x11.cpp

[1] $ make targets -C /usr/src | awk -F/ '/mips/ { print $2 }'
    mipsel
    mips
    mips64el
    mips64
    mipsn32
    mipselhf
    mipshf
    mips64elhf
    mips64hf
[2] https://github.com/godotengine/godot/issues/5240#issuecomment-246202471
Comment 4 commit-hook freebsd_committer freebsd_triage 2016-11-20 20:58:56 UTC
A commit references this bug:

Author: jbeich
Date: Sun Nov 20 20:57:55 UTC 2016
New revision: 426626
URL: https://svnweb.freebsd.org/changeset/ports/426626

Log:
  devel/godot: unbreak on some non-x86 targets

  In file included from platform/x11/godot_x11.cpp:30:
  In file included from platform/x11/os_x11.h:33:
  In file included from core/os/input.h:32:
  In file included from core/object.h:32:
  In file included from core/list.h:32:
  In file included from core/os/memory.h:33:
  core/safe_refcount.h:330:2: error: This platform cannot use safe refcount, compile with NO_THREADS or implement it.
   #error This platform cannot use safe refcount, compile with NO_THREADS or implement it.
    ^
  core/safe_refcount.h:338:3: error: unknown type name 'REFCOUNT_T'
    REFCOUNT_T count;
    ^

  PR:		214553
  Reported by:	pkg-fallout, linimon
  Submitted by:	Shane <FreeBSD@ShaneWare.Biz> (maintainer)

Changes:
  head/devel/godot/Makefile
Comment 5 commit-hook freebsd_committer freebsd_triage 2016-11-20 21:13:03 UTC
A commit references this bug:

Author: jbeich
Date: Sun Nov 20 21:12:07 UTC 2016
New revision: 426634
URL: https://svnweb.freebsd.org/changeset/ports/426634

Log:
  MFH: r426626 r426632

  devel/godot: unbreak on some non-x86 targets

  In file included from platform/x11/godot_x11.cpp:30:
  In file included from platform/x11/os_x11.h:33:
  In file included from core/os/input.h:32:
  In file included from core/object.h:32:
  In file included from core/list.h:32:
  In file included from core/os/memory.h:33:
  core/safe_refcount.h:330:2: error: This platform cannot use safe refcount, compile with NO_THREADS or implement it.
   #error This platform cannot use safe refcount, compile with NO_THREADS or implement it.
    ^
  core/safe_refcount.h:338:3: error: unknown type name 'REFCOUNT_T'
    REFCOUNT_T count;
    ^

  PR:		214553
  Reported by:	pkg-fallout, linimon
  Submitted by:	Shane <FreeBSD@ShaneWare.Biz> (maintainer)
  Approved by:	ports-secteam blanket

Changes:
_U  branches/2016Q4/
  branches/2016Q4/devel/godot/Makefile