libevent/tmux for IRIX

IRIX/Nekoware development, porting and related topics.
Forum rules
Any posts concerning pirated software or offering to buy/sell/trade commercial software are subject to removal.
User avatar
Raion-Fox
Donor
Donor
Posts: 1317
Joined: Thu Jan 30, 2014 5:01 pm
Location: near King George, Virginia
Contact:

libevent/tmux for IRIX

Unread postby Raion-Fox » Thu Jan 19, 2017 12:46 pm

I'd like to see if I can do a port of libevent/tmux to IRIX but unfortunately reimu, my Fuel, is apart for diagnosis and repair.

Does anyone have a system they could let me SSH into for development until I get my system back online? I'll be sure to return the favor. PM me since I want to give us a good alternative to screen.
:O3x02L: R16000 700MHz 8GB RAM kanna
:Octane: R12000 300MHz SI 896MB RAM yuuka
:Octane2: R12000A 400MHz V6 2.5GB RAM
:Indy: (Acclaim) R4600 133MHz XL Graphics 32MB RAM
:Indy: (Challenge S) R4600 133MHz (MIPS III Build Server)
Thinkpad W530 i7 3940XM 3GHz, 32GB, K1000M Windows 8.1 Embedded rin
Thinkpad R40 Pentium M 1.5GHz 2GB RAM kasha

User avatar
Krokodil
Donor
Donor
Posts: 466
Joined: Fri Apr 17, 2015 2:32 pm
Location: The House of Particular Individuals

Re: libevent/tmux for IRIX

Unread postby Krokodil » Thu Jan 19, 2017 3:30 pm

What kind of power do you need to do the development?
:Octane2: - :O2: - :Octane: - :Indigo2IMP:

User avatar
Raion-Fox
Donor
Donor
Posts: 1317
Joined: Thu Jan 30, 2014 5:01 pm
Location: near King George, Virginia
Contact:

Re: libevent/tmux for IRIX

Unread postby Raion-Fox » Thu Jan 19, 2017 4:24 pm

Just a system with both GCC and MIPSPro would be fine and at least 1GB of RAM - and swap space of course in case the disk swaps out. Libevent and tmux aren't exactly that taxing to try and build. I'll ensure I can get them to build, I'll issue any patches and let someone incorporate them into Nekoware.
:O3x02L: R16000 700MHz 8GB RAM kanna
:Octane: R12000 300MHz SI 896MB RAM yuuka
:Octane2: R12000A 400MHz V6 2.5GB RAM
:Indy: (Acclaim) R4600 133MHz XL Graphics 32MB RAM
:Indy: (Challenge S) R4600 133MHz (MIPS III Build Server)
Thinkpad W530 i7 3940XM 3GHz, 32GB, K1000M Windows 8.1 Embedded rin
Thinkpad R40 Pentium M 1.5GHz 2GB RAM kasha

User avatar
Raion-Fox
Donor
Donor
Posts: 1317
Joined: Thu Jan 30, 2014 5:01 pm
Location: near King George, Virginia
Contact:

Re: libevent/tmux for IRIX

Unread postby Raion-Fox » Sun Jan 29, 2017 9:54 pm

Libevent 2.1 stable builds fine with gmake, coreutils, and binutils installed as dependencies. It requires no codepatching.

The problem with tmux is that err.h does not exist on IRIX. Anyone know another header this may be circumvented?

I may be able to build tmux 2.1. Let's try it out.
Attachments
libevent.tar
libevent.tar
(2.66 MiB) Downloaded 19 times
:O3x02L: R16000 700MHz 8GB RAM kanna
:Octane: R12000 300MHz SI 896MB RAM yuuka
:Octane2: R12000A 400MHz V6 2.5GB RAM
:Indy: (Acclaim) R4600 133MHz XL Graphics 32MB RAM
:Indy: (Challenge S) R4600 133MHz (MIPS III Build Server)
Thinkpad W530 i7 3940XM 3GHz, 32GB, K1000M Windows 8.1 Embedded rin
Thinkpad R40 Pentium M 1.5GHz 2GB RAM kasha

User avatar
miod
Posts: 505
Joined: Fri Oct 09, 2009 2:44 am
Location: Clermont-Ferrand (France)
Contact:

Re: libevent/tmux for IRIX

Unread postby miod » Sun Jan 29, 2017 11:05 pm

Raion-Fox wrote:The problem with tmux is that err.h does not exist on IRIX. Anyone know another header this may be circumvented?

Just pick err.h and err.c, errx.c, verr.c, verrx.c, vwarn.c, vwarnx.c, warn.c, warnx.c from any *BSD libc.
:Indigo:R3000 (alas, dead) :Indigo:R4000 x4 :Indigo2:R4400 :Indigo2IMP:R4400 x2 :Indigo2:R8000 :Indigo2IMP:R10000 :Indy:R4000PC :Indy:R4000SC :Indy:R4400SC :Indy:R4600 :Indy:R5000SC :O2:R5000 x3 :O2:RM7000 :Octane:2xR10000 :Octane:R12000 :O200:2xR12000 :O200: - :O200:2x2xR10000 :Fuel:R16000 :O3x0:4xR16000 :A350:
among more than 150 machines : Apollo, Data General, Digital, HP, IBM, MIPS before SGI, Motorola, NeXT, SGI, Solbourne, Sun...

User avatar
Raion-Fox
Donor
Donor
Posts: 1317
Joined: Thu Jan 30, 2014 5:01 pm
Location: near King George, Virginia
Contact:

Re: libevent/tmux for IRIX

Unread postby Raion-Fox » Sun Jan 29, 2017 11:18 pm

I found the way around it however now it breaks simply because IRIX is unrecognized by the build system - it has support for aix, hpux and solaris but it doesn't know what IRIX has in compat/. Grr. Looks like I'm gonna have to define that all out.

EDIT: The problem is because os-unknown.c doesn't build correctly - the build system doesn't know what fork-pty to do etc. So I'm gonna make a definition for irix in the build system.
:O3x02L: R16000 700MHz 8GB RAM kanna
:Octane: R12000 300MHz SI 896MB RAM yuuka
:Octane2: R12000A 400MHz V6 2.5GB RAM
:Indy: (Acclaim) R4600 133MHz XL Graphics 32MB RAM
:Indy: (Challenge S) R4600 133MHz (MIPS III Build Server)
Thinkpad W530 i7 3940XM 3GHz, 32GB, K1000M Windows 8.1 Embedded rin
Thinkpad R40 Pentium M 1.5GHz 2GB RAM kasha

User avatar
Raion-Fox
Donor
Donor
Posts: 1317
Joined: Thu Jan 30, 2014 5:01 pm
Location: near King George, Virginia
Contact:

Re: libevent/tmux for IRIX

Unread postby Raion-Fox » Mon Jan 30, 2017 8:33 pm

I grabbed NetBSD's err.h, added an ifdef in tmux.c for irix and I found somewhere online a forkpty implementation for irix. I'm gonna see if Krok will let me have access to his Octane again so I can test it further. I hope my hacks to automake/autotools hold up. PITA, it is.

---

GAH I'm foiled at the minute by patch 5329 va_list bug - if you have the patch please PM me immediately.

I have already created ifdefs to fix err.h, hacked configure.ac and patched out the forkpty.c by finding an old forkpty.c online that works okay.

---

Using a series of ill-advised removals of va_list, I was able to bypass the error but now imsg.c wants IOV_MAX and SCM_RIGHTS, neither of which I think exist on IRIX... help?
Last edited by foetz on Tue Jan 31, 2017 7:18 am, edited 1 time in total.
Reason: merged
:O3x02L: R16000 700MHz 8GB RAM kanna
:Octane: R12000 300MHz SI 896MB RAM yuuka
:Octane2: R12000A 400MHz V6 2.5GB RAM
:Indy: (Acclaim) R4600 133MHz XL Graphics 32MB RAM
:Indy: (Challenge S) R4600 133MHz (MIPS III Build Server)
Thinkpad W530 i7 3940XM 3GHz, 32GB, K1000M Windows 8.1 Embedded rin
Thinkpad R40 Pentium M 1.5GHz 2GB RAM kasha

User avatar
miod
Posts: 505
Joined: Fri Oct 09, 2009 2:44 am
Location: Clermont-Ferrand (France)
Contact:

Re: libevent/tmux for IRIX

Unread postby miod » Tue Jan 31, 2017 3:49 am

Raion-Fox wrote:Using a series of ill-advised removals of va_list, I was able to bypass the error but now imsg.c wants IOV_MAX and SCM_RIGHTS, neither of which I think exist on IRIX... help?

Be sure to compile with _XOPEN_SOURCE defined (to get SCM_RIGHTS among other things), and use _XOPEN_IOV_MAX for IOV_MAX.
:Indigo:R3000 (alas, dead) :Indigo:R4000 x4 :Indigo2:R4400 :Indigo2IMP:R4400 x2 :Indigo2:R8000 :Indigo2IMP:R10000 :Indy:R4000PC :Indy:R4000SC :Indy:R4400SC :Indy:R4600 :Indy:R5000SC :O2:R5000 x3 :O2:RM7000 :Octane:2xR10000 :Octane:R12000 :O200:2xR12000 :O200: - :O200:2x2xR10000 :Fuel:R16000 :O3x0:4xR16000 :A350:
among more than 150 machines : Apollo, Data General, Digital, HP, IBM, MIPS before SGI, Motorola, NeXT, SGI, Solbourne, Sun...

User avatar
Raion-Fox
Donor
Donor
Posts: 1317
Joined: Thu Jan 30, 2014 5:01 pm
Location: near King George, Virginia
Contact:

Re: libevent/tmux for IRIX

Unread postby Raion-Fox » Tue Jan 31, 2017 7:47 am

Gotcha I'll add ifdefs for that

---

Okay so I added an ifdef to imsg.c, imsg.h & imsg-buffer.c

#if defined(irix) || defined (__irix__) || defined(sgi) || defined (__sgi__)
#define _XOPEN_IOV_MAX 16
#define _XOPEN_SOURCE 4
#endif

Worked somewhat well. Now I've got issues with imsg-buffer.c

Ugh I give up for the present. I need to get FoxBSD Alpha 1 Faye Valentine released. In the meantime, I'll drop the patched code here. I removed err.h and the compiler allows implicit declaration even though that's a warning. This is NOT my best work by far, it's probably some of the worst code I've pushed. forkpty-unknown.c is not my work at all but some random old code I found online in the sourceforge repo. It's hacked together, its nasty and it's probably broken in a few places.
Attachments
tmux-master-irix.tar
(4.29 MiB) Downloaded 17 times
Last edited by foetz on Tue Jan 31, 2017 2:05 pm, edited 1 time in total.
Reason: merged
:O3x02L: R16000 700MHz 8GB RAM kanna
:Octane: R12000 300MHz SI 896MB RAM yuuka
:Octane2: R12000A 400MHz V6 2.5GB RAM
:Indy: (Acclaim) R4600 133MHz XL Graphics 32MB RAM
:Indy: (Challenge S) R4600 133MHz (MIPS III Build Server)
Thinkpad W530 i7 3940XM 3GHz, 32GB, K1000M Windows 8.1 Embedded rin
Thinkpad R40 Pentium M 1.5GHz 2GB RAM kasha

User avatar
spiroyster
Donor
Donor
Posts: 142
Joined: Thu May 03, 2012 8:24 am
Location: Somerset, UK

Re: libevent/tmux for IRIX

Unread postby spiroyster » Wed Feb 01, 2017 3:25 am

Implicit declaration? function will be assumed to return an int, so better hope it does :)

Which compiler are you using for this? If gcc, it's recommended to compile with '-Werror' or enforce later standards. This isn't a compliers problem, more a linkers problem, hence it's a compiler warning. This is in fact old standard for a compiler to let this slip, and can lead to problematic code at run time (if linker lets it pass) which is why later standards (C99) prohibit this.

If you know the signature of the function you are calling (o.0),I can't see a reason not to prototype it?

Also, are _XOPEN_IOV_MAX and _XOPEN_SOURCE pre defined to different values? if so advisable to #undef before defining them.

User avatar
Raion-Fox
Donor
Donor
Posts: 1317
Joined: Thu Jan 30, 2014 5:01 pm
Location: near King George, Virginia
Contact:

Re: libevent/tmux for IRIX

Unread postby Raion-Fox » Wed Feb 01, 2017 11:41 am

spiroyster wrote:Implicit declaration? function will be assumed to return an int, so better hope it does :)


I was having issues with u_char so I typdef'd it as unsig

spiroyster wrote:Which compiler are you using for this? If gcc, it's recommended to compile with '-Werror' or enforce later standards. This isn't a compliers problem, more a linkers problem, hence it's a compiler warning. This is in fact old standard for a compiler to let this slip, and can lead to problematic code at run time (if linker lets it pass) which is why later standards (C99) prohibit this.


The place where I got stuck was the struct ibuf in imsg.h being declared by the code not picking it up. I was using GCC 4.7. I was gonna run them with GCC first, and then try making them run under MIPSPro if there was performance benefits.

spiroyster wrote:Also, are _XOPEN_IOV_MAX and _XOPEN_SOURCE pre defined to different values? if so advisable to #undef before defining them.


I don't know. I googled people who added their definitions in, checked their code and used the values there.

Here's the issue - I consider myself an amateur at C, especially when it is code that I didn't write. Now for FoxBSD, most of what I've been doing is patch integration, changes to default configs and removal of buildsystem pieces from make. I have not a lot of experience with IRIX's buildsystem.

building tmux requires automake and autotools to be installed, for autogen.sh, gmake, GCC 4.7 and the usual nekoware flags to be thrown. I'm done for the time being with this project. I have ordered a Challenge S on eBay as well as an O300, both of which will be patched and setup better for development on IRIX.
:O3x02L: R16000 700MHz 8GB RAM kanna
:Octane: R12000 300MHz SI 896MB RAM yuuka
:Octane2: R12000A 400MHz V6 2.5GB RAM
:Indy: (Acclaim) R4600 133MHz XL Graphics 32MB RAM
:Indy: (Challenge S) R4600 133MHz (MIPS III Build Server)
Thinkpad W530 i7 3940XM 3GHz, 32GB, K1000M Windows 8.1 Embedded rin
Thinkpad R40 Pentium M 1.5GHz 2GB RAM kasha

kev009
Posts: 106
Joined: Wed Nov 12, 2008 8:02 pm
Location: Tempe, Arizona
Contact:

Re: libevent/tmux for IRIX

Unread postby kev009 » Sun May 28, 2017 7:38 pm

Hah, I did the Irix fixes for libevent 2.x upstream many moons ago.
SGI Fuel, Indy R5k
IBM RS/6000 7006-42T, 7011-250, 7012-397, 7012-G40 (upgraded to 4x 200MHz PPC), ThinkPad 710TE vintage tablet, ThinkPad T400, various System X, NetVista 2800
Sun Ultra 27 Xeon Quad Core 3.20GHz, Sunblade 2500 Silver, SunFire V445
HP c8000

http://ps-2.kev009.com:8081/ - IBM Retro
http://www.kev009.com/ - Blog
Free Usenet access for comp.* heirarchy. Send me a message for posting access.

User avatar
Raion-Fox
Donor
Donor
Posts: 1317
Joined: Thu Jan 30, 2014 5:01 pm
Location: near King George, Virginia
Contact:

Re: libevent/tmux for IRIX

Unread postby Raion-Fox » Sun May 28, 2017 9:50 pm

Yeah Libevent compiles great even under MIPSPro. But with tmux it just... doesn't fucking work.
:O3x02L: R16000 700MHz 8GB RAM kanna
:Octane: R12000 300MHz SI 896MB RAM yuuka
:Octane2: R12000A 400MHz V6 2.5GB RAM
:Indy: (Acclaim) R4600 133MHz XL Graphics 32MB RAM
:Indy: (Challenge S) R4600 133MHz (MIPS III Build Server)
Thinkpad W530 i7 3940XM 3GHz, 32GB, K1000M Windows 8.1 Embedded rin
Thinkpad R40 Pentium M 1.5GHz 2GB RAM kasha

User avatar
dexter1
Moderator
Moderator
Posts: 2730
Joined: Thu Feb 20, 2003 6:57 am
Location: Zoetermeer, The Netherlands

Re: libevent/tmux for IRIX

Unread postby dexter1 » Mon May 29, 2017 6:40 am

From http://tmux-users.narkive.com/1rppDdhM/irix-support :

Nicholas Marriott wrote: 2010-02-10 19:08:19 UTC
I had an IRIX shell but the tmux support didn't work and I didn't have time to finish it.
Mattieu Baptiste wrote:Hi,
I see that previous versions up to tmux-0.8 had limited support for IRIX but since then, the support has been dropped. Is there technical reasons or just no hardware available?

This doesn't give me much hope of tmux ever supporting IRIX, but i went ahead and tried to compile it with MIPSPro 7.4.4 (IRIX 6.5.30 + patches).
So I have created a patchfile which i included as attachment. Used libevent 2.1.8 and plain SGI curses. This apparently satisfies tmux configure command.

The main problems are osdep-irix.c for which i copied the osdep-hpux.c , but it is basically an empty placeholder.
forkpty-irix.c is interestingly from an older tmux/compat folder, probably early 1.2 version or something in that range.

Code: Select all

setenv MAKE /usr/nekoware/bin/gmake
setenv CC c99
setenv CFLAGS '-O2 -mips4 -I/usr/local/include'
setenv LDFLAGS '-L/usr/local/lib'

This should be a good env to compile with.

miod wrote:
Raion-Fox wrote:Using a series of ill-advised removals of va_list, I was able to bypass the error but now imsg.c wants IOV_MAX and SCM_RIGHTS, neither of which I think exist on IRIX... help?

Be sure to compile with _XOPEN_SOURCE defined (to get SCM_RIGHTS among other things), and use _XOPEN_IOV_MAX for IOV_MAX.

i tried _XOPEN_SOURCE with and without _XOPEN_SOURCE_EXTENDED but i got u_char definitions getting dropped from the code.
It's not that critical however: SCM_RIGHTS is a static 0x01 and IOV_MAX is actually a sysconf parameter which you can interrogate using

Code: Select all

sysconf IOV_MAX
or dynamically with

Code: Select all

sysconf(_SC_IOV_MAX)

I didn't see the err.h problem, but that is probably because i did not compile openssl support into libevent: Actually, err.h lives in /usr/nekoware/include/openssl/err.h

This gives me a binary tmux, but it refuses to run:

Code: Select all

mech002:/usr/people/feverdij/src/tmux-2.5> ldd tmux
        libxnet.so  =>   /usr/lib32/libxnet.so 
        libevent-2.1.so.7  =>    /usr/local/lib/libevent-2.1.so.7       
        libcurses.so  =>         /usr/lib32/libcurses.so       
        libgen.so  =>    /usr/lib32/libgen.so   
        libc.so.1  =>    /usr/lib32/libc.so.1
mech002:/usr/people/feverdij/src/tmux-2.5> ./tmux
tmux: need UTF-8 locale (LC_CTYPE) but have ISO8859-1
mech002:/usr/people/feverdij/src/tmux-2.5> setenv LC_CTYPE ISO8859-1
mech002:/usr/people/feverdij/src/tmux-2.5> ./tmux
tmux: invalid LC_ALL, LC_CTYPE or LANG

It looks like UTF-8 is hardcoded, which i'm surprised about. Didn't we use to have libintl/libiconv for this to have proper localization in code? It seems odd to not include such a compatibility layer into a program. We need other charset supported in tmux if we are going to use it in IRIX shells.

The most tedious problem i encountered in the code are coming from anonymous unions and structs. It is not supported in C99 but is a gnu extension, which has found its way in C11 standard. You'll get warning messages like:

Code: Select all

cc-1040 c99: WARNING File = tmux.h, Line = 557
  An identifier is expected.

        };

...which subsequently breaks code compiles with such an anonymous union:

Code: Select all

cc-1565 c99: ERROR File = grid.c, Line = 69
  The struct "grid_cell_entry" has no field "data".

        gce->data.fg = gc->fg & 0xff;

The best, although laborious option, is to un-anonymize the unions and structs. It is sufficient to add an identifier:

Code: Select all

struct grid_cell_entry {
   u_char         flags;
   union {
      u_int      offset;
      struct {
         u_char   attr;
         u_char   fg;
         u_char   bg;
         u_char   data;
      } data;
   } u;     <----- un-anonymize
} __packed;

... and then change all struct and union access to use the new identifier.

Anyway, have a look at my work. If you have time to do a functional IRIX port, it will need old code from tmux-1.x and some locale internationalization support with gnu gettext/libiconv which is ported via nekoware. But that might be a lot of work.
Attachments
tmux-2.5_irix.patch
(15.99 KiB) Downloaded 7 times
:Crimson: :PI: :Indigo: :O2: :Indy: :Indigo2: :Indigo2IMP:

User avatar
Raion-Fox
Donor
Donor
Posts: 1317
Joined: Thu Jan 30, 2014 5:01 pm
Location: near King George, Virginia
Contact:

Re: libevent/tmux for IRIX

Unread postby Raion-Fox » Thu Aug 24, 2017 4:30 pm

Finally got a chance to look at the code. Very good, to have gotten this far. Implementing patches to fix the charset support is probably not going to be worth it - I'm tabling this indefinitely. I'm gonna try byobu next, to see if that works well. I've got other stuff in the pipe but I'm currently dealing with most of my machines being in storage while I try to move from my house which is literally falling apart (the rainy summer has ruined the rear section of the roof and put a hole in my ceiling as wide as Joe Pesci)
:O3x02L: R16000 700MHz 8GB RAM kanna
:Octane: R12000 300MHz SI 896MB RAM yuuka
:Octane2: R12000A 400MHz V6 2.5GB RAM
:Indy: (Acclaim) R4600 133MHz XL Graphics 32MB RAM
:Indy: (Challenge S) R4600 133MHz (MIPS III Build Server)
Thinkpad W530 i7 3940XM 3GHz, 32GB, K1000M Windows 8.1 Embedded rin
Thinkpad R40 Pentium M 1.5GHz 2GB RAM kasha


Return to “SGI: Development”

Who is online

Users browsing this forum: No registered users and 1 guest