jmcnamara / libxlsxwriter

A C library for creating Excel XLSX files.
https://libxlsxwriter.github.io
Other
1.51k stars 333 forks source link

Mac Catalyst issue with Cocoapods #337

Closed willm132 closed 3 years ago

willm132 commented 3 years ago

When compiling for Mac Catalyst I am getting this error:

Undefined symbols for architecture x86_64: "_format_set_bold", "_format_set_border", "_format_set_border_color" ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

jmcnamara commented 3 years ago

The is just a standard link error. Make such that -lxlsxwriter is on you link command line. She the standard variations here: https://libxlsxwriter.github.io/getting_started.html#gsg_using

willm132 commented 3 years ago

@jmcnamara I am using CocoaPods with Xcode

jmcnamara commented 3 years ago

I am using CocoaPods with Xcode

In that case I can't help you much since I don't use CocoaPods myself. Try the following sample code and see if it works: https://github.com/FrankenApps/LibXlsxWriterSwiftSample

Also, are you compiling on a M1 mac?

willm132 commented 3 years ago

I use Intel iMac and M1 MacBook Pro

jmcnamara commented 3 years ago

Do you see the same issue on both systems?

willm132 commented 3 years ago

I have not used the M1 since adding xlsxwriter. I am currently on the iMac.

jmcnamara commented 3 years ago

Ok. Can you try the sample app linked above and see if it works.

willm132 commented 3 years ago

Yes, the sample did compile and work on Mac Catalyst. What do I need to do to get my project working?

jmcnamara commented 3 years ago

I'd suggest using the sample application and add functionality until it is similar to the app you are trying to compile and use that to figure out why your project isn't working.

Either way I don't think this is a general libxlsxwriter issue, or something that I can help you with, so I am going to close this.

willm132 commented 3 years ago

@jmcnamara When running via Sample it complies and runs fine, but if I try to build to export via AdHoc I am getting this error:

Umbrella header 'xlsxwriter/libxlsxwriter-umbrella.h' not found

jmcnamara commented 3 years ago

@FrankenApps could you help with this issue.

FrankenApps commented 3 years ago

I don't have an Apple Developer Account, so there isn't really a way I could reproduce this. I will still try and have a look...

willm132 commented 3 years ago

Like I said it runs fine on the machine but will not archive

willm132 commented 3 years ago

Any updated on this?

jmcnamara commented 3 years ago

Hi Will, you may have better luck on a Catalyst or Cocoapod forum, or StackOverflow. There probably aren't too many Catalyst/Cocoapod users on here.

If you find a solution let us know.

FrankenApps commented 3 years ago

@willm132 Have you checked this?

willm132 commented 3 years ago

@FrankenApps yes I actually did try that but no luck still

FrankenApps commented 3 years ago

Does it work when generating a signed .ipa? As stated above there is no real way to reproduce this for me...

willm132 commented 3 years ago

If I run it from Xcode it installs on the device and works fine, when I go to Project > Archive, this is when it gives me the error

FrankenApps commented 3 years ago

Aha, now I understand. But this only happens when archiving for mac. You can archive it just fine for iOS.

willm132 commented 3 years ago

@FrankenApps Yes, my project supports Mac Catalyst.

willm132 commented 3 years ago

Compile Swift source files (x86_64)

BuildProductsPath/Release-maccatalyst/libxlsxwriter/xlsxwriter.framework/Modules/module.modulemap:2:19: Umbrella header 'xlsxwriter/libxlsxwriter-umbrella.h' not found

Could not build Objective-C module 'xlsxwriter'

FrankenApps commented 3 years ago

Well, I do know what the Issue is, but I don't know how to fix it.

There should be an alias for the Headers in BuildProductsPath/Release-maccatalyst/libxlsxwriter/xlsxwriter.framework, but it is not there.

Current: Bildschirmfoto 2021-06-14 um 21 42 45

How it should be (Sourceful does this right): Bildschirmfoto 2021-06-14 um 21 43 07

willm132 commented 3 years ago

Is this something I can manually add on my end to resolve this?

FrankenApps commented 3 years ago

I don't know. Might have something to do with Header Search Paths, but I don't know how to fix this. It should be possible to add this alias with a build script, because we know, that it should target Pods/libxlsxwriter/include, but I am definitely not an expert and have no idea how to do this. Also I don't know, why it works for debug builds, because as far as I can tell the settings are exactly the same...

willm132 commented 3 years ago

My header search path contains "${PODS_CONFIGURATION_BUILD_DIR}/libxlsxwriter/xlsxwriter.framework/Headers".

Is this an issue with Libxlsxwriter or my project?

jmcnamara commented 3 years ago

This issue looks similar to this one: https://github.com/CocoaPods/CocoaPods/issues/10354

Maybe try update to the latest, beta, cocoapod framework to see if it fixes the issue, as suggested there.

willm132 commented 3 years ago

So how would I go about updating to Cocoapods 1.10.2 beta?

jmcnamara commented 3 years ago

You can try this:

gem install cocoapods --pre

As suggested here: https://guides.cocoapods.org/using/getting-started.html

willm132 commented 3 years ago

Would this have something to do with it? after running pod update

[!] The Graf Brothers [Debug] target overrides the OTHER_LDFLAGS build setting defined in `Pods/Target Support Files/Pods-Graf Brothers/Pods-Graf Brothers.debug.xcconfig'. This can lead to problems with the CocoaPods installation

[!] The Graf Brothers [Release] target overrides the OTHER_LDFLAGS build setting defined in `Pods/Target Support Files/Pods-Graf Brothers/Pods-Graf Brothers.release.xcconfig'. This can lead to problems with the CocoaPods installation

[!] The Graf BrothersUITests [Debug] target overrides the ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES build setting defined in `Pods/Target Support Files/Pods-Graf Brothers-Graf BrothersUITests/Pods-Graf Brothers-Graf BrothersUITests.debug.xcconfig'. This can lead to problems with the CocoaPods installation

[!] The Graf BrothersUITests [Release] target overrides the ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES build setting defined in `Pods/Target Support Files/Pods-Graf Brothers-Graf BrothersUITests/Pods-Graf Brothers-Graf BrothersUITests.release.xcconfig'. This can lead to problems with the CocoaPods installation

willm132 commented 3 years ago

@FrankenApps

gem install cocoapods --pre

This installed 1.10.1 which is resulting in the same error

jmcnamara commented 3 years ago

In that case you will probably need to install the version in the GitHub repo. I haven't done that before but I presume there is some gem command.

FrankenApps commented 3 years ago

I was able to sucessfully archive my demo project for Catalyst with that method on 1.10.1 Its not a pretty solution but it works, and does basically what I mentioned above using a script.

willm132 commented 3 years ago

So just throw that in a script file and run it while I archive my project?

FrankenApps commented 3 years ago

Yes, and adjust the paths to your local setup.

jmcnamara commented 3 years ago

There was an update on the Cocoapods #10224 about how to use Unreleased Cocoapod Features.

Here is a summary of how to get a version of pod with the fix for issue 10224 built in:

# This took a couple of goes:
$ bundle update --bundler

$ cd /tmp
$ git clone git@github.com:CocoaPods/CocoaPods.git
$ cd CocoaPods/
$ git checkout 1-10-stable
$ bundle install
$ echo $(pwd)"/bin/pod"

# So now you should have a patched version of pod. For me this was:
$ echo $(pwd)"/bin/pod"
/tmp/CocoaPods/bin/pod

# Then use this version of pod to install libxlsxwriter:
/tmp/CocoaPods/bin/pod install

Could one of you try that to see if it works.

jmcnamara commented 3 years ago

@FrankenApps

Try the https version instead:

git clone https://github.com/CocoaPods/CocoaPods.git
willm132 commented 3 years ago

Yes that is what I did to get it working.

I installed the new CocoaPods, created an alias in terminal for it, ran the new pod update, and that worked! Thank you so much for all the help

jmcnamara commented 3 years ago

I'm going to close this again since the original reported issue should be fixed.