Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Darwin awards #1000

Merged
merged 18 commits into from
Oct 29, 2019
Merged

Darwin awards #1000

merged 18 commits into from
Oct 29, 2019

Conversation

NiLuJe
Copy link
Member

@NiLuJe NiLuJe commented Oct 28, 2019

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
Copy link
Member Author

NiLuJe commented Oct 28, 2019

ONE THOUSAND§§!

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

@NiLuJe
Copy link
Member Author

NiLuJe commented Oct 28, 2019

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
Copy link
Member Author

NiLuJe commented Oct 28, 2019

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

-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
Copy link
Member Author

NiLuJe commented Oct 29, 2019

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
Copy link
Member Author

NiLuJe commented Oct 29, 2019

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.

None yet

1 participant