Copper Spice on M1 Mac

barbara
Posts: 446
Joined: Sat Apr 04 2015 2:32 am
Contact:

Re: Copper Spice on M1 Mac

Post by barbara »

A new commit was added to the CopperSpice repo on github which adds processor detection code for ARM. We have also incorporated the other changes for Neon as reported.

We would be grateful for anyone with a M1 or ARM processor who can do a test build of CopperSpice. We are committed to supporting the M1 processor and other popular ARM platforms.

Thanks for everyone's continued support.

Barbara
hhenson
Posts: 11
Joined: Fri May 28 2021 11:33 am

Re: Copper Spice on M1 Mac

Post by hhenson »

Checked out the latest version of code a few minutes ago, done the following:
mkdir build
cd build
cmake .. -G Ninja

ninja

I have hit two failures already:

[13/3530] Building CXX object src/webk...ebCoreSupport/QtFallbackWebPopup.cpp.o
FAILED: src/webkit/CMakeFiles/CsWebKit.dir/__/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ @src/webkit/CMakeFiles/CsWebKit.dir/__/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp.o.rsp -MD -MT src/webkit/CMakeFiles/CsWebKit.dir/__/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp.o -MF src/webkit/CMakeFiles/CsWebKit.dir/__/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp.o.d -o src/webkit/CMakeFiles/CsWebKit.dir/__/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp.o -c /Users/hhenson/src/copperspice/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp
In file included from /Users/hhenson/src/copperspice/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp:22:
/Users/hhenson/src/copperspice/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h:48:18: warning: 'show' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
virtual void show(const QWebSelectData&);
^
/Users/hhenson/src/copperspice/src/3rdparty/webkit/Source/WebKit/qt/Api/qwebkitplatformplugin.h:60:18: note: overridden virtual function is here
virtual void show(const QWebSelectData&) = 0;
^
In file included from /Users/hhenson/src/copperspice/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp:22:
/Users/hhenson/src/copperspice/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h:49:18: warning: 'hide' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
virtual void hide();
^
/Users/hhenson/src/copperspice/src/3rdparty/webkit/Source/WebKit/qt/Api/qwebkitplatformplugin.h:61:18: note: overridden virtual function is here
virtual void hide() = 0;
^
In file included from /Users/hhenson/src/copperspice/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp:26:
In file included from /Users/hhenson/src/copperspice/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h:32:
In file included from /Users/hhenson/src/copperspice/src/3rdparty/webkit/Source/WebCore/page/ChromeClient.h:24:
In file included from /Users/hhenson/src/copperspice/src/3rdparty/webkit/Source/WebCore/accessibility/AXObjectCache.h:29:
In file included from /Users/hhenson/src/copperspice/src/3rdparty/webkit/Source/WebCore/accessibility/AccessibilityObject.h:34:
In file included from /Users/hhenson/src/copperspice/src/3rdparty/webkit/Source/WebCore/editing/VisiblePosition.h:30:
In file included from /Users/hhenson/src/copperspice/src/3rdparty/webkit/Source/WebCore/dom/Node.h:31:
In file included from /Users/hhenson/src/copperspice/src/3rdparty/webkit/Source/WebCore/bindings/js/ScriptWrappable.h:34:
In file included from /Users/hhenson/src/copperspice/src/3rdparty/webkit/Source/WebCore/bindings/js/JSDOMWrapper.h:25:
In file included from /Users/hhenson/src/copperspice/src/3rdparty/webkit/Source/WebCore/bindings/js/JSDOMGlobalObject.h:30:
In file included from /Users/hhenson/src/copperspice/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSGlobalObject.h:25:
In file included from /Users/hhenson/src/copperspice/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSArray.h:24:
In file included from /Users/hhenson/src/copperspice/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSObject.h:26:
In file included from /Users/hhenson/src/copperspice/src/3rdparty/webkit/Source/JavaScriptCore/runtime/ArgList.h:25:
In file included from /Users/hhenson/src/copperspice/src/3rdparty/webkit/Source/JavaScriptCore/interpreter/CallFrame.h:26:
In file included from /Users/hhenson/src/copperspice/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSGlobalData.h:32:
In file included from /Users/hhenson/src/copperspice/src/3rdparty/webkit/Source/JavaScriptCore/runtime/CachedTranscendentalFunction.h:29:
In file included from /Users/hhenson/src/copperspice/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSValue.h:473:
/Users/hhenson/src/copperspice/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSValueInlineMethods.h:230:28: error: cast from pointer to smaller type 'int32_t' (aka 'int') loses information
u.asBits.payload = reinterpret_cast<int32_t>(ptr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/hhenson/src/copperspice/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSValueInlineMethods.h:242:28: error: cast from pointer to smaller type 'int32_t' (aka 'int') loses information
u.asBits.payload = reinterpret_cast<int32_t>(const_cast<JSCell*>(ptr));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings and 2 errors generated.
ninja: build stopped: subcommand failed.
hhenson
Posts: 11
Joined: Fri May 28 2021 11:33 am

Re: Copper Spice on M1 Mac

Post by hhenson »

I have a fix (at least a partial fix if not fully correct, updated to make most to compile)

Index: src/3rdparty/webkit/Source/JavaScriptCore/wtf/Platform.h
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Platform.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Platform.h
--- a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Platform.h (revision 1c947288525bbca83966815577f0b853c38041bb)
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/Platform.h (date 1641663540452)
@@ -228,6 +228,11 @@
#define WTF_CPU_X86_64 1
#endif

+/* CPU(ARM64) - Apple */
+#if (defined(__arm64__) && defined(__APPLE__)) || defined(__aarch64__)
+#define WTF_CPU_ARM64 1
+#endif
+
/* CPU(ARM) - ARM, any version*/
#if defined(arm) \
|| defined(__arm__) \
@@ -996,7 +1001,8 @@
#if !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32_64)
#if (CPU(X86_64) && (OS(UNIX) || OS(WINDOWS))) \
|| (CPU(IA64) && !CPU(IA64_32)) \
- || CPU(ALPHA) \
+ || CPU(ALPHA) \
+ || CPU(ARM64) \
|| CPU(SPARC64) \
|| CPU(S390X) \
|| CPU(PPC64) \
Index: src/3rdparty/webkit/Source/JavaScriptCore/heap/MachineStackMarker.cpp
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/heap/MachineStackMarker.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/heap/MachineStackMarker.cpp
--- a/src/3rdparty/webkit/Source/JavaScriptCore/heap/MachineStackMarker.cpp (revision 1c947288525bbca83966815577f0b853c38041bb)
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/heap/MachineStackMarker.cpp (date 1641666483704)
@@ -329,6 +329,8 @@
typedef ppc_thread_state64_t PlatformThreadRegisters;
#elif CPU(ARM)
typedef arm_thread_state_t PlatformThreadRegisters;
+#elif CPU(ARM64)
+typedef arm_thread_state64_t PlatformThreadRegisters;
#else
#error Unknown Architecture
#endif
@@ -360,6 +362,9 @@
#elif CPU(ARM)
unsigned user_count = ARM_THREAD_STATE_COUNT;
thread_state_flavor_t flavor = ARM_THREAD_STATE;
+#elif CPU(ARM64)
+ unsigned user_count = ARM_THREAD_STATE64_COUNT;
+ thread_state_flavor_t flavor = ARM_THREAD_STATE64;
#else
#error Unknown Architecture
#endif
@@ -406,6 +411,8 @@
return reinterpret_cast<void*>(regs.__r1);
#elif CPU(ARM)
return reinterpret_cast<void*>(regs.__sp);
+#elif CPU(ARM64)
+ return reinterpret_cast<void*>(regs.__sp);
#else
#error Unknown Architecture
#endif
Index: src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp
--- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp (revision 1c947288525bbca83966815577f0b853c38041bb)
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp (date 1641663751342)
@@ -890,6 +890,8 @@
typedef ppc_thread_state64_t PlatformThreadRegisters;
#elif CPU(ARM)
typedef arm_thread_state_t PlatformThreadRegisters;
+#elif CPU(ARM64)
+typedef arm_thread_state64_t PlatformThreadRegisters;
#else
#error Unknown Architecture
#endif
hhenson
Posts: 11
Joined: Fri May 28 2021 11:33 am

Re: Copper Spice on M1 Mac

Post by hhenson »

I have managed to compile the complete suite now, I needed to make one other change (which did not make sense), namely:

I needed to comment out the check around the include for unistd.h in src/3rdparty/freetype/src/builds/unix/ftsystem.c
as for some reason, even though cmake correctly identifies the file as found, it seems for some reason it was not correctly passed here?

//#ifdef HAVE_UNISTD_H
#include <unistd.h>
//#endif

The other thing I needed to do was to hard code the include path for pulseaudio. Not sure why.

Tests produce the following results:


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CsCoreTest is a Catch v2.13.8 host application.
Run with -? for options

-------------------------------------------------------------------------------
QList traits
-------------------------------------------------------------------------------
/Users/hhenson/src/copperspice/test/core/containers/qlist.cpp:24
...............................................................................

/Users/hhenson/src/copperspice/test/core/containers/qlist.cpp:32: FAILED:
REQUIRE( std::is_nothrow_move_constructible_v<QList<int>> == false )
with expansion:
true == false

-------------------------------------------------------------------------------
QSettings allkeys
-------------------------------------------------------------------------------
/Users/hhenson/src/copperspice/test/core/io/qsettings.cpp:48
...............................................................................

/Users/hhenson/src/copperspice/test/core/io/qsettings.cpp:81: FAILED:
REQUIRE( keys.size() == 7 )
with expansion:
53 == 7

-------------------------------------------------------------------------------
QMetaMethod traits
-------------------------------------------------------------------------------
/Users/hhenson/src/copperspice/test/core/kernel/qmetamethod.cpp:27
...............................................................................

/Users/hhenson/src/copperspice/test/core/kernel/qmetamethod.cpp:35: FAILED:
REQUIRE( std::is_nothrow_move_constructible_v<QMetaMethod> == false )
with expansion:
true == false

-------------------------------------------------------------------------------
QVariant constructor_hash
-------------------------------------------------------------------------------
/Users/hhenson/src/copperspice/test/core/kernel/qvariant.cpp:411
...............................................................................

/Users/hhenson/src/copperspice/test/core/kernel/qvariant.cpp:419: FAILED:
REQUIRE( data.type() == QVariant::Hash )
with expansion:
256 == 44

-------------------------------------------------------------------------------
QVariant constructor_map
-------------------------------------------------------------------------------
/Users/hhenson/src/copperspice/test/core/kernel/qvariant.cpp:434
...............................................................................

/Users/hhenson/src/copperspice/test/core/kernel/qvariant.cpp:444: FAILED:
REQUIRE( data.canConvert<QVariantHash>() )
with expansion:
false

-------------------------------------------------------------------------------
QVariant type_char8_t
-------------------------------------------------------------------------------
/Users/hhenson/src/copperspice/test/core/kernel/qvariant.cpp:1138
...............................................................................

/Users/hhenson/src/copperspice/test/core/kernel/qvariant.cpp:1142: FAILED:
REQUIRE( QVariant::typeToName(QVariant::Char8_t) == "char8_t" )
with expansion:
== "char8_t"


CsString C++20 char8_t checks enabled
===============================================================================
test cases: 602 | 596 passed | 5 failed | 1 failed as expected
assertions: 3089 | 3083 passed | 5 failed | 1 failed as expected
hhenson
Posts: 11
Joined: Fri May 28 2021 11:33 am

Re: Copper Spice on M1 Mac

Post by hhenson »

I can build the kitchen sink application, but it fails to run:

./kitchensink
The application failed to start because the platform plugin was not found or did not load.
Requested Plugin Key: "cocoa"

Reinstalling the application may resolve this problem.
barbara
Posts: 446
Joined: Sat Apr 04 2015 2:32 am
Contact:

Re: Copper Spice on M1 Mac

Post by barbara »

Thanks for testing this.
The application failed to start because the platform plugin was not found or did not load.
Requested Plugin Key: "cocoa"
This issue is most likely not related to the ARM processor changes. We need to verify the install of CS and KS happened correctly. Mac is just a bit different than other platforms.

1 Did you run "ninja install" after building CopperSpice?

If so, then you will have a cs_lib folder with all the dylibs ( dll or so files on other platforms ) for CS. The exact folder name will match the value of the CMAKE_INSTALL_PREFIX specified in your CS configure script.

2 Did you run "ninja install" after building KitchenSink?

If so, you should have a deploy folder which contains the path: KitchenSink.app/Contents/plugins/platforms
This is where you should find the platform file CsGuiCocoa1.7.so

Can you verify this?

For Reference:
On Linux there will be a sub-folder called platforms which contains CsGuiXcb1.7.so
On Windows there will be a sub-folder called platforms which contains a files called CsGuiWin1.7.dll

Barbara
barbara
Posts: 446
Joined: Sat Apr 04 2015 2:32 am
Contact:

Re: Copper Spice on M1 Mac

Post by barbara »

Thanks so much for building on your M1 system!

We will look at the Webkit and JavaScriptCore issues right away.

Barbara
hhenson
Posts: 11
Joined: Fri May 28 2021 11:33 am

Re: Copper Spice on M1 Mac

Post by hhenson »

I had done the ninja install on the main library and I can see the CsGuiCocoa1.7.so in /usr/local/lib.

Trying to do something similar for kitchen sink I can say that install is not correct, it tries to install /usr/local/../MacOs which fails.

I will try and fiddle with the installation to see if I can get it to do something useful.
ansel
Posts: 152
Joined: Fri Apr 10 2015 8:23 am

Re: Copper Spice on M1 Mac

Post by ansel »

hhenson wrote: Sun Jan 09 2022 8:05 pm I had done the ninja install on the main library and I can see the CsGuiCocoa1.7.so in /usr/local/lib.
It looks like you may not have used the CMAKE_INSTALL_PREFIX when building CopperSpice or KitchenSink. This page from our CS Overview documentation provides our suggested configuration.

https://www.copperspice.com/docs/cs_overview/build-overview.html

CopperSpice will look for plugins in a specific path. There is a CopperSpice configuration file which can be used to override this default path on a per-application basis. More information about this file can be found here:

https://www.copperspice.com/docs/cs_api/plugins-config.html
Ansel Sermersheim
CopperSpice Cofounder
barbara
Posts: 446
Joined: Sat Apr 04 2015 2:32 am
Contact:

Re: Copper Spice on M1 Mac

Post by barbara »

hhenson wrote: Sat Jan 08 2022 7:33 pm
I needed to comment out the check around the include for unistd.h in src/3rdparty/freetype/src/builds/unix/ftsystem.c
as for some reason, even though cmake correctly identifies the file as found, it seems for some reason it was not correctly passed here?

//#ifdef HAVE_UNISTD_H
#include <unistd.h>
//#endif
We believe this issue will be resolved by adding an include for cs-config.h in the file ftconfig.h.
The other thing I needed to do was to hard code the include path for pulseaudio. Not sure why.
It is not clear what purpose pulseaudio would serve on OS X. It is an optional dependency and only used on Linux.
Tests produce the following results:

/Users/hhenson/src/copperspice/test/core/containers/qlist.cpp:32: FAILED:
REQUIRE( std::is_nothrow_move_constructible_v<QList<int>> == false )
with expansion:
true == false
. . .
We found these issues as well and all but one have been resolved for OS X. This outstanding one is for QHash and is related to a known issue with libC++. We are working with the maintainers.


Barbara
Post Reply