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

MacOS tweaks #155

Merged
merged 2 commits into from
Mar 5, 2020
Merged

MacOS tweaks #155

merged 2 commits into from
Mar 5, 2020

Conversation

anjohnson
Copy link
Contributor

These changes make it possible to build on MacOS Mojave (they moved the X11 libraries to /opt/X11), and fix a build warning.

I do still get these warnings at build-time:

[ 71%] Building CXX object src/CMakeFiles/nedit-ng.dir/DocumentWidget.cpp.o
/Users/anj/Software/other/nedit-ng/src/DocumentWidget.cpp:7084:109: warning: 
      format specifies type 'long' but the argument has type 'int64_t'
      (aka 'long long') [-Wformat]
  ...%8li %s", i + 1, qPrintable(fi.pathname), qPrintable(fi.filename), Tags::tagPosInf[i]...
     ~~~~                                                               ^~~~~~~~~~~~~~~~~~
     %8lli
/Users/anj/Software/other/nedit-ng/src/DocumentWidget.cpp:7090:106: warning: 
      format specifies type 'long' but the argument has type 'int64_t'
      (aka 'long long') [-Wformat]
  ...%8li", i + 1, qPrintable(fi.pathname), qPrintable(fi.filename), Tags::tagPosInf[i]);
     ~~~~                                                            ^~~~~~~~~~~~~~~~~~
     %8lli
2 warnings generated.

which you might be able to fix should you wish to, and this one:

[ 99%] Building CXX object import/CMakeFiles/nedit-import.dir/import.cpp.o
In file included from /Users/anj/Software/other/nedit-ng/import/import.cpp:386:
In file included from /usr/X11R6/include/X11/Xresource.h:53:
In file included from /usr/X11R6/include/X11/Xlib.h:47:
/usr/X11R6/include/X11/Xfuncproto.h:174:24: warning: named variadic macros are a
      GNU extension [-Wvariadic-macros]
#define _X_NONNULL(args...)  __attribute__((nonnull(args)))
                       ^
1 warning generated.

which you won't.

Not relevant to this PR but... I have nedit-ng (built and) working on MacOS Mojave, but the version built on the previous OS High Sierra (with a slightly older version of clang) dies there with an abort. In both cases I'm building against Qt 5.14.1. When I run it under lldb I get this backtrace:

(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
  * frame #0: 0x00007fff6d956b66 libsystem_kernel.dylib`__pthread_kill + 10
    frame #1: 0x00007fff6db21080 libsystem_pthread.dylib`pthread_kill + 333
    frame #2: 0x00007fff6d8b21ae libsystem_c.dylib`abort + 127
    frame #3: 0x00000001012eee39 QtCore`___lldb_unnamed_symbol173$$QtCore + 9
    frame #4: 0x00000001012f0584 QtCore`QMessageLogger::fatal(char const*, ...) const + 202
    frame #5: 0x0000000100148e7c nedit-ng`loadResource(resource=<unavailable>) at Resource.cpp:19 [opt]
    frame #6: 0x00000001001446ef nedit-ng`(anonymous namespace)::loadMenuItemString(QString const&, std::__1::vector<MenuData, std::__1::allocator<MenuData> >&, CommandTypes) [inlined] (anonymous namespace)::loadShellMenuYaml(menuItems=size=0) at userCmds.cpp:465 [opt]
    frame #7: 0x00000001001446b0 nedit-ng`(anonymous namespace)::loadMenuItemString(inString=<unavailable>, menuItems=size=0, listType=Shell) at userCmds.cpp:602 [opt]
    frame #8: 0x00000001000cb98a nedit-ng`Preferences::(anonymous namespace)::translatePrefFormats(fileVer=0) at Preferences.cpp:383 [opt]
    frame #9: 0x000000010008d8ce nedit-ng`Main::Main(this=0x00007ffeefbffa30, args=0x00007ffeefbffa40) at Main.cpp:95 [opt]
    frame #10: 0x000000010013c155 nedit-ng`main(argc=<unavailable>, argv=0x00007ffeefbffa90) at nedit.cpp:130 [opt]
    frame #11: 0x00007fff6d806015 libdyld.dylib`start + 1

If you can suggest a fix I'd be happy to try it.

@eteran
Copy link
Owner

eteran commented Mar 5, 2020

Thanks for this patch.

About the abort, was that the latest master, or a previous version? If it's a previous version, that may have already been fixed in 42ef090 on Feb 28th.

@eteran eteran merged commit aee1538 into eteran:master Mar 5, 2020
@anjohnson anjohnson deleted the macos-tweaks branch March 5, 2020 16:59
@anjohnson
Copy link
Contributor Author

It was the latest master. It occurred to me that my account on this machine has no nedit-ng configuration files at all, and frame 5 of the back-trace implied it was a problem with loading preferences. I copied the binary that was crashing over to my Mojave machine and it worked fine there, so I copied my config.ini and theme.xml files over to the appropriate place on my High Sierra box where it was crashing and I am now able to run it with no problem. Thus it looks like the bug is related to running a recent nedit-ng version on an account with no preferences – you might even be able to replicate this on Linux.

Thanks!

@eteran
Copy link
Owner

eteran commented Mar 5, 2020

OK, I'll take a look at it!

eteran added a commit that referenced this pull request Mar 5, 2020
@eteran
Copy link
Owner

eteran commented Mar 5, 2020

@anjohnson That default pref issue should be fixed! It was only on "generic unix" and "windows" (not linux or freebsd).

Basically, If the file doesn't exist, I load a default from a resource, located by name... well, I got the name wrong in two spots!

Thanks for the report!

@eteran
Copy link
Owner

eteran commented Mar 5, 2020

BTW, regarding the warnings..,

The first two are "tricky" but doable, the issue is that int64_t maps to long on some systems and long long on other systems, and the printf format specifiers are different for those two types. It's functionally harmless, but I'll check into it.

The last warning about _X_NONNULL is unfortunately not in nedit-ng's code, it's in the X11 that apple ships, so it is simply out of my control :-/.

@anjohnson
Copy link
Contributor Author

I don't know if long long maps to something larger than an int64_t on any of today's architectures, but my usual solution is to cast the value to long long and use "%lld" to avoid these particular warnings.

I did say up front that you wouldn't be able to fix the X11/Xfuncproto.h warning...

Thanks for the fix, I have more config files with it than I did before.

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.

2 participants