lvsti / CEF.swift

Swift bindings for the Chromium Embedded Framework
BSD 3-Clause "New" or "Revised" License
94 stars 29 forks source link

Building fails using Carthage on macOS 10.15 and 11.0 #44

Open axelboberg opened 4 years ago

axelboberg commented 4 years ago

I'm unable to build CEF.swift using Cartridge as it fails compiling at the steps below. This is true for environments on both macOS 10.15 (Xcode 11.6) and macOS 11.0 (Xcode 12.0 beta 5).

The following build commands failed: CompileC /Users/[user]/Library/Caches/org.carthage.CarthageKit/DerivedData/11.6_11E708/CEF.swift/[id]/Build/Intermediates.noindex/ArchiveIntermediates/CEF.swift/IntermediateBuildFilesPath/CEF.swift.build/Release/CEFSandbox.build/Objects-normal/x86_64/cef_library_loader_mac.o /Users/[user]/[project]/Carthage/Checkouts/CEF.swift/External/cef_binary/libcef_dll/wrapper/cef_library_loader_mac.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler CompileC /Users/[user]/Library/Caches/org.carthage.CarthageKit/DerivedData/11.6_11E708/CEF.swift/[id]/Build/Intermediates.noindex/ArchiveIntermediates/CEF.swift/IntermediateBuildFilesPath/CEF.swift.build/Release/CEFSandbox.build/Objects-normal/x86_64/libcef_dll_dylib.o /Users/[user]/[project]/Carthage/Checkouts/CEF.swift/External/cef_binary/libcef_dll/wrapper/libcef_dll_dylib.cc normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler (2 failures)

lvsti commented 4 years ago

could you also share what the actual errors are?

axelboberg commented 4 years ago

Sorry, it's been a long day. Judging by the logs it seems like it's the following two:

error: Build input file cannot be found: '/Users/[user]/[project]/Carthage/Checkouts/CEF.swift/External/cef_binary/libcef_dll/wrapper/cef_library_loader_mac.mm' (in target 'CEFSandbox' from project 'CEF.swift')

error: Build input file cannot be found: '/Users/[user]/[project]/Carthage/Checkouts/CEF.swift/External/cef_binary/libcef_dll/wrapper/libcef_dll_dylib.cc' (in target 'CEFSandbox' from project 'CEF.swift')

awmcclain commented 3 years ago

I'm running into the same thing. OS 10.15 and Xcode 10.3

lvsti commented 3 years ago

Unfortunately I cannot test this setup because my MBP tops at 10.14 🙈 Can you check whether the cef_binary folder actually exists? It should be created by the setup.sh after downloading the CEF bundle.

awmcclain commented 3 years ago

Nope, the whole Externals directory isn't there. Let me see if I can wrangle the log

Carthage/Checkouts/CEF.swift virtual-camera ✗ 1d3h ◒

▶ ls

CEF.swift LICENSE.txt README.md requirements.txt

CEF.swift.xcodeproj Modules Samples scripts

On Thu, Sep 17, 2020 at 12:46 PM Tamas Lustyik notifications@github.com wrote:

Unfortunately I cannot test this setup because my MBP tops at 10.14 🙈 Can you check whether the cef_binary folder actually exists? It should be created by the setup.sh after downloading the CEF bundle.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lvsti/CEF.swift/issues/44#issuecomment-694460676, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI3RR6TG7X5TO3XH3HOWS3SGJRR3ANCNFSM4QOTLT6Q .

awmcclain commented 3 years ago

carthage-xcodebuild.NLAO8c.log

lvsti commented 3 years ago

which branch are you guys on?

awmcclain commented 3 years ago

cef_4103

On Sun, Sep 20, 2020 at 4:19 AM Tamas Lustyik notifications@github.com wrote:

which branch are you guys on?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lvsti/CEF.swift/issues/44#issuecomment-695775424, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI3RR7ORFGPJZD5M4RERW3SGXQKLANCNFSM4QOTLT6Q .

-- Sent from a phone

awmcclain commented 3 years ago

I've narrowed down the problem. I think the issue is that the CEFSandbox gets built first (because it's a dependency) but it doesn't have the external resources build step, so setup.sh never gets run. I fixed that, but since I'm using Carthage to incorporate CEF into another project it gets confused about the git branch that I'm on.

I can fix that by grabbing the cef branch name from the Cartfile (whenever $CARTHAGE=YES). I'm happy to put all this in a PR unless there's another approach you'd prefer.

On Sun, Sep 20, 2020 at 9:09 AM Andrew McClain awmcclain@gmail.com wrote:

cef_4103

On Sun, Sep 20, 2020 at 4:19 AM Tamas Lustyik notifications@github.com wrote:

which branch are you guys on?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lvsti/CEF.swift/issues/44#issuecomment-695775424, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI3RR7ORFGPJZD5M4RERW3SGXQKLANCNFSM4QOTLT6Q .

-- Sent from a phone

lvsti commented 3 years ago

Instead of depending on the Cartfile, I'd rather use a branch.txt which contains the name of the branch. I'll submit a fix soon for the 4103 branch.

lvsti commented 3 years ago

BTW I added the setup build phase to the CEFSandbox target as well, thanks for noticing it. There is one weirdness though, the Carthage build now succeeds but only for the second time onward, in the first run it fails to find the same files. Let me know if you have a hunch why.

awmcclain commented 3 years ago

I noticed the same thing!

I think it’s because it pre-caches the headers before running the script (at least looking at the logs, there’s a bunch of stuff that happens before the script the second time).

Maybe set up a new dummy target as a dependency of both projects that only runs the setup script?

johnboiles commented 2 years ago

Maybe set up a new dummy target as a dependency of both projects that only runs the setup script?

That worked for me:

image
johnboiles commented 2 years ago

@lvsti 👋 want me to make a PR for this?

johnboiles commented 2 years ago

Hmm this fixed the issue for me when building in Xcode but not building an archive with xcodebuild. Hmm

johnboiles commented 2 years ago

My final solution was to tell Xcode about these output files:

image

BUT! Xcode goes ahead and creates the External/cef_binary... directory structure if I do that so I also had to add a rm -rf External/cef_binary || true right before creating the symlink in setup.sh.

Kinda messy, but it's working now at least