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 Feelix2.0 in dev mode on M1 Mac #1

Open
Maxw3llGM opened this issue May 30, 2023 · 9 comments
Open

Building Feelix2.0 in dev mode on M1 Mac #1

Maxw3llGM opened this issue May 30, 2023 · 9 comments
Assignees
Labels
documentation Improvements or additions to documentation question Further information is requested

Comments

@Maxw3llGM
Copy link
Collaborator

Hello, so I have gone through the process of compiling the code on the M1 Mac and had to manage package issue.
I'll detail the changes I needed to do in order for this to work.

First of all Python 3.11 and higher does not function as gyp throws:
build_file_contents = open(build_file_path, 'rU').read() as an issue since 'rU' as a argument is deprecated in 3.11

To install developer mode

First make sure that the proper angular/cli and node is installed
npm install -g @angular/cli
nvm install 14.19.1

--legacy-peer-deps might need added if you have newer versions of some of the dependencies.
npm install --legacy-peer-deps --python=python3.10

next following the directives in the /dev branch, of deleting some files,

electron@11 needs to be declared as any newer version will be incompatible
npm install electron@11 --legacy-peer-deps --python=python@3.10

./node_modules/.bin/electron-rebuild

Once done, running locally did not work and needs to be further looked into, however compiling with
npm run package-mac

works and returns an x64 app for apple that will run in rossetta

TODO: Potentially update packages in order to attain arm64 architecture compatibility.

@Maxw3llGM Maxw3llGM added documentation Improvements or additions to documentation question Further information is requested labels May 30, 2023
@Maxw3llGM Maxw3llGM self-assigned this May 30, 2023
@ankevanoosterhout
Copy link
Owner

Did you start the application with 'npm run electron'?

npm run package-mac is used to package the app after building it to create an installer

Furthermore there might be issues with 'closed-chain-ik' which I installed locally and I haven't updated it on github, I wanted to remove this part for you in a clean branch, but if you want to try to run it you can download it here: https://github.com/gkjohnson/closed-chain-ik-js

@Maxw3llGM
Copy link
Collaborator Author

I did try to start locally with nom run electron but it gave me an error. Hold on I'll post it, it's another architecture compatibility warning.

@Maxw3llGM
Copy link
Collaborator Author

npm run electron

feelix@2.0.0 electron
ng build --base-href ./ && electron .

chunk {main} main.js, main.js.map (main) 1.05 MB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 275 kB [initial] [rendered]
chunk {polyfills-es5} polyfills-es5.js, polyfills-es5.js.map (polyfills-es5) 610 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.15 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 213 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 8.43 MB [initial] [rendered]
Date: 2023-05-30T11:54:30.549Z - Hash: c7c27e339b1628fcf79b - Time: 6127ms
App threw an error during load
Error: dlopen(/Users/miu/Feelix_Proj/Feelix2.0/node_modules/@serialport/bindings/build/Release/bindings.node, 0x0001): tried: '/Users/miu/Feelix_Proj/Feelix2.0/node_modules/@serialport/bindings/build/Release/bindings.node' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/miu/Feelix_Proj/Feelix2.0/node_modules/@serialport/bindings/build/Release/bindings.node' (no such file), '/Users/miu/Feelix_Proj/Feelix2.0/node_modules/@serialport/bindings/build/Release/bindings.node' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))
at process.func [as dlopen] (electron/js2c/asar_bundle.js:5:1812)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1203:18)
at Object.func [as .node] (electron/js2c/asar_bundle.js:5:1812)
at Module.load (internal/modules/cjs/loader.js:992:32)
at Module._load (internal/modules/cjs/loader.js:885:14)
at Function.f._load (electron/js2c/asar_bundle.js:5:12633)
at Module.require (internal/modules/cjs/loader.js:1032:19)
at require (internal/modules/cjs/helpers.js:72:18)
at bindings (/Users/miu/Feelix_Proj/Feelix2.0/node_modules/bindings/bindings.js:112:48)
at Object. (/Users/miu/Feelix_Proj/Feelix2.0/node_modules/@serialport/bindings/lib/darwin.js:2:36)

@ankevanoosterhout
Copy link
Owner

ankevanoosterhout commented May 30, 2023

What version of electron do you have installed?
It looks like there are still some issues with the serialport module.
Can you try this (again):

  • Remove from node-modules folder the serialport and @serialport folders
  • Remove the file package-lock.json
  • Run npm i to install non-installed modules
  • Run ./node_modules/.bin/electron-rebuild (directly after npm i)

@Maxw3llGM
Copy link
Collaborator Author

Following the directives it does the same,

Error: dlopen(/Users/miu/Feelix_Proj/Feelix2.0/node_modules/@serialport/bindings/build/Release/bindings.node, 0x0001): tried: '/Users/miu/Feelix_Proj/Feelix2.0/node_modules/@serialport/bindings/build/Release/bindings.node' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/miu/Feelix_Proj/Feelix2.0/node_modules/@serialport/bindings/build/Release/bindings.node' (no such file), '/Users/miu/Feelix_Proj/Feelix2.0/node_modules/@serialport/bindings/build/Release/bindings.node' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))
at process.func [as dlopen] (electron/js2c/asar_bundle.js:5:1812)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1203:18)
at Object.func [as .node] (electron/js2c/asar_bundle.js:5:1812)
at Module.load (internal/modules/cjs/loader.js:992:32)
at Module._load (internal/modules/cjs/loader.js:885:14)
at Function.f._load (electron/js2c/asar_bundle.js:5:12633)
at Module.require (internal/modules/cjs/loader.js:1032:19)
at require (internal/modules/cjs/helpers.js:72:18)
at bindings (/Users/miu/Feelix_Proj/Feelix2.0/node_modules/bindings/bindings.js:112:48)
at Object. (/Users/miu/Feelix_Proj/Feelix2.0/node_modules/@serialport/bindings/lib/darwin.js:2:36)
(node:44947) electron: The default of contextIsolation is deprecated and will be changing from false to true in a future release of Electron. See electron/electron#23506 for more information

@Maxw3llGM
Copy link
Collaborator Author

Maxw3llGM commented May 30, 2023

I got it finally, I had to add the most recent version of serialport in the package (10.4.0) as it add support for m1

@ChristianFrisson
Copy link

@ankevanoosterhout @Maxw3llGM I have proposed pull request #3 to fix some installation errors (destination branch: https://github.com/ankevanoosterhout/Feelix2.0/tree/GSoC_Dev_Branch).

Two more comments:

  1. I think that installing angular-cli globally npm install -g @angular/cli is not needed if we run npm run build with angular-cli installed locally for Feelix instead of running ng build as recommended in the README.md.
  2. With the changes from PR Fix packages: closed-chain-ik + electron-rebuild #3, plus an updated version of the serialport package, maybe these instructions from README.md

Run npm install

Remove from node-modules folder the serialport and @serialport folders

Remove the file package-lock.json

Run npm run i to install non-installed modules

could be simplified directly into:

Run npm run i

?

@ankevanoosterhout
Copy link
Owner

Awesome, this looks great, thanks @ChristianFrisson! I never thought about optimizing this part of the code.., but this would make it a lot more user friendly :)
The local installation of angular-cli is enough I believe indeed,

@ChristianFrisson
Copy link

@ankevanoosterhout @Maxw3llGM Following up over there ankevanoosterhout/Feelix2Dev#1 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants