@pgatt has very nicely been helping with compiling for Mac (Thank you!!). The mac compiler trips over all kind of things where I do not even get warnings on win/msys2. It seems the latter automatically includes stuff that not happens on a mac so it is very hard to debug. For example #include < array >
Are there settings / flags for the g++ compiler that makes it nag on the same things as the mac? I tried tor read the man pages … really I did…
(Read about azure pipelines, that may be a next step)
The azure pipelines are well worth the time investment to setup. I took a diff of what I had to change after importing baconpaul’s scripts and yaml for my repo. I’ve since changed the release from “Nightly” to “Development” to better show it’s continuous integration rather than an actual nightly build.
As Jerry hinted at, but didn’t actually state, the compiler on the mac is clang, whereas on windows and linux it’s gcc. There is a gcc on the mac, but it’s just a wrapper around clang that makes clang act kind of like gcc.
Jerry was suggesting that one possibility is to use clang on Linux, which is definitely possible, although last time I did it I had to build it myself and it took a very long time.
For me, the differences on the mac means yet another chance to catch some potentially wrong code, so there is sort of a silver lining to this difference.
btw: I’ve never tried clang on windows, but it seems possible to do.
Unless we are talking about some really old Apple operating system and Xcode. They used to use GCC themselves back in the day. I don’t think the original poster clarified what kind of Mac system he is using.
That’s not GCC on Mac, that “just a wrapper around clang that makes clang act kind of like gcc”.
You can build GCC on Mac if you want though, but it likely won’t work with a lot of Mac-specific APIs.
Yes, I was not utterly accurate there. How about “XCode comes with a program called gcc, but it is just a wrapper around clang. The make files that come with the rack sdk assume you have something installed that at least resembles gcc. That’s why you can compile on the mac without installing real gcc. The gcc wrapper around clang will compiler rack itself, and will compile any “normal” plugin. But will give different compiler warnings.”
It’s an implementation detail in the compiler/toolchain whether something gets included “automatically” or not. The standard way to do things is to always explicitly include in the code the headers you are using.
indeed. and it’s always a surprise going between compilers if you forget to explicitly include something that the other compiler (usually g++ in my case) doesn’t include.
This is strange - I added now -Wpedantic for testing (Linux build) and build Rack and a Plugin and gcc prints warnings like crazy for almost every compilation unit.
To see if your flags are correct you can call make like this: VERBOSE=1 make and you see complete compiler invocation with all given parameters and flags. Check if it contains -Wpedantic.