Copper Spice on M1 Mac

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

Re: Copper Spice on M1 Mac

Post by barbara »

We have just pushed a m1-test branch to github. It contains corrections for the reported issues in 3rdParty and the updated catch tests.

Please note this is a branch with one commit. When we know it is correct this will be split into multiple commits and put on the master branch.

Barbara
stefan
Posts: 1
Joined: Sun May 15 2022 7:55 am

Re: Copper Spice on M1 Mac

Post by stefan »

I piggyback on this thread, as I see the same symptom (kitchen sink installer trying to write to a MacOS user like folder) and experience the cognitive dissonance of also seeing the indicator of a successful build as well as install of the main Copper Spice (CsGuiCocoa1.7.so present in $PREFIX/lib/).

Yes, the docs state an in source build (but with which I am uncomfortable with anything targeting production code) - maybe Cs will fail because of my opinionated approach.

Context:
I am considering to switch from Qt to Copper Spice but feel a tad too stupid not being able to build Copper Spice as well as Kitchensink and use it with a CMake out-of-source build. (Another problem for later that we generally treat warnings as errors and deprecation warnings at least seriously :) ...)

What did I try?

1) Building Cs itself I did (I use my forks for stability and ensure they are up to date):

Code: Select all

❯ git clone git@github.com:sthagen/copperspice-copperspice
❯ cd copperspice-copperspice
❯ rm -fr build
❯ brew info openssl@3
❯ export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@3/lib/pkgconfig"
❯ export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib"
❯ export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include"
❯ cmake -DCMAKE_INSTALL_PREFIX:PATH=$HOME -DCMAKE_BUILD_TYPE=Release -GNinja . -B build
❯ cmake --build build
❯ cd build && ninja install && lrelease -version
lrelease version 1.7.4
But, trying to start eg linguist:

Code: Select all

❯ linguist
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.
zsh: abort      linguist
I target $HOME, so my ~/lib has these Cs related artifacts after install:

Code: Select all

❯ ls -1 ~/lib | grep -v unrelated
CsGuiCocoa1.7.so
CsMultimedia_avf_camera1.7.so
CsMultimedia_avf_mediaplayer1.7.so
CsMultimedia_m3u1.7.so
CsPrinterDriverCups1.7.so
CsSqlPsql1.7.so
libCsCore1.7.dylib
libCsGui1.7.dylib
libCsMultimedia1.7.dylib
libCsNetwork1.7.dylib
libCsOpenGL1.7.dylib
libCsPrinterDriverCocoa1.7.so
libCsScript1.7.dylib
libCsSql1.7.dylib
libCsSvg1.7.dylib
libCsWebKit1.7.dylib
libCsXml1.7.dylib
libCsXmlPatterns1.7.dylib
Inspecting some linkage(s):

Code: Select all

❯ otool -L ~/bin/lrelease
/Users/me/bin/lrelease:
	@rpath/libCsXml1.7.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libCsCore1.7.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1200.3.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0)
❯ otool -L ~/bin/linguist
/Users/me/bin/linguist:
	@rpath/libCsGui1.7.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libCsXml1.7.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libCsCore1.7.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1200.3.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0)
❯ otool -L ~/lib/CsGuiCocoa1.7.so
/Users/me/lib/CsGuiCocoa1.7.so:
	/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 23.0.0)
	/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 165.0.0)
	/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
	/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 56.0.0)
	/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 2113.20.111)
	/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
	@rpath/libCsGui1.7.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libcups.2.dylib (compatibility version 2.0.0, current version 2.14.0)
	@rpath/libCsCore1.7.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1200.3.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1856.105.0)
	/System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics (compatibility version 64.0.0, current version 1557.3.2)
	/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 1141.1.0)
	/System/Library/Frameworks/CoreText.framework/Versions/A/CoreText (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1856.105.0)
	/System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
The Cs build itself spew loads of warnings but did not complain and marked the correct build and target install locations.

2) Trying the kitchen sink example (also from my up to date fork) build without really complaining and also states the requested locations for build and install, but fails on install:

Code: Select all

❯ git clone git@github.com:sthagen/copperspice-kitchensink
❯ cd copperspice-kitchensink
❯ rm -fr build
❯ cmake -DCMAKE_INSTALL_PREFIX:PATH=$HOME -DCMAKE_BUILD_TYPE=Release -GNinja . -B build
-- The C compiler identification is AppleClang 13.0.0.13000029
-- The CXX compiler identification is AppleClang 13.0.0.13000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done

KitchenSink configured to run on:  Darwin 64 bit, Release Mode
KitchenSink will be built in:      /Users/me/building/copperspice-kitchensink/build
KitchenSink will be installed in:  /Users/me


-- Configuring done
-- Generating done
-- Build files have been written to: /Users/me/building/copperspice-kitchensink/build
Building (and linking) the kitchen sink app(s):

Code: Select all

❯ cmake --build build
# --- 8< --- some warnings about overrides not being marked as override --- 8< --- 
[86/86] Linking CXX executable bin/kitchensink
❯ cd build && otool -L bin/kitchensink
bin/kitchensink:
	@rpath/libCsScript1.7.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libCsSql1.7.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libCsSvg1.7.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libCsXml1.7.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libCsXmlPatterns1.7.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libCsMultimedia1.7.dylib (compatibility version 0.0.0, current version 0.0.0)
	/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
	@rpath/libCsNetwork1.7.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libCsOpenGL1.7.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libCsGui1.7.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libCsCore1.7.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1200.3.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0)
Now finally the failing step installing the kitchen sink app(s):

Code: Select all

❯ ninja install
[0/1] Install the project...
-- Install configuration: "Release"
CMake Error at src/cmake_install.cmake:41 (file):
  file cannot create directory: /Users/me/../MacOS.  Maybe need
  administrative privileges.
Call Stack (most recent call first):
  cmake_install.cmake:42 (include)


FAILED: CMakeFiles/install.util
cd /Users/me/building/copperspice-kitchensink/build && /opt/homebrew/Cellar/cmake/3.23.1_1/bin/cmake -P cmake_install.cmake
ninja: build stopped: subcommand failed.
I am still running Big Sur (not Monterey) v11.6.5 on a Mac mini 2020 with M1 chipped 16 GB RAM.

Please kindly advice how I can trial Copper Spice with a minimal example.

If you have any questions on my setup or on other information from the builds please do not hesitate to ask and if possible, I will love to provide.

Thanks a lot in advance.
A guitar is not a gui for tar.
barbara
Posts: 443
Joined: Sat Apr 04 2015 2:32 am
Contact:

Re: Copper Spice on M1 Mac

Post by barbara »

Thanks for reaching out to us. Feel free to ask questions and we will do our best to help.
Yes, the docs state an in source build (but with which I am uncomfortable with anything targeting production code) - maybe Cs will fail because of my opinionated approach.
We encourage building CS out of tree so the source, build, and install folders are all separate. For applications we find building in tree more convenient for deployment reasons. Not sure which documentation you are referring to so I have included a link to a page in our CS Overview docs. Have a look at the section under "How to Build ".

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

You may also want to check our CS Journal which has several tutorials about installing and building. Details are provided for each supported platform. There are also currently 22 examples with full explanations and links to the full source code.

https://journal.copperspice.com/?p=162 "Installing CopperSpice"
https://journal.copperspice.com/?p=180 "Compile, Link, and Run (Gui Example 1)"

cmake -DCMAKE_INSTALL_PREFIX:PATH=$HOME -DCMAKE_BUILD_TYPE=Release -GNinja . -B build
Using $HOME as your prefix is probably not the best choice and we would advice against using this path. I would suggest something more like the following for the prefix.

Code: Select all

-DCMAKE_INSTALL_PREFIX=$HOME/projects/cs_lib
Trying the kitchen sink example . . .
You used $HOME for the prefix with KS as well. Again, this is not advisible. It would make more sense to install to a unique folder like ks/deploy. There is one other piece of information which is unique to OS X. Instead of doing a ninja install for a user application, our build files are set up to generate an application bundle. Create the bundle by running the following commands.

Code: Select all

ninja 
cpack -G Bundle
Give this a try and let us know how it goes.We have it noted to update the CS Overview documentation to clarify this process.

Barbara
Post Reply