Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building on Apple M1 silicon #358

Closed
varna9000 opened this issue Mar 19, 2023 · 4 comments
Closed

Building on Apple M1 silicon #358

varna9000 opened this issue Mar 19, 2023 · 4 comments
Labels
ARM ARM architecture related MacOS MacOS related, WONTFIX unless a volunteer steps in stale The TO is probably no longer interested in a solution Volunteers wanted NO SUPPORT unless someone wants to help!

Comments

@varna9000
Copy link

varna9000 commented Mar 19, 2023

Hi, just wanted to share that I got a successful (although somewhat unstable) build on my Macbook Pro with M1 (arm64). Here are the slightly modified steps:

cd ~/Downloads/OpenHantek6022
git submodule update --init --recursive
rm -rf build/
mkdir build
cd build
cmake .. -DCMAKE_PREFIX_PATH=$(brew --prefix qt5)
make -j4

cd openhantek

$(brew --prefix qt5)/bin/macdeployqt OpenHantek.app -always-overwrite -verbose=2

python3 ../../utils/macdeployqtfix/macdeployqtfix.py OpenHantek.app/Contents/MacOS/OpenHantek $(brew --prefix qt5)

Once qt5 is installed with Homebrew, I had to :

  1. Pass DCMAKE_PREFIX_PATH to cmake so it finds qt
  2. Pass the correct path to macdeployqt
  3. Instead of python2, we should pass python3

Also, the default font-size 10pt is very small on Mac, so I had to increase it to 14 (maybe 16 would be even better)

The build is not very stable, but it works. This is the warning in the terminal:

qt.qpa.fonts: Populating font family aliases took 77 ms. Replace uses of missing font family "Arial" with one that exists to avoid this cost.
Graphic: 2.1 Metal - 83 - GLSL version 1.50
QOpenGLShader::compile(Vertex): ERROR: 0:2: '' :  version '150' is not supported

*** Problematic Vertex shader source code ***

          #version 150
#define lowp
#define mediump
#define highp
#line 2
          in highp vec3 vertex;
          uniform mat4 matrix;
          void main()
          {
              gl_Position = matrix * vec4(vertex, 1.0);
              gl_PointSize = 1.0;
          }


***
Switching to GLSL version 1.20, use the command line option '--useGLSL120' or '--useGLES'

Sometimes if breaks with segfault. I'll try to post the error when I get it again.

@varna9000
Copy link
Author

varna9000 commented Mar 20, 2023

And here's an error, which showed when app broke:

Cannot make QOpenGLContext current in a different thread
[1]    22808 abort      ./OpenHantek

and another one:

qt.qpa.fonts: Populating font family aliases took 76 ms. Replace uses of missing font family "Arial" with one that exists to avoid this cost.
Graphic: 2.1 Metal - 83 - GLSL version 1.20
QObject::setParent: Cannot set parent, new parent is in a different thread
QObject::setParent: Cannot set parent, new parent is in a different thread
QObject::setParent: Cannot set parent, new parent is in a different thread
QObject::setParent: Cannot set parent, new parent is in a different thread
QObject::setParent: Cannot set parent, new parent is in a different thread
QObject::setParent: Cannot set parent, new parent is in a different thread
[1]    23687 segmentation fault  ./OpenHantek --useGLSL120

Usually happens when I change the Horizontal timebase, but not always.

@Ho-Ro Ho-Ro added Volunteers wanted NO SUPPORT unless someone wants to help! MacOS MacOS related, WONTFIX unless a volunteer steps in labels Mar 20, 2023
@Ho-Ro
Copy link
Member

Ho-Ro commented Mar 20, 2023

Thx for experimenting and reporting.
The easy solution first:

Also, the default font-size 10pt is very small on Mac, so I had to increase it to 14 (maybe 16 would be even better)

You can change the font size either in menu Oscilloscope/Settings/Colors (also style and theme settings are located there) or via the command line option, e.g. --size 16 (the new size is stored persistently until you change it again):

Usage: OpenHantek [options]

Options:
  -h, --help               Displays help on commandline options.
  --help-all               Displays help including Qt specific options.
  -v, --version            Displays version information.
  -c, --config <File>      Load config file
  -d, --demoMode           Demo mode without scope HW
  --noAutoConnect          Do not connect automatically
  -e, --useGLES            Use OpenGL ES instead of OpenGL
  --useGLSL120             Force OpenGL SL version 1.20
  --useGLSL150             Force OpenGL SL version 1.50
  -i, --international      Show the international interface, do not translate
  -f, --font <Font>        Define the system font
  -s, --size <Size>        Set the font size (default = 10, 0: automatic from
                           dpi)
  --condensed <Condensed>  Set the font condensed value (default = 87)
  --resetSettings          Reset persistent settings, start with default
  --verbose <Level>        Verbose tracing of program startup, ui and
                           processing steps

Graphic: 2.1 Metal - 83 - GLSL version 1.50
QOpenGLShader::compile(Vertex): ERROR: 0:2: '' : version '150' is not supported

Strange, it tells it uses version 1.50 and gives an error with this version.
Maybe also the --useGLES option could help.

Regarding the "different thread" error messages I have no clue how to fix this - never encountered it here.
I have neither a Mac nor a Windows machine, I do all development and testing on my Linux Debian Stable systems.

@varna9000
Copy link
Author

Thanks for replying.
Below is the output with --useGLES. In fact the program window opens blank and stays like this. It's not crucial and might be probably mac os QT related, but I just wanted to share my experience. and someone could probably give more clues to make it stable on arm64. I forgot to mention I'm using Mac OS Ventura.

Here's the terminal output:

./OpenHantek --useGLES
qt.qpa.fonts: Populating font family aliases took 78 ms. Replace uses of missing font family "Arial" with one that exists to avoid this cost.
QOpenGLWidget: Failed to create context
QOpenGLWidget: Failed to create context
QOpenGLWidget: Failed to create context
QOpenGLWidget: Failed to create context
QPainter::begin: Paint device returned engine == 0, type: 1
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::font: Painter not active
QPainter::setFont: Painter not active
qt.qpa.backingstore: composeAndFlush: QOpenGLContext creation failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
QPainter::begin: Paint device returned engine == 0, type: 1
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::font: Painter not active
QPainter::setFont: Painter not active
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed

@github-actions
Copy link

There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.
Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment.
Because this issue is marked as stale, it will be closed and locked in 7 days if no further activity occurs.
Thank you for your contributions!

@github-actions github-actions bot added the stale The TO is probably no longer interested in a solution label Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ARM ARM architecture related MacOS MacOS related, WONTFIX unless a volunteer steps in stale The TO is probably no longer interested in a solution Volunteers wanted NO SUPPORT unless someone wants to help!
Projects
None yet
Development

No branches or pull requests

2 participants