Skip to content

Darwin awards#1000

Merged
NiLuJe merged 18 commits into
koreader:masterfrom
NiLuJe:master
Oct 29, 2019
Merged

Darwin awards#1000
NiLuJe merged 18 commits into
koreader:masterfrom
NiLuJe:master

Conversation

@NiLuJe

@NiLuJe NiLuJe commented Oct 28, 2019

Copy link
Copy Markdown
Member

Attempt to appease the insanity currently happening w/ XCode 11

Relies on obscure GNU make features to defeat parallelism issues, hopefully the CI won't implode.
I have a Mojave build running in // to double-check.

Said insanity being completely broken dependencies in dynamic libraries: insane random @rpath, or brew libraries pulled instead of our own, or just plain broken paths. There's also often a self-reference in the deps (why is it here in the first place?) that's also broke 72.4% of the time.

I'm not actually familiar with the intricacies of the Mach-O format (nor with the relevant tools to mangle it), so, here be dragons.

it.

Because lniking keg-only formulas is generally a terrible idea.
Probably harmless change, but at least it's referenced somewhere.

c.f., man ld
We can't run 'em inside the same rule, as they cannot be run in //
(we need the binary to be built & linked before being able to patch
it!).

Leverage an obscure GNU Make feature to achieve that.
(https://www.gnu.org/software/make/manual/make.html#Double_002dColon)
To recap:

* We want to load our own luajit, not brew's.
* We want to pull our own depdendencies, not brew's.

Take a roundabout way via otool -L, because sometimes, what's picked up
is:

* an absolute path to our own lib: GOOD
* a relative path to our own lib:  GOOD
* an absolute path to brew's lib:  BAD
* a weird @rpath-prefix to our own lib, but not in the right place:
BAD
* a system path: BAD

I love macOS. >_<".
@NiLuJe

NiLuJe commented Oct 28, 2019

Copy link
Copy Markdown
Member Author

ONE THOUSAND§§!

(You couldn't have planned this one better.)

@NiLuJe

NiLuJe commented Oct 28, 2019

Copy link
Copy Markdown
Member Author

Note that, of course, this might, to a certain extent, depend on what exactly you happen to have installed via brew...

(Say, if you happened to have a matching tesseract or leptonica installed, something could potentially fuck those up, too).

@NiLuJe

NiLuJe commented Oct 28, 2019

Copy link
Copy Markdown
Member Author

Also kind of forgot to patch my macOS tree, so, one build in the wind :D.

NiLuJe added 10 commits October 29, 2019 00:41
-dylib is an LLD flag
-dynamiclib is a Clang flag
Not a dep field. Yay.
Fix it anyway.
$(shell) is make syntax, it gets expanded early, which explains the
parallelism issues.

Switch to pure shell syntax instead (i.e., backticks).

It makes for an uglier echo, since it's not expanded, but it's less
crazy ;).
@NiLuJe

NiLuJe commented Oct 29, 2019

Copy link
Copy Markdown
Member Author

Random remark: the latest SNAFU seems to confirm that the library's id is what gets used as a dependency in other libs that link to it, so fixing the id isn't as useless as I would have thought ;).

@NiLuJe

NiLuJe commented Oct 29, 2019

Copy link
Copy Markdown
Member Author

Okay, fresh build is OK on my macOS box, so this should be good to go if the CI is clear ;).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant