AbobosSoftware / cordova-plugin-brother-label-printer

Cordova and Capacitor plugin for Bother Label Printers
MIT License
10 stars 16 forks source link

Randomly can no longer compile. #34

Open cpgb85 opened 3 years ago

cpgb85 commented 3 years ago

I can no longer compile my application with this plugin installed. Anybody else encountering this issue?

robr2112 commented 3 years ago

@cpgb85 Did you recently update to Xcode 12.3 or later?

Assuming Yes: Look for a Build Setting named "Validate Workspace". Set it to YES. This should change the build from Error to Warning. You can then set to NO to eliminate the warning, if desired. You can also set it to "Yes (Error)", but this will result in failure to build (i.e. your current situation).

The primary issue behind this new Xcode error is that the SDK Framework eventually needs to be converted from a "Fat Binary" (both Device and Simulators) for the LIB file inside the framework to an "xcframework", where device and simulator are separated. This will be a future change to the SDK , but it is not available now.

Beware: For AppStoreConnect upload, with the current SDK, it is REQUIRED to remove the Simulator processors from the SDK framework that is embedded inside your app bundle. It seems that these recent changes to Xcode are trying to circumvent this by increasing the pressure on Framework creators to adopt the relatively new xcframework structure. But, in the meantime, you will need to add a RunScript or similar to remove the simulator processors inside frameworks embedded in your app bundle prior to upload.

Best regards, Rob

cpgb85 commented 3 years ago

This is not the issue. It's specifically this plugin that is causing me problems. It's so frustrating. And it happened randomly.

robr2112 commented 3 years ago

Well, this was the only thing I was aware of that could "randomly" cause Xcode to stop building (i.e. build error) due to the print SDK framework (v3.1.10 and higher). And, it started with Xcode 12.3. And, the solution I gave is the way to fix it (at least when building exclusively with Xcode).

If you wish to provide more info about the SPECIFIC error you get at build-time and the things you've tried to resolve it, then perhaps someone can help you.

cpgb85 commented 3 years ago

Sorry. Here is the command it tells me failed:

The following build commands failed: Ld /var/root/Library/Developer/Xcode/DerivedData/Visitor-profgibnqwtxutyxbdipfipgixjktjp/Build/Intermediates.noindex/Visitor-Pro.build/Release-iphonesimulator/Visitor-Pro.build/Objects-normal/x86_64/Binary/Visitor-Pro normal x86_64 (1 failure)

xcodebuild: Command failed with exit code 65

robr2112 commented 3 years ago

What version of Xcode do you have? What version of the SDK framework do you have?

It seems to be complaining about the x86_64 simulator processor slice for some reason. This should be available in the Universal Binary....at least in the latest SDK releases. Can you goto Terminal and run the "file" command on the framework lib and tell me what processors are listed?

I assume your "release" configuration is set to build ALL architectures, and your "debug" configuration will only build the ACTIVE architecture only. Can you switch to Debug configuration and see if this makes a difference? It may not, since most simulators now use x86_64. But try it and let me know.

cpgb85 commented 3 years ago

I will give a try to what you said. I don't know if this makes a difference, I don't think it should but I am using Apple's new macbook pro with the m1 chip.

cpgb85 commented 3 years ago

Sorry for not giving anymore detail, but why would it be trying to launch a simulator? I don't want to launch a simulator

cpgb85 commented 3 years ago

Using this: https://github.com/MenelicSoftware/cordova-plugin-brother-label-printer/issues/15

I added the libc++.1.tpd, libc++.tpd and libc++abi.tbd libraries. Now I receive the same error but instead of x86_64, it says the same issue with arm64.

Here is the error that appears above:

building for ios simulator, but no linking in object file build for ios, file 'visitor-pro/plugins/cordova-plugin-brother-label-printer/BRPtouchPrinterKit.framework/BRPtouchPrinterKit' for architecture arm64

Clang: error: linker command failed with exit code 1

robr2112 commented 3 years ago

1) What version of the SDK framework do you have? The one included with the code here is REALLY OLD (v3.1.1). It is a "static" framework. And, this may be why you needed to add libc++. The latest SDK frameworks (3.1.12 and 4.0.2) are "dynamic" and typically don't need to add this. But, it is necessary to "embed" the framework if you choose to update that from our SDK download site.

2) Did you recently install an Xcode update on your Mac?

Xcode 12 caused a lot of issues. I've already discussed that both here and in #15.

3) building for ios simulator It says that in your error. So, how could you NOT be building for simulator?

Sorry, I have no idea about Cordova development environment. I am an Xcode developer for native apps. I support the Brother iOS SDK. I am supporting this plugin out of courtesy. But, if you need help with the Cordova build system, I can't really help with that.

4) Your latest error sounds like one of the new Xcode 12 issues where arm64 is now considered both a simulator and a device processor (previously it was only a device processor, but due to the M1 now there is a simulator version too). It causes a problem typically ONLY when you build for Simulator in the Release configuration.

Anyway, please answer the questions I've asked about SDK and Xcode versions and the exact error message you are getting.

Thanks, Rob

cpgb85 commented 3 years ago

I'm a JavaScript developer and I am fluent in it. I typically use Vue to create web applications. When it comes to xCode, I am pretty much clueless. I have to wonder why apple thought this was a fantastic idea to make it this hard to develop applications for their platform.

  1. I'm using the SDK provided with this plugin because it was working previously. As stated above I would have a hard time trying to upgrade it but I might be able to manage.
  2. I'm using xcode 12.4. Before I convinced my work to buy me a modern macbook, I was working on a mac mini from 2011. I'm not sure which version was on there. But originally my program compiled on the new macbook.
  3. How can I not build for simulator? I just want to compile my app to put it on my device.
  4. M1 is the macbook that i have.

On a side note, what are the chances I could convince you to make a new plugin with me? I could do the JS side and you can do the sdk side. Seeing that this one is pretty much dead.

robr2112 commented 3 years ago

Thanks for the answers. I understand and feel your pain lol. A few years ago, I dabbled with trying to make a Cordova plugin. So, I'm at least familiar. I was using Visual Studio on Windows as the main dev tool, though of course for iOS it requires connecting to a Mac with Xcode. I've since updated to newer PC and Mac, and I can't get the Cordova development environment working (in very brief attempt several months ago). I'm not sure that Microsoft even supports Cordova in Visual Studio anymore.

So, what IDE are you actually using to build?

As for a collaboration on a new Cordova plugin that's up to date with our SDKs and "officially" supported, I'd be open to considering it. However, this is not high on my priority list right now. So, this is not likely to happen soon.

For now, let's try to figure this out, because it sounds more like a build system issue than an issue with this plugin per se. And, since it was working for you recently, it shouldn't be necessary to update the SDK. I think it's related to these Xcode 12 changes that require changes to the Build Settings to get around errors that are similar (inside Xcode) to what you are reporting. However, most of my understanding of these issues are related to the latest v4 SDK and I haven't tried with this really old 3.1.1 SDK with Xcode 12.

Cheers, Rob

cpgb85 commented 3 years ago

I actually got it! following the tips you gave in step 4, I was able to build and install my app to my development iPad and it works! Thank you for all your help! I think we should still look into either updating this plugin or creating a new one. I would I just don't know how. What sucks is that this is the only brother label printer plugin that there is.

robr2112 commented 3 years ago

Awesome! So, for anyone who may stumble across this in the future with a similar problem: Which specific suggestion actually resolved this for you?

cpgb85 commented 3 years ago

In xcode under build settings > architecture. I changed Build active architecture only from "multiple" to "Yes"

robr2112 commented 3 years ago

OK. It probably said "multiple" before because it was set to YES for Debug and NO for Release. You could have changed your "scheme" in Xcode to build for Debug instead of Release, and that should have worked too with the previous setting for this.

Beware that by changing this to YES for Release, your RELEASE app on the AppStore will NOT contain all device processors, it will only have the processor for the currently connected device (i.e. your iPad). This will likely be a problem for you later. So, you should change it back!!

Then, "Edit Scheme" so that "Run" uses the "Debug" build configuration (instead of "release").

There may still be a problem when you eventually build for release (i.e. "Archive"). So, we'll need to figure out how to resolve that still.

The original suggestion I gave (re "Validate Workspace") might resolve this. So, please review that suggestion and give it a try if you haven't already.

-Rob

cpgb85 commented 3 years ago

OK. It probably said "multiple" before because it was set to YES for Debug and NO for Release. You could have changed your "scheme" in Xcode to build for Debug instead of Release, and that should have worked too with the previous setting for this.

Beware that by changing this to YES for Release, your RELEASE app on the AppStore will NOT contain all device processors, it will only have the processor for the currently connected device (i.e. your iPad). This will likely be a problem for you later. So, you should change it back!!

Then, "Edit Scheme" so that "Run" uses the "Debug" build configuration (instead of "release").

There may still be a problem when you eventually build for release (i.e. "Archive"). So, we'll need to figure out how to resolve that still.

The original suggestion I gave (re "Validate Workspace") might resolve this. So, please review that suggestion and give it a try if you haven't already.

-Rob

What would it take for you to help me ready an app for submission to the app store? This xcode thing confuses me.

robr2112 commented 3 years ago

I'd recommend that you jump into the "official" Brother Support channels.

Here is a link to our Developer Program website. Sign-up is free for the most basic level. It helps us to have some insight into who we are working with and what you are trying to accomplish. https://developerprogram.brother-usa.com/

There's also a Contact Us option there where you can send an email.

-Rob

arcadius commented 1 year ago

@cpgb85 ,if your issue has been resolved, please feel free to mark this as closed please