Coder Social home page Coder Social logo

Compilation error on Ubuntu 18.04 about mtm HOT 7 CLOSED

deadpixi avatar deadpixi commented on August 15, 2024 1
Compilation error on Ubuntu 18.04

from mtm.

Comments (7)

szabozoltan69 avatar szabozoltan69 commented on August 15, 2024

For me the same.

$ make
cc -std=c99 -Wall -Wextra -pedantic -Os -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED -o mtm  vtparser.c mtm.c  -lncursesw -lutil
/tmp/ccnurCA8.o: In function `sgr':
mtm.c:(.text+0x187c): undefined reference to `alloc_pair'
/tmp/ccnurCA8.o: In function `rc':
mtm.c:(.text+0x19f7): undefined reference to `alloc_pair'
collect2: error: ld returned 1 exit status
Makefile:14: recipe for target 'mtm' failed
make: *** [mtm] Error 1

from mtm.

fcpg avatar fcpg commented on August 15, 2024

It works on 19.04, fwiw.

from mtm.

Asuza avatar Asuza commented on August 15, 2024

I was able to install ncurses 6.1 on Ubuntu 18.04 by following the instructions at https://www.osetc.com/en/how-to-install-ncurse-library-in-ubuntu-debian-centos-fedora-linux.html, however, I don't know how to build mtm using that specific library. If I can figure that out, it will hopefully compile.

from mtm.

 avatar commented on August 15, 2024

I have Ubuntu 18.04 and want to try mtm. Is this making any progress? Can I help?

from mtm.

 avatar commented on August 15, 2024

Never mind: I upgraded to Focal, and it compiles.

from mtm.

jarun avatar jarun commented on August 15, 2024

The following patch compiles it on 18.04 (but I don't see any colors):

diff --git a/mtm.c b/mtm.c
index 70011a2..c9c08e7 100644
--- a/mtm.c
+++ b/mtm.c
@@ -309,7 +309,12 @@ HANDLER(rc) /* RC - Restore Cursor */
     n->gc = n->sgc; n->gs = n->sgs;          /* save character sets        */
 
     /* restore colors */
+#if NCURSES_VERSION_PATCH <= 20180127
+    int cp = 1;
+    init_pair(cp, s->fg, s->bg);
+#else
     int cp = alloc_pair(s->fg, s->bg);
+#endif
     wcolor_set(win, cp, NULL);
     cchar_t c;
     setcchar(&c, L" ", A_NORMAL, cp, NULL);
@@ -330,7 +335,12 @@ ENDHANDLER
 
 HANDLER(el) /* EL - Erase in Line */
     cchar_t b;
+#if NCURSES_VERSION_PATCH <= 20180127
+    init_pair(1, s->fg, s->bg);
+    setcchar(&b, L" ", A_NORMAL, 1, NULL);
+#else
     setcchar(&b, L" ", A_NORMAL, alloc_pair(s->fg, s->bg), NULL);
+#endif
     switch (P0(0)){
         case 0: wclrtoeol(win);                                                 break;
         case 1: for (int i = 0; i <= x; i++) mvwadd_wchnstr(win, py, i, &b, 1); break;
@@ -359,7 +369,12 @@ ENDHANDLER
 
 HANDLER(ech) /* ECH - Erase Character */
     cchar_t c;
+#if NCURSES_VERSION_PATCH <= 20180127
+    init_pair(1, s->fg, s->bg);
+    setcchar(&c, L" ", A_NORMAL, 1, NULL);
+#else
     setcchar(&c, L" ", A_NORMAL, alloc_pair(s->fg, s->bg), NULL);
+#endif
     for (int i = 0; i < P1(0); i++)
         mvwadd_wchnstr(win, py, x + i, &c, 1);
     wmove(win, py, px);
@@ -506,7 +521,12 @@ HANDLER(sgr) /* SGR - Select Graphic Rendition */
         #endif
     }
     if (doc){
+#if NCURSES_VERSION_PATCH <= 20180127
+        int p = 1;
+        init_pair(p, s->fg = fg, s->bg = bg);
+#else
         int p = alloc_pair(s->fg = fg, s->bg = bg);
+#endif
         wcolor_set(win, p, NULL);
         cchar_t c;
         setcchar(&c, L" ", A_NORMAL, p, NULL);

from mtm.

jarun avatar jarun commented on August 15, 2024

Closing the defect with the above patch.

from mtm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.