Build native modules with electron-builder for different OS - electron

I'm creating an app using electron and nodejs, when I try to build it with electron-builder using following command:
electron-builder --mac --linux --win --x64
it builds native modules only for my current os. Is there a way to build native modules for all operating systems?

you can't. https://www.electron.build/multi-platform-build
If your app has native dependency,
it can be compiled only on the target platform unless prebuild is not used.
prebuild is a solution, but most node modules don't provide prebuilt binaries.
macOS Code Signing works only on macOS. Cannot be fixed.

Related

Electron Native Modules: Prebuild and Reuse?

I am facing the following challenge: my electron project uses native modules that have no prebuilt versions for macOs and Windows, so currently I have to build it on different machines and can't utilize automatic build pipelines. Is there a way to prebuild native modules and have them "available" so I could do my windows build from a mac, my mac build from windows or both with a linux build machine?
I am not the owner or maintainer of these native modules.

Building ios apk from ionic 3 project

When i try to build : ionic cordova build ios apk, i got this below message . Could u plz help me . Thanks
cordova build ios
(node:18556) UnhandledPromiseRejectionWarning: xcodebuild was not found. Please install version 7.0.0 or greater from App Store
(node:18556) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:18556) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I have installed everything as follows
[11:41:11] lint finished in 13.88 s
PS C:\Users\user\myApp> cordova -v
8.0.0
PS C:\Users\user\myApp> java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
PS C:\Users\user\myApp> javac -version
javac 1.8.0_101
PS C:\Users\user\myApp>
iOS apps are packaged as .ipa, not .apk which is for Android.
You need Xcode and the iOS SDK to build an iOS .ipa.
Unfortunately, both are only available on a Mac.
As explained in the ionic docs, they mention that the only option is to use Ionic Package:
iOS
The iOS SDK does not run on Windows, so nothing to do here. Still
want to build for iOS, though? Check out Package, part of the Ionic
Cloud.
From the Ionic Package docs:
Packaging Native Binaries
Ionic Pro’s Package feature makes it easy to build native app binaries for iOS and Android in the cloud.
Perfect for automating binary builds and for developers using Windows
that want to build iOS apps.
That's your 1st option.
A 2nd option would be to use a Mac instead as your development environment.
If you're planning to be developing iOS apps long-term, then you really need a Mac.
(You can build Android .apk's on a Mac but not the other way around.)
A 3rd option is to run Mac OS on a virtual machine or setup your own "Hackintosh".
Though, doing some researching will tell you that that's going to be a complicated process in itself, and it's not recommended due to instability issues.
I suppose your are trying to create ipa file. There is nothing called "ios apk".
You need a macOS machine to create ipa.
ipa files can not be created on windows machine.

Building iOS cordova app on cross-platform windows agent (TFS)

I was wondering if it's possible to build an iOS app with the cordova framework on a cross-platform Windows Build Agent : https://github.com/Microsoft/vsts-agent/blob/master/README.md
I'm using the Cordova build task: https://github.com/Microsoft/vsts-cordova-tasks, but I can't seem to run this on Windows.
Which prerequistes do I need to install on my Windows agent, or is it mandatory to have an OSX installation?
Thanks in advance,
Tim
You have to use an OSX agent to build iOS app. A more detailed instruction for this task can be found here: Build Apache Cordova apps and you can refer to Building iOS on OSX section for details.

Unable to compile Phonegap app locally

I'm unable to compile my app for iOS locally, Android works OK.
I have installed both cordova and phonegap using npm install -g [...]. I am running OSX (10.7.5).
Version outputs from both:
$ cordova -v
5.1.1
$ phonegap -v
0.9.4
I have XCode installed (v 4.6.2). I also have the command-line tools installed.
Both the cordova and phonegap tools fail to build, seemingly for the same reason. Running phonegap build ios outputs:
$ phonegap build ios
phonegap detecting iOS SDK environment...
phonegap using the local environment
phonegap compiling iOS...
error ENOENT, no such file or directory '/Users/mike/apps/***/platforms/ios/__CLI__/config.xml'
Here is the output from the same cordova command:
$ cordova build ios
cp: copyFileSync: could not write to dest file (code=ENOENT):/Users/mike/apps/***/platforms/ios/__CLI__/config.xml
cp: no such file or directory: /Users/mike/apps/***/platforms/ios/platform_www/*
Parsing /Users/mike/apps/***/platforms/ios/__CLI__/config.xml failed
Error: ENOENT, no such file or directory '/Users/mike/apps/***/platforms/ios/__CLI__/config.xml'
at Error (native)
at Object.fs.openSync (fs.js:500:18)
at Object.fs.readFileSync (fs.js:352:15)
at Object.module.exports.parseElementtreeSync (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/util/xml-helpers.js:118:27)
at Object.ConfigParser (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/configparser/ConfigParser.js:33:24)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/prepare.js:115:32
at Array.map (native)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/prepare.js:70:40
at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:816:30)
It seems to me that there should be some replacement running on __CLI__ in the path that isn't happening, but it's difficult to tell. Below is a screenshot of the file structure this generates:
I am able to build using the remote build service, but it's quite laborious, as the app isn't properly loading so I need to do quite a bit of debugging to sort this out.
Node is installed at version 0.12.5. NPM is installed at version 2.11.2.
I have reinstalled the platform numerous times, and always get this error.
This question is a little old, but I'll throw a few things out there:
I've got a command line build of my ios platform running -- it does not have an __CLI__... subdirectory. Just a data point.
I'm wondering if there isn't something weird with the way Xcode is set up in relation to its build path. See this answer to make sure the output directory is set correctly: still getting <Cordova/CDVViewController.h> file not found error in xcode. I've got a desktop and mobile app set up in Xcode, and I have to remember to switch this setting back and forth.
PhoneGap / Cordova have been phasing out older versions of ios with their newer releases. It would not surprise me if cordova 5.1.1 did not support Xcode 4.6.2. You might want to try with an older release of the cordova library.

64 bit support building Ipa with vs-mda-remote

I'm trying to build an Ipa with 64 bit support using Visual Studio Tools for Apache Cordova (CTP 3.0) but without success.
It seems that the vs-mda-remote agent builds just with the Arm architecture support.
Unzipping the Ipa and checking the binary with the file command, returns this result:
Mach-O executable arm
The curious thing is that opening the xcode project deployed to the mac builder machine, the build settings of the universal architecture are properly set and building and archiving it generates an Ipa that contains a binary that supports the 64 bit architecture.
Do you know why there's this difference?
Could be some parameters that vs-mda-remote sets to the command line when building the project, overriding the project's build settings?
Could be a Cordova problem?
64 bit support is included in Cordova builds since v3.4.1, so every version of Tools for Apache Cordova has had 64-bit support. vs-mda-remote simply does a base cordova build, so you should be getting arm, arm7v, and arm64 in one fat binary when building under release.
http://cordova.apache.org/announcements/2014/11/25/ios-64bit.html
However, right now the Cordova project only builds "active architectures" under the debug config while it builds all for release. Building only one speeds up build times during debugging.
If you don't like this debug behavior, you should be able override this by placing a custom build-debug.xcconfig in res/native/ios/cordova with the key ONLY_ACTIVE_ARCH = NO;
Here's the original: https://github.com/apache/cordova-ios/blob/master/bin/templates/scripts/cordova/build-debug.xcconfig

Resources