AMNS / Nightingale

Nightingale music notation software.
Mozilla Public License 2.0
11 stars 3 forks source link

Code cleanup: compilation errors with less ancient versions of Xcode #82

Closed donbyrd closed 8 years ago

donbyrd commented 8 years ago

Trying to compile Ngale with Xcode 3.2 gives 149 fatal errors, all either "Jump to case label" or "Crosses initialization of...". Presumably this is really because gcc 4.2 (which Xcode 3.2 uses) is stricter than what Xcode 2.5 uses -- I believe gcc 4.0. See

https://lists.apple.com/archives/xcode-users/2005/Jun/msg00667.html

NB: This happened on my machine several years ago -- in 2012 or 2013.

MusicMouse commented 8 years ago

I fixed all these errors, resulting in a complete compile and new executable that launched successfully from the Finder.

All but one of the errors were similar problem due to use of goto and labels or with defining variables inside of switch cases that were exited by break statements that work similarly to labels. The remaining single error was the ""#ifndef OS_MAC" conditional which I commented out.

Yes this was using gcc 4.0.

You asked that I attach to this thread the listings of these errors I had emailed you prior to fixing them.

11_src_files_with_errors

errors_alt_listing.txt

62_errors_only_in_11_files.txt

62_errors+warnings_in_11_files.txt

MusicMouse commented 8 years ago

It also compiles and can be launched from the Finder with gcc 4.2 now.

However when I enter notes from the trackpad the noteheads of notes I enter seem to be missing. I think I may have inadvertantly messed up the flow of control in DurationPopUp.cp due to not understanding quite what you intended. You should check that.

Because the build setting are all different from those you use I will email you only the files I changed. See if the changes I made also work for you. I don't want to upload anything till I know I haven't messed up anything important.

donbyrd commented 8 years ago

Great that it even compiles with gcc 4.2 now!

I didn't write much, if any, of DurationPopUp.cp myself. But I'll see what I can see, though I probably won't look at it too closely until I get home and can look on my development mating. The missing note heads sounds pretty strange! NB: Ngale's Debug command can check its data structures pretty thoroughly; I'd suggest you see if its medium level (command-2 in the dialog) finds any problems; use the Console utility to view its results.

donbyrd commented 8 years ago

Even without Laurie's changes, Ngale compiles on my MacBook now with both gcc 4.0 and gcc 4.2! Huh?? Perhaps related: Laurie was getting only 62 errors vs. the 149 I got a few years back (see the original comment in this thread). Maybe because of a difference in project settings?

MusicMouse commented 8 years ago

Very strange that you didn't get errors. Did you do a clean on the project (removing previously compiled code) including the precompiled headers before you did the new build?

donbyrd commented 8 years ago

Yes. As I said in an email today (that you apparently haven't seen yet), before building and running the first time, I did Clean All Targets, with both "Also Clean Dependencies" and "Also Remove Precompiled Headers" checked. I did that again just in case, and it compiled again. So the best theory I can think of that covers the known facts is that it's a difference in our project settings.

MusicMouse commented 8 years ago

I just set up and tried a compile on a MacBook CoreDuo running Mac OS 10.6.8 with Xcde 3.0. It compiled a fresh download of the code in AMNS/develop all except for the error on that cryptic #ifdef MAC OS....

So I swapped in my changed files. This time it compiled fully and unlike on my other Mac it launched from within the build process, and it did NOT have the missing note heads problem. Obviously I haven't tested all of Nightingale's functionality but entering and playing a few notes sure seems altogether fine.

So I now think that was a problem specific to my studio Mac, which dates from 2011 and has seen heavy use and has begun to have problems in various little ways.

Conclusions:

The failure to launch from within Xcode occurred in 2 different Xcode 3.2 installations, but not in any earlier versions of Xcode.

The missing note heads problem I experienced on my old studio Mac has not been replicated elsewhere. I will check whether it has to do with the use of an external monitor on a MacBook Pro.

The removal of label and goto code I did in those 11 files has not shown any problems.

donbyrd commented 8 years ago

The failure to launch from within Xcode is very odd, but I don't think it's worth worrying about, especially since I have no idea where to even start looking!

W/r/t the missing note heads, have you checked the score with Ngale's Debug command? I've seen something like it very occasionally with built versions of Ngale that are fine 99% of the time. In those cases, Ngale thinks the measure has a width of zero, which the Debug command points out ("MEASURE AT xx IS NON-EMPTY BUT HAS WIDTH ZERO") -- but the stems aren't drawn either. Cf. the short example, InvisibleNotesBug.ngl, attached to this. So I suspect it's a different problem, and again probably not worth worrying about unless it happens on other Macs. Do you think we should keep your code changes? I'm inclined to put off for a bit deciding. I'm planning to make some last changes in the current develop branch (one being to remove my silly #ifdef MAC OS #error), then merge develop into master, within two or three days; then we might decide to add your changes to develop. Does that sound okay? Though you should feel free to start your own branch at any time; I'm still not an experienced enough GitHub user to want to try anything at all fancy myself.

The "Development environment requirements" on the GitHub Nightingale main page are now grossly out of date; I'll update them before too long, but, everybody, feel free to take a stab at it!

InvisibleNotesBug.ngl.zip

MusicMouse commented 8 years ago

Still getting missing noteheads on my studio Mac. ngale_missing_noteheads

Should Ngale install all the fonts that it needs when first run on a Mac? Maybe I'm missing a font. Which does it default to?

Note: This problem did not occur when first launching the program on the MacBook I set up for Tim to use.

MusicMouse commented 8 years ago

In case this offers any hints:

One, but only one, of the times I encountered this problem I got an error message saying that Briard was not installed on my Mac, defaulting to Sonata instead. I do have the Sonata font (yes, properly licenced) on my Mac.

donbyrd commented 8 years ago

Sigh. This is weird.

Ngale defaults to Sonata, yes -- but for drawing on the screen, iit uses the bitmap fonts, not the PostScript font. And when you launch it, it checks for availability of the bitmap fonts on launch and it should have warned you if any of the seven sizes it wants were missing. It also should have told you how many sizes were found

Did you see my email asking you to run Ngale's Debug command? Cmd-0 (zero) cmd-2 for normal level checking; output is via the Console utility. Does it complain about anything?

If what the problem is still isn't obvious, I'd like to see the Ngale file. Would you please zip it up and attach it to a response to this comment?

MusicMouse commented 8 years ago

We just compiled Ngale on the MacBook (OS 10.6.8, Xcode 3.2) that I set up for Tim and it runs very slowly due to only 1 gb of memory) but it is unable to find the default font. This makes me suspect that the problem I'm having and on the Mac Tim's using too is that we are running NGale without ever having done a proper install of the software. So both of our Snow Leopard Mac are missing fonts and possibly other resources the installer would have provided that an Xcode build and run don't provide.

We'd like to each try running the actual NGale installer a user would have used to see if our font problems vanish.

On Tim's Mac there are chars from another font in place of music notation font symbols where note heads should be. On my Mac they're just blank.

donbyrd commented 8 years ago

Laurie, as I said before: Did you see my email asking you to run Ngale's Debug command? Cmd-0 (zero) cmd-2 for normal level checking; output is via the Console utility. Does it complain about anything? If what the problem is still isn't obvious, I'd like to see the Ngale file. Would you please zip it up and attach it to a response to this comment?

W/r/t fonts, a couple of days ago I sent you a message with the subject line "[Ngale fonts attached!; WAS] Ngale and the system log", which indeed has the Ngale fonts attached. Installing them is very easy; it's described in InstallingNightingaleFonts-TN12.pdf, in doc/Notes, ONLY for the develop branch.

MusicMouse commented 8 years ago

I haven't gotten back to trying anything with the code since you suggested doing this. Will try to get to it over the weekend.

Not sure about running NGale in a debugger since it doesn't launch within Xcode, Ono from the Finder or Terminal after a build/debug version is compiled.

So I hope you mean the cmd-0 is within the executable, not needing the Xcode debugger.

I will try to get to this in the next couple of days. I am curious as well as perplexed.

Do you mean you'd like me to zip and send to you the application or a score that is missing it's note heads as a Nightingale score file?

On Jun 3, 2016, at 9:08 PM, Don Byrd notifications@github.com wrote:

Laurie, as I said before: Did you see my email asking you to run Ngale's Debug command? Cmd-0 (zero) cmd-2 for normal level checking; output is via the Console utility. Does it complain about anything? If what the problem is still isn't obvious, I'd like to see the Ngale file. Would you please zip it up and attach it to a response to this comment?

W/r/t fonts, a couple of days ago I sent you a message with the subject line "[Ngale fonts attached!; WAS] Ngale and the system log", which indeed has the Ngale fonts attached. Installing them is very easy; it's described in InstallingNightingaleFonts-TN12.pdf, in doc/Notes, ONLY for the develop branch.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

donbyrd commented 8 years ago

Command-0 (zero, not oh, incidentally) is a Nightingale command. Take a look at its Test menu. I use it about every four or five minutes when working on a score. I also find the Browser and Context commands in the Test menu to be very useful, though much more for working on Ngale itself than for working on music.

I'd like you to send me the score with the missing note heads. Thanks in advance!

I wish David Gottlieb and Tim were subscribed to this thread; I'll suggest it via email. (Or maybe they are following it and just haven't commented; I'm sure GitHub would tell me if I knew how to ask :-) .)

hamletmaschine commented 8 years ago

I am now subscribed to this thread. Thanks for the invitation. (This is Tim, BTW)

donbyrd commented 8 years ago

Welcome, Tim. Unfortunately the subject of this thread has drifted, as they so often do. I might rename it to something broader. But it'd be much better to move the last six or eight comments to a new thread, and close this Issue, but I don't know how.

MusicMouse commented 8 years ago

You can now close the divergent subthread of the missing note heads. Installing the fonts correctly did work. On one of my 2 Snow Leopard Macs it worked right off the bat. But on the other I couldn't get the note heads to show up. They turned up after a reboot, which had not been necessary on the other Mac.

MusicMouse commented 8 years ago

On the original topic, I have no idea which of the Xcode project settings I changed account for the difference between the errors I got, mostly due to labels and gotos, and your version of the project that had no problem compiling those.

I will leave it to you whether to keep or change the use of labels and jumps as well as those errors that were due to variables defined within very small scopes such as within a single case of a switch statement.

When I got them, they were not warnings but actual errors that prevented a full build.

You can close this thread if you want, or else keep it open, if there is more that might be said.

donbyrd commented 8 years ago

Glad to hear about the appearance of the wayward note heads! I think I'll forget about the changes you'd made to get rid of those compilation errors (I know they were errors, not mere warnings), at least for now, since it's not clear to me that they're helpful in any way -- I just don't see anything risky about the pre-existing code). And I'll close this thread now (which, you'll note, I renamed to reflect more accurately what it ended up being about). It can always be reopened if necessary.

donbyrd commented 8 years ago

I've compiled and tested Ngale 5.6 (probably the final version of 5.6) with Xcode 3.2 on my very old white MacBook running OS 10.6, as well as with Xcode 2.5 on my even older G5 running OS 10.5.8. It compiles with both and seems to run fine with both, though NB I tested the Xcode 3.2 version only briefly, and only on the MacBook.