Wednesday, October 26, 2016

Install Minimum Profit on OpenIndiana

For fun and minimum profit.

In order to achieve this, there are a few prerequisites.[1]

  • First and foremost, ensure you have pkg-config installed
  • Determine your interface and install the required libraries. MP supports ncurses, Qt4 and GTK. For this guide, I will be using Qt4
  • Setup your C++ environment. We will be using the Gnu compilers. See here for detailed instructions. The OpenSolaris Bible suggests # pkg install gcc-dev, however I did not get to test that[2].
  • Have the latest version of mp ready for installation. At the time of this writing, it is v5.2.10

Preparing the environment

To setup the pre-requisites

# pkg install pkg-config
# pkg install library/qt4
# pkg install developer/build/gnu-make
# pkg install developer/build/make
# pkg install developer/gcc-48
# pkg install system/header
# pkg install developer/build/autoconf
# pkg install developer/build/automake-115

Of course you could run that as a one-liner, however install them seperately just in case there are any issues, you can deal with them as they come up.

A few things to ensure your environment is working [3]
  • Create a cpp file and test that it compiles. Paste the code below into a file called configtest.cpp

    #include <iostream>
    int main(int argc, char** argv)
    {
      std::cerr << "C++ is installed correctly" << std::endl;
    }

  • Then test it out

    $ CC -o configtest configtest.cpp
    $ ./configtest
    C++ is installed correctly

If you recieved anything apart from the aforementioned output, a mess was made somewhere and needs to be rectified.

Installing MP

Yes the instructions are on the github page and they are for the most part all you need to do once everything is in place. Unfortunately, for me it needed additional tweaking.

The tweaks I made can be found on my repo

In the meantime, here are the details.

  • I will be installing to /usr/bin.

    $ ./config.sh --without-gtk --prefix /usr/bin

    After that completes, I made some changes to all three Makefiles. The default prefix is /usr/local and while you can change that from the command line, they were set up to have /bin/ hardcoded on the install path, so at the final installation, I got errors saying it could not install to path /usr/bin/bin/mpsl as an example.

    So I edited the all the Makefiles that were generated and removed the /bin/, as an example:

    From
    install: $(INSTALL_MSG) installdoc $(INSTALLMO)
      install $(APPNAME) $(PREFIX)/bin/$(APPNAME)


    To
    install: $(INSTALL_MSG) installdoc $(INSTALLMO)
      install $(APPNAME) $(PREFIX)/$(APPNAME)

  • Next step, $ gmake

    If you get the following error

    fatal error: symbol belongs to implicit dependency /lib/libsocket.so.1

    then you need to add the following to your config.ldflags files, -lnsl -lsocket. Make sure those linker flags are on their own line, I placed them on the last line. I also edited config.sh to do this for me[4].

    You will get a lot of warnings, but the final message you are looking for is done. Once you see that, you are ready for the final step.

  • Final step

    # gmake install

There have been a lot of ifs up to this point, but you are on the final leg, if everything worked out so far and there are no further issues, then you can start using mp by executing $ mp-5. Otherwise, the error messages are pretty straightforward here and you can further tweak accordingly. Any error messages can be fixed from the first two steps, the most common one for me was the incorrect installation path /usr/bin/bin/mp-5

Enjoy!

Conclusion

I learnt alot from this experience, and all I wanted was to just use this lovely editor on my shiny new OpenIndiana! I hope this saves you some time if you want to test out this lovely gem of an editor, it took me three days of troubleshooting, from finding out about this editor to actually writing this post within it.

Post Conclusion

Oh yes, I almost forgot. This is my mp configuration

mp.config.font_face = "mononoki";
mp.config.font_size = 12;


/* Solarized Qt Colors: https://github.com/altercation/solarized/tree/master/qtcreator
or as close as I could get it */
mp.colors.normal.gui = [ 0x657b83, 0xfdf6e3 ];
mp.colors.cursor.gui = [ 0x657b83, 0xfdf6e3 ];
mp.colors.selection.gui = [ 0xeee8d5, 0x93a1a1 ];
mp.colors.comments.gui = [ 0x93a1a1, 0xfdf6e3 ];
mp.colors.documentation.gui = [ 0x6c71c4, 0xfdf6e3 ];
mp.colors.quotes.gui = [ 0x2aa198, 0xfdf6e3 ]; /* Text between quotes / variables */
mp.colors.matching.gui = [ 0xeee8d5, 0xb58900 ];
mp.colors.word1.gui = [ 0x002B36, 0xfdf6e3 ]; /* 1st definition for special words (i.e. tokens).keywords */
mp.colors.word2.gui = [ 0x2aa198, 0xfdf6e3 ]; /* 2nd definiton for special words (i.e. variables) */
mp.colors.word3.gui = [ 0x002B36, 0xfdf6e3 ]; /* Parens / Operators */
mp.colors.tag.gui = [ 0xCB4B16, 0xfdf6e3 ]; /* Color for tags (symbol names) */
mp.colors.search.gui = [ 0x657b83, 0xFFFFB0 ];

Pretty barebone, but I am still learning. If you have an interest in mp, any experiences or have an amazing config, please share!

Till next time, may the Lord bless you and everything that you do.

References:

[1] Your IPS is up to date rigth? # pkg update
[2] Truth be told, I saw that AFTER I got everything working. I used the Solaris 11
instructions as found in the detailed stackexchange article
[3] Modified from Programming against ArcObjects with C++
[4] Explanations and solutions to this type of error, can be found here and here

No comments:

Post a Comment