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

Port cool-old-term to OSX #12

Closed
svileng opened this issue Jul 29, 2014 · 87 comments
Closed

Port cool-old-term to OSX #12

svileng opened this issue Jul 29, 2014 · 87 comments

Comments

@svileng
Copy link

svileng commented Jul 29, 2014

On behalf of all MacOSX users - could you please add it to Homebrew?

Thanks!

@Swordfish90
Copy link
Owner

Sadly I don't have a Mac and nor any knowledge related to Homebrew... Anyhow did anyone tried if this is is working on OSX?

@benmoss
Copy link

benmoss commented Jul 29, 2014

I tried and got an error relating to KDE, I didn't delve into installing KDE on OSX.

file:///Users/moss/code/cool-old-term/app/main.qml:26 module "org.kde.konsole" is not installed

@jpmhouston
Copy link

I believe this is inappropriate for homebrew. For OSX, the correct thing would be to package as an app, not as a command-line executable in /usr/local/
https://github.com/Homebrew/homebrew/wiki/Acceptable-Formulae

@Swordfish90
Copy link
Owner

This software has absolutely no dependencies with KDE and the Konsole plugin is self contained.
The error you see happens because qmlscene can't locate the plugin. This could be caused by a build error (please paste the output of qmake && make && make install) or by a problem with the path.

I will leave this thread open if we have any news on cool-old-term on OSX. The problem of packaging it will be relevant only afterward.

@Swordfish90 Swordfish90 changed the title Add to Homebrew (MacOSX) Port cool-old-term to OSX Jul 29, 2014
@tovbinm
Copy link

tovbinm commented Jul 30, 2014

I guess it's better to make a dmg instead, since installing qt and xcode on the machine will eat up to 10gb. A weekend project?! ;)

@razum2um
Copy link

the project isn't compiled currently on macos 10.9 qt 5.3.1
see make log: https://gist.github.com/razum2um/0d40e89f3eddb2a5c8b5

@aacalfa
Copy link

aacalfa commented Jul 30, 2014

Hello, I am having the same errors as razum2um. Can anyone help please? :(

@ghost
Copy link

ghost commented Jul 31, 2014

when I compile it I get the exact same errors as razum2um
http://dpaste.com/15Y2F3X
I might try to get this working on the weekend if i can find the time to do so.

@ways
Copy link

ways commented Jul 31, 2014

Mac users can look at http://www.secretgeometry.com/apps/cathode/ while they wait. =)

@ghost
Copy link

ghost commented Jul 31, 2014

nice find ways.

@AYastrebov
Copy link
Contributor

The same issues on OS X
OS X 10.9.4, Qt 5.3.1

https://gist.github.com/AYastrebov/70e015ff49a5165fcfeb

@haakonnessjoen
Copy link

One of the problems is that setutent() is not supported on BSD platforms, such as OS X. So one must manually open _PATH_UTMP etc. instead of using setutent(), if I don't recall wrong.

@haakonnessjoen
Copy link

Look at the getutent()/setutent() routines in this file for example: http://ftp.ics.uci.edu/pub/centos0/ics-custom-build/BUILD/rsyslog-3.19.8/tools/omusrmsg.c

@guitorri
Copy link

Can the missing functions be added for compatibility? It seems to have worked for this project: https://trac.osgeo.org/qgis/ticket/2021

@aacalfa
Copy link

aacalfa commented Jul 31, 2014

OK, I followed guitorri suggestion and I was able to compile everything. However, I could not pass through linking phase. I get the following error:
Undefined symbols for architecture x86_64:
"KTerminalDisplay::banana(int, int, int, int)", referenced from:
KTerminalDisplay::qt_static_metacall(QObject_, QMetaObject::Call, int, void_*) in moc_TerminalDisplay.o

Indeed, I can see there's the declaration of the method called "banana" (What the hell is that btw??)
in file TerminalDisplay.h, although it is NOT implemented anywhere in TerminalDisplay.cpp. I wonder how this worked fine when I compiled this same application on Linux Mint. Does anyone have any ideas?

Actually, I know this is wrong but I did the following workaround: I simply put a dummy method banana in TerminalDisplay.cpp. Compiled again and it created the executable. The result is the file I attached. The terminal is all blurry, I can't read anything from it... Hope this helped you guys understand a little bit better what is missing.

screen shot 2014-07-31 at 11 38 36 am

@guitorri
Copy link

Nice @aacalfa !
Can you share the changes you did so far?

@Swordfish90
Copy link
Owner

Ahahah... When I experiment I sometimes use names of fruits that's definitely my bad!... It is really strange that this doesn't appear among the warnings in linux. Will fix that!

@Swordfish90
Copy link
Owner

Anyway what you see is a huge progress. The blurriness is due to the fact that the main terminal is not drawn, but only the bloom effect. This means that the terminal itself works so maybe the c++ side is fine but there is a problem with one of the shaders. Can you post the output of the application?

@aacalfa
Copy link

aacalfa commented Jul 31, 2014

Here are my changes: aacalfa@c612a1d

The output is this: Using an unsupported variable-width font in the terminal. This may produce display errors.
loadAllColorSchemes
Using an unsupported variable-width font in the terminal. This may produce display errors.
qml: Loading settings: {"fontIndexes":[0,2,0],"fontScalingIndexes":[5,1,1],"fps":0,"frameReflections":true,"show_terminal_size":true,"window_scaling":1}{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.5,"brightness":0.5,"brightness_flickering":0.2,"contrast":0.85,"fontIndex":2,"font_color":"#2fff91","frames_index":1,"glowing_line_strength":0.22,"horizontal_sincronization":0.08,"jitter":0.1,"motion_blur":0.65,"noise_strength":0.08,"rasterization":1,"screen_distortion":0.18,"windowOpacity":1}
QOpenGLFramebufferObject: Unsupported framebuffer format.
QOpenGLFramebufferObject: Framebuffer incomplete, missing attachment.
QOpenGLFramebufferObject: Unsupported framebuffer format.
QOpenGLFramebufferObject: Framebuffer incomplete, missing attachment.
QOpenGLFramebufferObject: Unsupported framebuffer format.
QOpenGLFramebufferObject: Framebuffer incomplete, missing attachment.

@Swordfish90
Copy link
Owner

Ok good... Sadly I have no time right now. But open the file PreprocessedTerminal.qml and comment all the lines: format: ShaderEffectSource.Alpha (there should be three of them).

@guitorri
Copy link

It might be necessary to wrap the compatibility functions to avoid redefinition errors.
Something like:

#if defined(__APPLE__)
  [compatibility functions]
#endif 

I'm getting Qt5 to see if I can help further...

@aacalfa
Copy link

aacalfa commented Jul 31, 2014

IT WORKED! Thanks Swordfish90. I just commented those 3 lines and here's the result!!

I also pushed it to my version: d063e88

screen shot 2014-07-31 at 12 13 43 pm

@guitorri
Copy link

Soooo coool! Can't wait to build it. Nice job @aacalfa ! 👍

@Swordfish90
Copy link
Owner

Thank you very much for your contribution @aacalfa ... In just a day we have a working version for OSX. Awesome! When you are done please make a pull request (without the workaround, this issue seems more hardware/opengl related, so it needs a proper fix) and I will happily integrate that.
Thanks again.

@aacalfa
Copy link

aacalfa commented Jul 31, 2014

No problem @Swordifish90 , I am really happy that I could help you with that! I don't really get what you mean though. Without which workaround? I'll list everything I did:
1 - Modified kpty.cpp, by putting the implementations of utmp.h functions.
2 - Created a dummy banana method to get through linking.
3 - Commented the 3 ShaderEffectSource.Alpha occurrences in PreprocessedTerminal.qml

Which workarounds do you mean?

@Swordfish90
Copy link
Owner

  1. This is awesome.
  2. This shows I'm an idiot, so leave it! :D I will clean it later.
  3. This is the workaround I was talking about. It is basically an optimization that saves a decent amount of GPU memory, but It is not compatible with some opengl implementations. So I need to find a way to set it depending on the hardware.

@aacalfa
Copy link

aacalfa commented Jul 31, 2014

Done :)

@aacalfa
Copy link

aacalfa commented Jul 31, 2014

Oh btw I see only one bug so far.As you can see from the last picture I uploaded, the terminal is not printing my current directory, it always print bash3.2$
What could it be?

@LinusU
Copy link

LinusU commented Aug 5, 2014

No, all it does is creating a .dmg image around a .app file. I thought that macdeployqt was used to get the .app file (which really is a folder) and after that appdmg can be used to create the dmg. If macdeployqt does everything then that sounds like the best solution.

@guitorri
Copy link

guitorri commented Aug 5, 2014

Yes macdeployqt has a -dmg option. I don't know how nice the generated .dmg looks compared to appdmg. The thing is that macdeployqt is not yet in use. The first thing is to create the Mac bundle and copy/deploy all the needed frameworks in there. Now there is just a bunch of .qml files. I am not yet familiar with Qt5 and QML... Someone?

@ghost
Copy link

ghost commented Aug 5, 2014

hmm I built mine on 10.10 DP4

@LinusU
Copy link

LinusU commented Aug 5, 2014

@vs37nx Where did you get qmake from? Did you maybe install QT thru homebrew before updating to 10.10?

@ghost
Copy link

ghost commented Aug 5, 2014

yeah I did

@keynslug
Copy link

keynslug commented Aug 5, 2014

It seems that utmpx family of functions are available on Mac OS X. That's the first thing I have tried when started to build the project being incapable of handling my curiosity.

Turning on -DHAVE_UTMPX, turning off -DHAVE_UPDWTMPX in the autogenerated Makefile and replacing occasional accesses to a ut_name with ut_user in the kpty.cpp were enough for me to make it work great, well if I could make such point yet considering my only 16 and counting minutes of overwhelming ecstasy.

@LinusU
Copy link

LinusU commented Aug 6, 2014

qt5 seems to be working on 10.10 now, hurray! I couldn't get the actual app to build though.

I used the latest commit from @aacalfa's repository. @vs37nx which patches did you use to work around the utmp related problems?

@LinusU
Copy link

LinusU commented Aug 6, 2014

Scratch that, got it working! 🎆

  1. brew install qt5
  2. PATH=/usr/local/opt/qt5/bin:$PATH

.

  1. Cloned this repo
  2. qmake
  3. Turning on -DHAVE_UTMPX, turning off -DHAVE_UPDWTMPX in the auto generated Makefile.
  4. Replacing occasional accesses to a ut_name with ut_user in the kpty.cpp
  5. Insert void KTerminalDisplay::banana(int x, int y, int z, int w) in src/TerminalDisplay.cpp

main.qml:26 module "org.kde.konsole" is not installed is fixed by running make install inside konsole-qml-plugin.

@Swordfish90
Copy link
Owner

@aacalfa I think that simply commenting flags won't be a good solution. Transparency should not work anymore (surely not under linux).

Edit: I was wrong. Transparency works under linux even without flags. I think we are lucky enough and the solution is really to remove that line :D .

@aacalfa
Copy link

aacalfa commented Aug 6, 2014

@Swordifish90 haha yeah well it still works in OS X too!

@yackx
Copy link

yackx commented Aug 12, 2014

@LinusU With current master branch (#4a7e23), no need for steps 3, 4 and 5! Now it just works.

Cannot resize or move the window though. This is a very nice, super cool old terminal 😎

@lwdallas
Copy link

@Swordfish--THANK YOU! This is sweet--Atari ST page white. Any update on the move issue?
screen shot 2014-08-25 at 1 55 02 pm

@Swordfish90
Copy link
Owner

@lwdallas You are welcome!... The missing topbar feature has been fixed but I've never pushed the patch. I will do that as soon as I can. Moreover you will be happy to know that I purchased a macbook pro to replace my old laptop. So, even though I'm mainly using ubuntu on it, I can now be an active part in the OSX port process.

@sirgatez
Copy link

MacOSX appear to expect a different type of shell than Linux in general.
Linux: interactive, non-login
MacOSX: interactive, login
Reference: https://github.com/sstephenson/rbenv/wiki/Unix-shell-initialization

To patch for MacOSX:
Edit: konsole-qml-plugin/src/Session.cpp
Goto function "void Session::run()"
Right below "arguments << exec;"
Add the following two lines:
arguments.append("-i");
arguments.append("-l");

This tells the designated shell to start with -i (interactive), and -l (login).
For: konsole-qml-plugin, make clean;make;make install
For cool-retro-term, make clean;make;open ./cool-retro-term.app

ToDo: Add check to see if host is MacOSX and add the arguments dynamically on start if so (that or define during compile time).
image

@sirgatez
Copy link

Update:
Add the following below: "arguments << exec;"

QString macosxver = "/usr/bin/sw_vers";
QFile excheck2(macosxver);
if ( excheck2.exists() ) {
    arguments.append("-i");
    arguments.append("-l");
}

"/usr/bin/sw_vers" is a MacOSX specific tool for reporting the OS version on the command line, it should only exist on such systems, so testing for it's presence is a good indicator of the system type we're running on. (if you rename the file and restart the app then it will assume non-apple and start without appending "-i -l" to the shell.)

@maandree
Copy link

Couldn't it be possible to use the uname function (uname(2))?

@sirgatez
Copy link

Yes, and no, uname will return the kernel information such as what kernel are we running, nothing about the Distro.

MacOSX: uname -a
Darwin XXXHOSTNAMEXXX 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun 3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64

The Darwin kernel however is not MacOSX, as Darwin can and is used for other distros besides MacOSX. I do not know if other Darwin based operating systems experience this same issue with login shells or not.

http://en.wikipedia.org/wiki/Darwin_(operating_system)

I do not think "-l -i" would interfere with other Darwin derivatives either, but I would rather not blanket all Darwin kernel systems the same way without testing and knowing for the same reason I would rather not append "-l -i" to all linux shells even though it would work.

Btw, the better way to define this is with compile time options to detect the OS and only enable the appends if the app was compiled (on/for?) MacOSX but I haven't tried that option yet. This is more of a hack to make it work when it should and not when it shouldn't for the time being.

@maandree
Copy link

Yeah, you are right, uname does not include the OS, it is just a GNU extension that the uname command prints GNU/Linu.x. However, I'm always for selecting the OS at compile-time.

@Swordfish90
Copy link
Owner

@sirgatez Thank you for the suggestion. When I tested it I was forcing login with "login -f $USER" but this is way nicer. I agree that this should be decided at compile time and should not interfere with other OSs.

@pajtai
Copy link

pajtai commented Oct 2, 2014

it built from the osx branch - very nice!

screen shot 2014-10-02 at 10 33 35

@razum2um
Copy link

razum2um commented Oct 3, 2014

thanks, it works!

perhaps it should be noticed, that you must do "make install" but it would just copy console plugin in the right place, not touching the system

@alexgorbatchev
Copy link

Could somebody make a DMG please? I tried installing qt5 and gave up after 1.5 hours of ./make... Thank you in advance!

@miuirussia
Copy link

Please, update to latest master branch

@Swordfish90
Copy link
Owner

Yesterday, a patch has landed in master which makes crt build under osx with minimal changes (We are talking about 10 lines of code). So I suggest everyone from now on to take it directly from master. I'll leave the branch open until we take the good part from it.

@miuirussia
Copy link

We are talking about 10 lines of code.

Which changes need?

@Swordfish90
Copy link
Owner

@miuirussia a78231e . Let's say that the previous solution was a little bit over-engineered :)

@rjmunro
Copy link

rjmunro commented Oct 17, 2014

With the latest master 08ade0e I find that I can't type anything except by copying from elsewhere and pasting using the menu. The last version I tried (4a7e23f) didn't have this issue.

@Swordfish90
Copy link
Owner

Hello everyone I think this ticked can be close right now. With the RC1 OS X support is finally complete.

https://github.com/Swordfish90/cool-retro-term/releases/tag/v1.0.0-RC1 (There is also a DMG file).

Thank you very much for all the people who helped with the porting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests