The collected works of dsolaz

Hello. A bit late, yes, but I'm trying to clarify the current 'official' status of Wings 3D on IRIX 6.5. After a maybe-too-quick search in the forums I'm still not sure if anyone managed to get it running fine. That is, no crashes, no lock-ups, good-looking icons, etc.
I solved all these issues on my own, maybe someone would like to know...
Thanks in advance.
-Daniel
Hello, and sorry for not being clear (English is not my mother tongue).
I am the guy who patched Erlang (well, just the os_mon utility, actually, but I also found the solution to the pthreads problem, which is not a bug) to run on IRIX. I did solve all Wings 3D issues, at least those present on my machines, an O2 and an Octane/SSE. I have it working *almost* flawlessly on 6.5.26 in both 32- and 64-bit multithreaded mode.
I'd like to know if it's worth creating a tardist or there is already one that can be considered "nekoware-official". If it is worth doing it, I would need assistance with the software packager.
Regards.
-Daniel
Gcc is *required* in order to compile Erlang. IIRC this is stated in the README. I have used gcc 3.3.something.
I will collect my configuration notes regarding Erlang, ESDL and Wings 3D when I get home, and post them here tomorrow. Getting Erlang and ESDL running is not hard, Wings 3D took a bit of trial and error.
Regards.
-Daniel
[maybe this should go to the devel forum]

Compilation instructions for Erlang R11B-1, gcc 3.3, IRIX 6.5.26.
This is to build a 32-bit multithreaded runtime.

1) source patching:
At erts/emulator/sys/unix/sys.c, line 45: comment out "#include <sys/stropts.h>".

2) erts/configure patching:
- case starting at line 1976, add irix6*) DEXPORT="-Wl,-exports";;
- case starting at line 7848, add irix6*) DED_LDFLAGS="-mips4 -shared -all";;

3) configure:
Choose CFLAGS and installation prefix according to your needs.
$ CFLAGS="-mips4 -O3" ./configure --enable-threads --prefix=/usr/nekoware
If you see configure stuck on message "checking for presens of poll()/select() bug when another thread closes fd..." go to Process Manager and kill process "conftest".

4) make:
GNU make is required.
$ gmake
When you see the "Failed to create thread: Operation not permitted (1)" message, become root and do
# chcap "CAP_SCHED_MGT+eip" bin/mips-sgi-irix6.5/beam
then gmake again.

5) install as root:
# gmake install
The installed emulators, beam and beam.hybrid (the "shared heap" variant), have lost the CAP_SCHED_MGT capability.
# chcap "CAP_SCHED_MGT+eip" /usr/nekoware/lib/erlang/erts-5.5.1/bin/beam*

6) test the Erlang command line:
$ erl

That's it for Erlang. Please report any problems.
ESDL and Wings 3D notes will follow soon.

Regards.
-Daniel
Hello. Sorry for the delay. Maybe someone managed to compile Erlang following the steps I posted a couple of weeks ago. Here are my notes regarding ESDL and Wings 3D.

Remember: GCC and GNU make required.

ESDL
Using the latest version, 0.96.0626, I followed installation instructions; only had to make these two changes before building:
- in c_src/Makefile, change $OGLDIR/lib to $OGLDIR/lib32
- add "-mips4" and other desired flags to CFLAGS
Previous to this I compiled my own libSDL, but I don't remember it needing special configuration options and this doesn't seem to be a must: nekoware SDL should be fine.

Wings 3D
Using 0.98.35, the latest at the time I tried.
in plugins_src/accel/Makefile:
- remove calls to "install -d $(LIBDIR)" (they fail on my box)
- create directory plugins/accel by hand
- correct GCC definition (add "-mips4" etc)
in plugins_src/autouv/shaders/Makefile:
- remove calls to "install -d $(DIR)"; no need to create anything in this case

It is best to copy (or link) the wings-0.98.35 directory to the lib/erlang/lib directory of your Erlang installation; the same goes for esdl-0.96.0626. That way Erlang will automatically incorporate them to the code path when it boots.

If all goes well you'll now have compiled Wings 3D, but it will lock up as soon as you launch it. Turns out this is because a division by zero causes the emulator (Erlang parlance for VM) to hang, instead of throwing a badarith exception as it should, and a number of these happen while converting from RGB to HSV. Maybe on some other places as well. I've yet to ask some questions in the Erlang mailing list regarding this issue.

At least two source files, wings_init.erl and wings_color.erl, must be patched. I have a 50-line patch file, but there doesn't seem to be a way to attach it to this message, so there it goes.

Code: Select all

--- wings_init.erl   Tue Apr 12 19:31:03 CEST 2005
+++ wings_init.erl.ds   Tue Nov 07 23:07:58 CET 2006
@@ -19,7 +19,7 @@
-include("wings.hrl").

init() ->
-    macosx_workaround(),
+%   macosx_workaround(),
os:putenv("SDL_HAS3BUTTONMOUSE", "true"),

wings_pref:set_default(window_size, {780,570}),

--- wings_color.erl   Sun Jan 23 10:34:56 CET 2005
+++ wings_color.erl.ds   Tue Nov 07 23:07:57 CET 2006
@@ -137,6 +137,11 @@
HSV -> HSV
end.

+safe_div(Q, D) ->
+   case D == 0.0 of
+      true  -> throw(badarith);
+      false -> Q / D end.
+
internal_rgb_to_hsv(R, G, B) ->
Max = lists:max([R,G,B]),
Min = lists:min([R,G,B]),
@@ -143,14 +148,21 @@
V = Max,
{Hue,Sat} = try
{if
-          Min == B -> (G-Min)/(R+G-2.0*Min);
-          Min == R -> (1.0+(B-Min)/(B+G-2.0*Min));
-          Min == G -> (2.0+(R-Min)/(B+R-2.0*Min))
-           end*120,(Max-Min)/Max}
+          Min == B ->     safe_div(G-Min, R+G-2.0*Min); %(G-Min)/(R+G-2.0*Min);
+          Min == R -> 1.0+safe_div(B-Min, B+G-2.0*Min); %(1.0+(B-Min)/(B+G-2.0*Min));
+          Min == G -> 2.0+safe_div(R-Min, B+R-2.0*Min)  %(2.0+(R-Min)/(B+R-2.0*Min))
+           end*120,safe_div(Max-Min, Max)} %(Max-Min)/Max}
catch
-          error:badarith ->
+%          error:badarith ->
+          badarith ->
{undefined,0.0}
end,
+%   {Hue, Sat} = case Max == 0.0 of
+%      false -> {if Min == B -> (G-Min)/(R+G-2.0*Min);
+%                   Min == R -> (1.0+(B-Min)/(B+G-2.0*Min));
+%                   Min == G -> (2.0+(R-Min)/(B+R-2.0*Min)) end*120,
+%                (Max-Min)/Max};
+%      true  -> {undefined, 0.0} end,
{Hue,Sat,V}.

hsv_to_rgb(H, S, V) ->


It seems phpBB does not preserve tabs; maybe the 'patch' utility will complain if you just copy this into a file and attept to patch the Wings 3D source with that. In any case, please feel free to request the real patch file by email: I'm 'dsolaz' at domain 'sistelcom' dot com (note that I'll be offline from Nov 9 to 12).

Better yet, read my forthcoming post regarding the creation of tardist files of Erlang, ESDL and Wings 3D. With them, getting a (hopefully) working Wings 3D should be much easier for everyone.

I'd like to hear from people who try this. Specially those working on machines other than what I have: an O2 and an Octane/SSE running 6.5.26 with GCC 3.3. Thanks in advance.
-Daniel
vtech wrote: I've tested one more configuration (Octane/R12k/300/V6) and found one bug: It works only for the user root. I'm not sure why.


Is there some error message or something? Maybe "failed to create thread: operation not permitted"?
The system-scope POSIX thread issue is a problem only if you are not root.
-Daniel
vtech wrote: libgcc_s.so.1 is in lib/esdl-0.96.0626/priv together with SDL and sdl_driver and LD_LIBRARY_PATH is set accordingly


IIRC, LD_LIBRARY_PATH is for o32 binaries. Try LD_LIBRARYN32_PATH, that might be it.
-Daniel
I might look at this again soon. I just got a new machine and right now I'm patching the Erlang emulator so it correctly detects the number of available CPU's. I'm still using 6.5.26, however.
If I get this working again, this time I'd like to make tardists, but I will need assistance from someone who is familiar with that package builder thing.
-Daniel