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

Look into MacOS support. #81

Closed
epasveer opened this issue Aug 9, 2022 · 12 comments
Closed

Look into MacOS support. #81

epasveer opened this issue Aug 9, 2022 · 12 comments

Comments

@epasveer
Copy link
Owner

epasveer commented Aug 9, 2022

Can Seer be built on MacOS?

From a user on Reddit.

It would be nice if it support macOS and maybe even Windows!

https://www.reddit.com/r/cpp/comments/wjoi6b/seer_a_new_gui_frontend_to_gdbmi_updated_v18/

@ernstki
Copy link
Contributor

ernstki commented Oct 6, 2022

Here's a report from the field: the results from a Catalina (macOS 10.15.7) system with qt5-qtbase and qt5-qtcharts installed from MacPorts and the C++ compiler from Xcode 11, clang version 11.0.3.

$ cd build
$ cmake ..
[… routine stuff, until …]
System type isMACOSX_BUNDLE
CMake Error at CMakeLists.txt:213 (install):
  install TARGETS given no BUNDLE DESTINATION for MACOSX_BUNDLE executable
  target "seergdb".


-- Configuring incomplete, errors occurred!
See also "/Users/me/src/developer/seer/src/build/CMakeFiles/CMakeOutput.log".

There didn't seem to be anything noteworthy in CMakeOutput.log, and no mention of "bundle" anywhere, but I can attach it if you think there could be something interesting in there from a platform standpoint.

So the advice seems to be the same as #94, where you mentioned that some tweaking of the CMakeLists.txt might be required. For what it's worth, here's the description of that CMake error, and the reference for MACOSX_BUNDLE.

At the moment, I don't have the wherewithal to try to get CMake to build the app bundle (although I'm sure the solution is out there). However, I can get a working executable by just commenting out one section of the CMakeLists.txt:

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e953d05..6437e96 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -193,12 +193,12 @@ qt5_add_resources(SOURCE_FILES resource.qrc)
 if(NOT CMAKE_BUILD_TYPE MATCHES Debug) #Release, RelWithDebInfo and MinSizeRel
     if(WIN32) # Check if we are on Windows
         set(SYSTEM_TYPE WIN32)
-    elseif(APPLE) # MacOS X
-        set(SYSTEM_TYPE MACOSX_BUNDLE)
-#    else() # UNIX
-#        set(SYSTEM_TYPE EXCLUDE_FROM_ALL)
+        #    elseif(APPLE) # MacOS X
+        #        set(SYSTEM_TYPE MACOSX_BUNDLE)
+    else() # UNIX
+        set(SYSTEM_TYPE EXCLUDE_FROM_ALL)
     endif()
-    message("System type is" ${SYSTEM_TYPE})
+    message("System type is " ${SYSTEM_TYPE})
 endif()
 
 # for Linux, BSD, Solaris, Minix

I haven't kicked the tires on the application yet, but it loads and looks fine, which is 100% better than trying to build a typical GTK application on macOS. So there's that.

Screenshot of Seer running on macOS Catalina

Thanks for making Seer, and keep up the outstanding work!

@epasveer
Copy link
Owner Author

epasveer commented Oct 6, 2022

However, I can get a working executable by just commenting out one section

Thanks for building it on MacOS! I'll test your changes to the CMakeList.txt file. They might be good enough for Mac support.

The UI under MacOS seems to have even more whitespace than Unix. Under Settings->Configuration, you can play around with different fonts.

I'm interested if you see other Qt themes under View->Styles. Or maybe MacOS only allows one?

Please kick the tires around. Let me know of any bugs or suggestions. Thanks for trying Seer.

@ernstki
Copy link
Contributor

ernstki commented Oct 6, 2022

Please kick the tires around. Let me know of any bugs or suggestions.

A couple more things to report after a quick look around:

  • the first couple of times I launched seergdb from a terminal, the menubar wasn't clickable
    • …but that problem appears to have had something to do with the iTerm2 hotkey window I launched Seer from being open in the background; not sure if it's a Qt bug or an iTerm one, but probably nobody else will experience this
  • this is no great surprise, but the /usr/bin/gdb that comes with macOS doesn't work with Seer
    • it's probably super-old (just like the version of Bash that comes with Catalina) and probably doesn't support the --interpreter=mi option
  • I'm not having a tremendous amount of luck specifying quoted arguments (containing whitespace), e.g. -t 'mtime < -2d' $HOME, but that's probably not specific to macOS

As for the gdb situation, I installed gdb from MacPorts, which ends up as /opt/local/bin/ggdb, then updated Seer's settings to use that one instead. When I first tried debugging an executable with the MacPorts gdb, I got two error dialogs, one after the other, with these messages

"Disabling randomization of debuggee's virtual address space is unsupported on this platform."
"Unable to find Mach task port for proces-id 28497: (os/kern) failure (0x5).
(please check gdlb is codesigned - see taskgated(8))"

The first one is apparently harmless; at least it didn't deter me in a simple debugging session, apart from being kind of annoying to have to dismiss every time.

The second—and I should've seen this coming—requires you follow these instructions to code-sign the ggdb executable.

Apart from those minor obstacles, I'm pretty much up-and-running!

@ernstki
Copy link
Contributor

ernstki commented Oct 6, 2022

The UI under MacOS seems to have even more whitespace than Unix. Under Settings->Configuration, you can play around with different fonts.

The "Windows" style under ViewStyles is the most compact, so I've been using that one instead.

Everything looks great regardless of which style, and that's a refreshing change compared to most cross-platform apps, so good choice with Qt.

Screenshot showing Seer main application window on macOS with 'Windows' style

@epasveer
Copy link
Owner Author

epasveer commented Oct 6, 2022

The "Windows" style under View → Styles is the most compact, so I've been using that one instead.

Cool. Good to hear different Qt styles are available on MacOS.

I didn't put the code into Seer yet to save the selected style. I'll do that so the style is remembered for the next time Seer is launched.

@epasveer
Copy link
Owner Author

epasveer commented Oct 6, 2022

The first one is apparently harmless; at least it didn't deter me in a simple debugging session, apart from being kind of annoying to have to dismiss every time.

The default setting for "Start address Randomization" should be configurable in Settings->Configuration->Gdb.

It can be set of "off". Make sure to save the new settings, then restart Seer.

Let me know if it's still a problem.

@epasveer
Copy link
Owner Author

epasveer commented Oct 6, 2022

requires you follow these instructions to code-sign the ggdb executable.

I suppose that is a MacOS thing.

What version is it?

/usr/local/bin/ggdb --version

@epasveer
Copy link
Owner Author

epasveer commented Oct 6, 2022

I'm not having a tremendous amount of luck specifying quoted arguments (containing whitespace), e.g. -t 'mtime < -2d' $HOME, but that's probably not specific to macOS

To confirm, you mean when you debug your program like this:

$ seergdb -s myprog -t 'mtime < -2d' $HOME

Or are you using Seer's debug dialog box?

I suspect you want $HOME to be expanded by something (the gdb process) and 'mtime < -2d' to be treated as one argument to your program, and not three.

@ernstki
Copy link
Contributor

ernstki commented Oct 7, 2022

The default setting for "Start address Randomization" should be configurable in Settings->Configuration->Gdb.

The version of gdb I have is 11.2. Neither the --sar yes option nor checking the "Randomize start address" checkbox seem to make a difference. I don't have anything about randomization in my ~/.gdbinit, which is where the Internet says I should look for set disable-randomization on. If I do put that in my ~/.gdbinit, I definitely get that error on macOS, and it looks like this when I just run gdb from the terminal

/Users/me/.gdbinit:18: Error in sourced command file:
Disabling randomization of debuggee's virtual address space is unsupported on
this platform.

I didn't go digging too deeply into gdb's code to see if there could be some other cause, just enough to ascertain that the message actually was coming from gdb itself and not Seer.

It's a pretty minor annoyance, though, as the dialog can be dismissed by just pressing Enter. It's not a show-stopper.

I suppose that is a MacOS thing.

It is indeed a Mac thing, and it's well documented, and the MacPorts "port notes" reminds you to do this when you install the gdb package. I don't think it's anything you or Seer itself need to officially worry about.

Or are you using Seer's debug dialog box?

That is what I was attempting to do (the argument to -t needed to be a quoted string), and I actually can't reproduce it anymore, so… who knows. Probably operator error.

Thanks for the follow-ups. I'm actually all set for now, and if I end up doing some more fiddling and getting CMake to build an actual app bundle, I'll post an update.

@epasveer
Copy link
Owner Author

epasveer commented Oct 7, 2022

Hi. Okay. Cool.

For now, I've updated the CMakefileList.txt with your change. I also made the Qt Style saveable with "Setttings->SaveConfiguration".

Another person asked for this as well. So I might as well implement it.

@ernstki
Copy link
Contributor

ernstki commented Oct 7, 2022

Cool, thanks! Cheers!

@epasveer
Copy link
Owner Author

Closing task. I new task can be created, if needed.

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

No branches or pull requests

2 participants