Building on Mac

Hello - I’m stumbling through building Seamly2D on a Mac. For some background, it’s been a while since I’ve coded in C++, so I’m totally rusty on the different pieces at play in this build environment. I noticed that the README for the Mac build isn’t completely finished, so I might be in uncharted territory here?

System Information:

First question: does the above environment look correct? Am I using anything that is too new/old?

Issues:

  1. When I open up Seamly2D in Qt Creator, I see the following in the Issues tab:

    Seems straightforward? I’m maybe using an Xcode version that contains a newer version of the MacOS SDK (11.1) that Qt might have trouble with. However, even if I downgrade my Xcode tools to something that supports 10.15 SDK, this error still shows up and I get a different error that complains about the clang compiler version. Second question: should I care about this warning? I’ve tried Xcode command line versions 11.7, 12, and 12.4.

  2. When I ignore the above warning and attempt to build Seamly2D anyways, I get the following error (there are multiple, but they are similar to this):

    This is where my C++ is rusty. I don’t know what this error is actually saying and googling isn’t helping too much. Also not sure if this issue is a result of not fixing above Issue #1, but I wanted to mention it in case someone recognized this.

Anyways, I’ve been going back and forth between software versions, googling like mad, and figured it was time to throw in the towel and get some help. Thank you in advance.

3 Likes

I wish I could help… I’m not a Mac user. If by chance you are able to get the Mac ver to build let us know what kit settings you used so we can update the Readme.

Well the debugbreak.h file apparently looks like a hack into the debugger of sorts… Are you by chance trying to build in debug mode? I can only assume the compiler is complaining that gnu_inline is not defined as extern. Searching the code gnu_inline I find no definition for gnu_inline… Hmmm could it be a missing include somewhere?

That being said… if you have’t already… check that you’re set to Release and see if that avoids the gnu_inline warnings.

release

2 Likes

Thanks anyways @Douglas. Even if you’re unable to help with Mac stuff, it’s still nice to know my message isn’t going into a black hole. :slight_smile:

Good news - I was able to get past Issue #1. In case this is helpful in the future:

  1. I referenced the Qt mac docs from the Seamly2D README again, double-checked the supported XCode versions (11 and 12 at the time of writing for Qt version 5.15.2).
  2. Downloaded version 12 (again) of the XCode command line tools from Sign In - Apple that should have support for SDK 10.15.
  3. Double-checked the SDK version that comes with the command line tools by running ls -la /Library/Developer/CommandLineTools/SDKs. You should see a reference to SDK 10.15 and a symlink to it. You could run xcrun -sdk macosx --show-sdk-path, but I found it just returned the generic symlink name without a SDK version number.
  4. Closed and opened Qt Creator again. Noticed that error from above still persisted with the exact same info. Started thinking that there must be some sticky reference somewhere to the 11.1 SDK. Cleaned the build, restarted Qt - did nothing. Finally, I deleted the build folders entirely (located next to the Seamly2D git repo).
  5. Restarted Qt and voila - no issues regarding SDK versions are reported when I open the Seamly2D project.

Is deleting the build folder a normal procedure for weird issues in a C++/Qt environment? I’m not 100% sure what the culprit was, but this worked for me.

I was, so I changed it to release mode as you mentioned, but it didn’t resolve the gnu_inline warnings. Do you get any warnings at all when building on your platform?

2 Likes

Re: gnu_inline, I found this thread that talks about the warning message (⚙ D67414 [AST] Treat "inline gnu_inline" the same way as "extern inline gnu_inline" in C++ mode). It seems like there was some sort of behavior difference between gcc and clang compilers when it comes to this attribute? There’s some sort of release note that seems relevant:

C++ Language Changes in Clang


  • The behaviour of the gnu_inline attribute now matches GCC, for cases where used without the extern keyword. As this is a change compared to how it behaved in previous Clang versions, a warning is emitted for this combination.
1 Like

After ~1900 warnings (is this normal??), Seamly2D is building on my system. Yay! There’s a mix of deprecated declarations, gnu_inline, and macOS version linking warnings that I probably shouldn’t ignore, but I’ll poke through them when I have more time.

Re: deprecated declarations, I noticed that there’s an open issue about it, so I probably shouldn’t be using Qt 5.15 (Build: Fix deprecated Qt classes and functions · Issue #385 · FashionFreedom/Seamly2D · GitHub), but I’ll wait for a response from @slspencer. The README suggests that it should be ok, though.

2 Likes

No… although generally running qmake / cmake to clean the build is usually sufficient. What can happen is a reference discrepancy when linking, where either a linked dll is the wrong version, or when making updates, some .o files may not have needed recompiling as far as the make goes, but do need to be updated for a reference. Sometimes you can figure out what files to delete… the mocs, .o’s and make files from an error message… sometimes it’s easier to just delete the whole thing and start clean. Or more often I will just end up deleting a specific lib dir where the issue is, and just let it rebuild that dir. I just wish the warning / error messages were more descriptive as they tend to be rather generic where there could be a dozen reasons for the actual error.

3 Likes

I get plenty… mostly deprecation warnings, as I’m using 5.15.2, but the project is using 5.13.2 on Github. Some of the code is still 5.9 compliant. :frowning: If I do a clean build, I’ll get 250+ warnings. I’ve been updating a few of the 5.13.2 deprecation warnings as I encounter them, but I should just do a clean build and go through the build log and fix all the warnings to be at least 5.13 compliant and submit a PR.

You can turn off most of the compiler warnings, I just haven’t bothered.

1 Like

YES you are in uncharted waters. Thanks for your bravery. Here be dragons, and also lots of love and appreciation.

2 Likes

I submitted a PR to update the README with better macos devenv instructions!

I was trying to be clever and download the barebones command line tools in order to avoid downloading giant XCode, but it turns out that QTCreator uses some xcode-specific commands that help it find certain utilities that you can’t do with the command line tools alone. So future macos developers: don’t do what I did.

1 Like

Yes… I caught that in my email. :slight_smile:

I found it easier to just embrace QtCreator… especially when it comes to designing forms. It’s just easier to maintain, and you can review a form without having to build the app.

1 Like