Closed p-linnane closed 1 year ago
Thank you seems a include issue
I'll check tomorrow
(Sorry for the noise above.)
This is actually because the C++ program is compiled with a C compiler. Double right angle brackets has been in the standards since C++11.
Adding a -std=c++11
flag should solve this, but I suggest that a C++ compiler be used instead. Please take a look at #51.
Building on Mac should be (info in the source)
MacOS 11.0 gcc (clang) 12.0.5, INTEL
MacOS 12.6 gcc (clang) 13.1.6, INTEL
Please note:
The -std=c++11 is required, otherwise you have to change half a dozen lines (or -DANCIENT).
No -static here
"Apple does not support statically linked binaries on Mac OS X.
(...) Rather, we strive to ensure binary
compatibility in each dynamically linked system library and framework
(AHAHAHAHAHAH, note by me)
Warning: Shipping a statically linked binary entails a significant compatibility risk.
We strongly recommend that you not do this..."
Short version: Apple does not like -static, so compile with
g++ -Dunix -O3 -march=native zpaqfranz.cpp -o zpaqfranz -pthread -std=c++11
Mac PowerPC with gcc4.x
Look at -DBIG (for BIG ENDIAN) and -DANCIENT (old-compiler)
g++ -O3 -DBIG -DANCIENT -Dunix -DNOJIT zpaqfranz.cpp -o zpaqfranz -pthread
Apple Macintosh (M1/M2)
Untested (yet), should be
g++ -Dunix -O3 -DNOJIT zpaqfranz.cpp -o zpaqfranz -pthread -std=c++11
The source is designed to be compiled with old C++ compilers (I mean from over 20 years ago), while maintaining a decent level of performance There are often 'strange' things, such as the use of ordered maps instead of unordered maps, simply because the latter are not always available
Similarly, no make, as on some systems, there is simply no make
The proposed Makefile is a kind of "wildcard", i.e. the one that - based on empirical experience - compiles on the largest number of non-Windows systems
It is trivial to make a Makefile for a specific target, much less so for FreeBSD, OpenBSD, Solaris, OmniOS, Linux, Arch Linux (not the same as Linux), Mac, Sparc, Android, Haiku, Qnap, Synology, ESXi
In short, if something seems strange, there's usually a reason for it :)
I don't have any modern Macs (Mx), so I only test for PPC and Intel. If it compiles on FreeBSD I normally consider it OK on Macs too
Thank you for the change, I'll put in the greetings sections
Short version:
On other "things" (BSD) the "pseudocode" is something like
"by default the JIT is turned off, UNLESS you are on Intel-amd64"
ZPAQFLAGS= -Dunix -DNOJIT
(...)
.if (${ARCH} == "amd64")
ZPAQFLAGS= -Dunix
.endif
If I can help, I am at your disposal
Thanks @fcorbelli for the explanation. I was aware of the build instructions in the README, but I did not have enough context to understand why. If the patch broke anything: please feel free to revert it.
I am rewriting from scratch a couple of functions, to work even without -std=c++11 A couple of days and I'll check better Can I add you like that?
20 Thanks to https://github.com/ZhongRuoyu for __linux__ instead of older #defines
A couple of days and I'll check better
Thanks!
Can I add you like that?
Yes, I'm happy with that. And thanks for doing so! :)
The "real" thing I do not know for Homebrew is conditional compiling.
On "everything" different from amd64 CPU a -DNOJIT is mandatory (M1, M2, PPC...)
Is it possible?
I really know nothing of "brew"
If it is impossible then a -DNOJIT must be enforced, even on Intel chips
This will slow down (a lot), but better than nothing
"spiegone". zpaq runs compression and extraction in PAQL, a custom-made language running on a virtual machine embedded in the software (! yes !).
On amd64 (Intel) there is a JIT (!) that translate the code into Intel machine language (! yes !). It is the default.
On "non Intel" the JIT must be excluded, running on software emulation (! yes !), with -DNOJIT
If you think this is crazy, remember that dr. Mahoney, the "father" of zpaq, is one of the world's top compression expert (today retired)
In fact the JIT use some extension, therefore on 32 bit Intel the situation is even more complex (! yessssss !), but I think there aren't Mac 32 bit Intel (all amd64)
On "everything" different from amd64 CPU a -DNOJIT is mandatory (M1, M2, PPC...) Is it possible?
Thanks for the info @fcorbelli. Yes, it is possible, and actually, it's already there: https://github.com/Homebrew/homebrew-core/blob/6a10c64ef2b12349ad8dbdc7fae2118c03940636/Formula/zpaqfranz.rb#L33-L34
# JIT only works on Intel (might work on Linux aarch64, but not Apple Silicon)
ENV.append_to_cflags "-DNOJIT" unless Hardware::CPU.intel?
The code snippet above means that -DNOJIT
is added to the compile flags on non-Intel (amd64) platforms.
but I think there aren't Mac 32 bit Intel
And 32-bit Intel is already out of the scope of Homebrew. Homebrew does not support 32-bit Intel at all. Neither do recent versions of macOS.
Hello 👋 . I'm a maintainer for the Homebrew project. While packaging v57.5 we are encountering build failures. The relevant GitHub Actions run can be found here: https://github.com/Homebrew/homebrew-core/actions/runs/4557146919/jobs/8038523624
Relates to https://github.com/Homebrew/homebrew-core/pull/126991