eteran / nedit-ng

a Qt5 port of the NEdit using modern C++14
GNU General Public License v2.0
96 stars 26 forks source link

QT version 5.5 or 5.15? #331

Open drnickallgood opened 2 years ago

drnickallgood commented 2 years ago

Trying to build this on my arm mac and having some difficulty. It seems you mention 5.5 as the min QT version but in homebrew it goes up to 5.15. I also check qt's main website and they don't have a version 5.5.. just 5.15, then on to 6.3.0..

Here's just the beginning snippet:

In file included from /Users/nick/nedit-ng/Regex/Regex.cpp:80: In file included from /Users/nick/nedit-ng/Regex/Regex.h:6: In file included from /Users/nick/nedit-ng/Regex/RegexError.h:5: In file included from /Users/nick/nedit-ng/Util/include/Util/Compiler.h:5: In file included from /opt/homebrew/Cellar/qt@5/5.15.3/lib/QtCore.framework/Headers/QtGlobal:1: /opt/homebrew/Cellar/qt@5/5.15.3/lib/QtCore.framework/Headers/qglobal.h:399:11: error: 'maybe_unused' attribute cannot be applied to types constexpr Q_DECL_UNUSED Deprecated_t Deprecated = {}; ^ In file included from /Users/nick/nedit-ng/Regex/Regex.cpp:80: In file included from /Users/nick/nedit-ng/Regex/Regex.h:6: In file included from /Users/nick/nedit-ng/Regex/RegexError.h:5: In file included from /Users/nick/nedit-ng/Util/include/Util/Compiler.h:5: In file included from /opt/homebrew/Cellar/qt@5/5.15.3/lib/QtCore.framework/Headers/QtGlobal:1: /opt/homebrew/Cellar/qt@5/5.15.3/lib/QtCore.framework/Headers/qglobal.h:399:11: error: 'maybe_unused' attribute cannot be applied to types constexpr Q_DECL_UNUSED Deprecated_t Deprecated = {}; ^ /opt/homebrew/include/QtCore/qcompilerdetection.h:1100:27: note: expanded from macro 'Q_DECL_UNUSED'

define Q_DECL_UNUSED [[maybe_unused]]

drnickallgood commented 2 years ago

Attaching log

out.log

eteran commented 2 years ago

Interesting. Qt 5.15 should be fine. This largely looks like perhaps there is a compiler issue of some kind.

It is complaining about what appears to be valid constructs so maybe it's not detecting that it can enable C++14 mode.

I'll look at it after the weekend.

drnickallgood commented 2 years ago

Thanks, I was hoping to get a chance to look at this more too the weekend, but we'll see.

anjohnson commented 2 years ago

I have nedit-ng (commit d417b1e0110526acaecddf326288dd1639df3a97) built against Qt 5.15.3 from Homebrew on an M1 MacBook Pro. One thing I did discover is that having Qt6 installed as well can prevent it building properly against Qt5, so I recommend uninstalling Qt6 and trying again.

drnickallgood commented 2 years ago

I want to say I set the env variables to use QT5 , with just QT6 I didn't even get that far

anjohnson commented 2 years ago

Do you still have Qt6 installed though? I think I had to uninstall it for the build to work, even when pointing to Qt5. Worth trying if you can (I might have had to reinstall Qt5 afterwards as well to ensure soft-links were pointing to the right places, but there might be simpler ways to do that if you know Homebrew better than I do).

drnickallgood commented 2 years ago

Ill def try it soon

drnickallgood commented 2 years ago

Had a bit of time , removed qt6 and it seems I get some different errors now:

In file included from /opt/homebrew/include/boost/type_traits/is_function.hpp:19: /opt/homebrew/include/boost/type_traits/detail/is_function_cxx_11.hpp:105:38: error: expected ',' or '>' in template-parameter-list template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> ^ /opt/homebrew/include/boost/type_traits/detail/is_function_cxx_11.hpp:22:40: note: expanded from macro 'BOOST_TT_NOEXCEPT_PARAM'

define BOOST_TT_NOEXCEPT_PARAM , bool NE

                                   ^

/Users/nick/nedit-ng/build/Interpreter/parser.cpp:131:12: note: expanded from macro 'NE'

define NE 282

       ^

fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. gmake[2]: [Interpreter/CMakeFiles/Interpreter.dir/build.make:111: Interpreter/CMakeFiles/Interpreter.dir/parser.cpp.o] Error 1 gmake[1]: [CMakeFiles/Makefile2:446: Interpreter/CMakeFiles/Interpreter.dir/all] Error 2 gmake: *** [Makefile:166: all] Error 2

anjohnson commented 2 years ago

What version of Bison are you using? The one provided by Apple no longer works with recent nedit-ng versions, so you may need to install a newer one with Homebrew. IIRC that was causing problems in the Interpreter build since that's what was using the new stuff, and that's where your errors seem to be coming from.

Have you read the latest parts of the Wiki page about building on MacOS? I added the Makefile there which is how I do my builds, and I recommend trying that. The only lines you should need to adjust would be the settings for HOMEBREW and PREFIX.

drnickallgood commented 2 years ago

I didn't see the mac makefile, but I did just try it and didn't have any luck.

I do have the homebrew bison:

bison --version bison (GNU Bison) 3.8.2 Written by Robert Corbett and Richard Stallman.

Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

which bison /opt/homebrew/opt/bison/bin/bison

Makefile was added to nedit-ng/Makefile

still similar issues when trying to use just the Makefile

In file included from /opt/homebrew/include/boost/type_traits/is_function.hpp:19: /opt/homebrew/include/boost/type_traits/detail/is_function_cxx_11.hpp:105:38: error: expected ',' or '>' in template-parameter-list template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> ^ /opt/homebrew/include/boost/type_traits/detail/is_function_cxx_11.hpp:22:40: note: expanded from macro 'BOOST_TT_NOEXCEPT_PARAM'

define BOOST_TT_NOEXCEPT_PARAM , bool NE

                                   ^

/Users/nick/nedit-ng/build/Interpreter/parser.cpp:131:12: note: expanded from macro 'NE'

define NE 282

       ^

fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. gmake[3]: [Interpreter/CMakeFiles/Interpreter.dir/build.make:111: Interpreter/CMakeFiles/Interpreter.dir/parser.cpp.o] Error 1 gmake[3]: Leaving directory '/Users/nick/nedit-ng/build' gmake[2]: [CMakeFiles/Makefile2:446: Interpreter/CMakeFiles/Interpreter.dir/all] Error 2 gmake[2]: Leaving directory '/Users/nick/nedit-ng/build' gmake[1]: [Makefile:166: all] Error 2 gmake[1]: Leaving directory '/Users/nick/nedit-ng/build' gmake: [Makefile:34: all] Error 2

drnickallgood commented 2 years ago

I actually got further, i had to nuke my build directory, replace the makefile with the one suggested, and re-follow the instructions:

[100%] Linking CXX executable ../nedit-import ld: warning: directory not found for option '-L/usr/X11/lib' ld: warning: directory not found for option '-L/opt/X11/lib' ld: library not found for -lX11 clang: error: linker command failed with exit code 1 (use -v to see invocation) gmake[2]: [import/CMakeFiles/nedit-import.dir/build.make:111: nedit-import] Error 1 gmake[1]: [CMakeFiles/Makefile2:474: import/CMakeFiles/nedit-import.dir/all] Error 2

Interesting that libX11 is still needed for this port?

anjohnson commented 2 years ago

Which version of nedit-ng are you building? It doesn't look like it has been needed since February, so try building the tip of the master branch:

commit c2fea1acb2d1025e0ca0d49a4d663065fc1ebe34
Author: Evan Teran <evan.teran@gmail.com>
Date:   Thu Feb 24 08:18:57 2022 -0500

    don't lnik to X11 since we don't need to anymore
    improved backport of screenAt
drnickallgood commented 2 years ago

Hmm, I just did git clone from the master branch code I believe

anjohnson commented 2 years ago

Hmm, I just tried a build from scratch and now I'm also getting that build failure:

[ 41%] Building CXX object import/CMakeFiles/nedit-import.dir/import.cpp.o
[ 41%] Automatic MOC and UIC for target nedit-ng
In file included from /Users/anj/Software/other/nedit-ng/import/import.cpp:386:
In file included from /opt/homebrew/include/X11/Xresource.h:53:
In file included from /opt/homebrew/include/X11/Xlib.h:47:
/opt/homebrew/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.
[ 42%] Linking CXX executable ../nedit-import
ld: warning: directory not found for option '-L/usr/X11/lib'
ld: warning: directory not found for option '-L/opt/X11/lib'
ld: library not found for -lX11
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[3]: *** [import/CMakeFiles/nedit-import.dir/build.make:111: nedit-import] Error 1
...

It looks like I disabled building the nedit-import program which may be the only part that needs the X11 libraries. My build succeeds (but with lots of C++17 warnings from Clang) after this change:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b6b8846d..1bcd8de6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -76,6 +76,6 @@ add_subdirectory(Interpreter)
 if(UNIX)
     find_package(X11)
     if(${X11_FOUND})
-        add_subdirectory(import)
+#        add_subdirectory(import)
     endif()
 endif()

If you need to import settings from older configuration files you might have to do that part on a Linux system that has nedit-import build working. If not this should be sufficient to get a working editor.

eteran commented 2 years ago

Thanks for looking into this guy's. I've been stuck in an airport the past 24 hours but once I finally get home we'll get you all sorted out!

I think the X11 stuff is an easy fix 😁

drnickallgood commented 2 years ago

Awesome this worked now! I got it to build between the Makefile and removal of the libX11 part.

Oddly enough I had libX11 from homebrew but it didn't seem like it liked it, for whatever reason.

drnickallgood commented 2 years ago

Random but i recall the nedit of days old has a motif like scheme / color to it, anyone recall the background/foreground hex codes?

anjohnson commented 2 years ago

@profallgood It's probably more appropriate to ask that in the Discussions area. The subject line here doesn't match the final problem, but @eteran may use this issue as a reminder to fix the macOS build problem.

eteran commented 2 years ago

@profallgood I can certainly look them up when I'm back at my comp. It's in the git history for sure since I didn't change the color scheme right away.

drnickallgood commented 2 years ago

Fair enough, was just a random thought, I can dig around for it later, but yea hopefully this can stay open as a reminder and then the build problem gets fixed, assuming that's the case.

eteran commented 2 years ago

@profallgood OK, so to get a more "classic" color scheme, you can use the following theme.xml file.

<?xml version="1.0" encoding="UTF-8"?>
<theme name="default">
 <text foreground="#221f1e" background="#d6d2d0"/>
 <selection foreground="#ffffff" background="#43ace8"/>
 <highlight foreground="#ffffff" background="#ff0000"/>
 <cursor foreground="#000000"/>
 <line-numbers foreground="#000000" background="#d6d2d0"/>
 <style name="Plain" foreground="black" font="Plain"/>
 <style name="Comment" foreground="gray20" font="Italic"/>
 <style name="Keyword" foreground="black" font="Bold"/>
 <style name="Operator" foreground="dark blue" font="Bold"/>
 <style name="Bracket" foreground="dark blue" font="Bold"/>
 <style name="Storage Type" foreground="brown" font="Bold"/>
 <style name="Storage Type1" foreground="saddle brown" font="Bold"/>
 <style name="String" foreground="darkGreen" font="Plain"/>
 <style name="String1" foreground="SeaGreen" font="Plain"/>
 <style name="String2" foreground="darkGreen" font="Bold"/>
 <style name="Preprocessor" foreground="RoyalBlue4" font="Plain"/>
 <style name="Preprocessor1" foreground="blue" font="Plain"/>
 <style name="Character Const" foreground="darkGreen" font="Plain"/>
 <style name="Numeric Const" foreground="darkGreen" font="Plain"/>
 <style name="Identifier" foreground="brown" font="Plain"/>
 <style name="Identifier1" foreground="RoyalBlue4" font="Plain"/>
 <style name="Identifier2" foreground="SteelBlue" font="Plain"/>
 <style name="Subroutine" foreground="brown" font="Plain"/>
 <style name="Subroutine1" foreground="chocolate" font="Plain"/>
 <style name="Ada Attributes" foreground="plum" font="Bold"/>
 <style name="Label" foreground="red" font="Italic"/>
 <style name="Flag" foreground="red" font="Bold"/>
 <style name="Text Comment" foreground="SteelBlue4" font="Italic"/>
 <style name="Text Key" foreground="VioletRed4" font="Bold"/>
 <style name="Text Key1" foreground="VioletRed4" font="Plain"/>
 <style name="Text Arg" foreground="RoyalBlue4" font="Bold"/>
 <style name="Text Arg1" foreground="SteelBlue4" font="Bold"/>
 <style name="Text Arg2" foreground="RoyalBlue4" font="Plain"/>
 <style name="Text Escape" foreground="gray30" font="Bold"/>
 <style name="LaTeX Math" foreground="darkGreen" font="Plain"/>
 <style name="Pointer" foreground="#660000" font="Bold"/>
 <style name="Regex" foreground="#009944" font="Bold"/>
 <style name="Warning" foreground="brown2" font="Italic"/>
</theme>

I can say that this will basically only apply to the text area. The Qt widgets and window treatment has its own theming that is highly editable via a style.css file that can be edited. But to make that look more like Motif is a big (but technically doable) effort.