Tried for a while to make Minecraft working on AmigaOS4 (that one use Irrlicht which I port a year ago and which used in HCraft, SuperTuxKart, and NightOfTheZombies games).
Thanks to Salas00 for a fix in our GCC I can go further now, and so, there is at least something on the screen (click open in a new window for full size):
So far there are major issues I have for now (and If anyone can help me with it (i can donate for of course), that will be very helpful!) :
Issue #1. Semaphores and Threading + exit() call from the wrong process + other related bits. FIXED !!
+ by few fixes to amigaos4-native-threading implementation for our GCC (one by salas00 and one by Capehill)
Issue #2. Invalid UTF8-string everywhere FIXED !
Fixed by replacing WCHAR_T on UCS-4 in string.cpp (c) salas00
]Issue #3. Failing unit-tests for serialization. FIXED !!
by the usage of proper GCC flags(added -fno-math-errno -fno-trapping-math -ffinite-math-only -fno-signed-zeros).
Issue #4. Failing unit-tests for killthread() That one cause lot of "Waiting for thread" on serial.
Issue #5. Failing unit-tests for servermodmanager
Issue #8. Port for real network-based code. Need to remove ipv6 and use directly Roadshow (so proto/bsdsocket.h), as threaded curl use it as well.
It seems it still give us some issues with threading (crashes in the __gthread_entry() + _ZL15eh_globals_dtorPv(), following by lot of "Waiting for thread" on serial).
Issue #9. On running have "please insert volume minetest_menu_footer.png in any drive" and "please insert volume minetest_menu_header.png in any drive". FIXED !! By getting rid of -lunix and replacing posix rename()/delete()
fixed by getting as base win32 version, and replace few bits so IDOS->Delete() is used for.
Edited by kas1e on 2021/1/4 19:26:02 Edited by kas1e on 2021/1/4 21:59:33 Edited by kas1e on 2021/1/6 16:12:01 Edited by kas1e on 2021/1/7 15:20:47 Edited by kas1e on 2021/1/7 15:23:48 Edited by kas1e on 2021/1/7 15:24:21 Edited by kas1e on 2021/1/9 12:38:19 Edited by kas1e on 2021/1/9 15:04:34 Edited by kas1e on 2021/1/10 20:21:37 Edited by kas1e on 2021/1/10 20:27:08 Edited by kas1e on 2021/1/10 20:28:11 Edited by kas1e on 2021/1/13 16:17:12 Edited by kas1e on 2021/1/13 16:19:14 Edited by kas1e on 2021/1/13 20:44:48
I'm not sure if the locking in sem_getvalue() is needed. I added it just to be safe, but this particular operation doesn't really seem safe to me even with the locking (because of multitasking there is no guarantee that the value is still correct after the function has returned).
@Salas00 Despite missing those 2 functions, i tried to compile semaphore.c and it brings me a little bunch of undefs, which i fixed by adding those include : proto/dos.h errno.h limits.h
And i left with:
Quote:
$ ppc-amigaos-g++ semaphore.c -c -o semaphore.o semaphore.c:13:15: error: expected constructor, destructor, or type conversion before ‘(’ token _Static_assert(sizeof(sem_t) == sizeof(isem_t), "Internal and public structures are not the same size!"); ^ semaphore.c: In function ‘int sem_wait(sem_t*)’: semaphore.c:54:12: error: ‘EBREAK’ was not declared in this scope errno = EBREAK; ^~~~~~
EBREAK can't find in our includes, while EOVERFLOW is in sys/errno.h, but not EBREAK.
And the first errors seem code error? I tried with -std=c++11 and -std=c++17 just in case, but it seems there some typing error or something? Sure not the line which is important for code itself, but just curious wtf.
Yeah, got it for c++ as well. All compiles fine now! Thanks a bunch!
Through, I still have that strange issue #3, with 4 error windows from newlib.library saying that exit() of process xx called from wrong process xx, using IExec->RemTask(NULL).
Maybe that side back of the issue #2, as in the log i have exactly 4 strings of such kind:
Quote:
2021-01-02 21:59:37: INFO[Main]: Couldn't convert UTF-8 string 0x4d61696e204d656e75 into wstring 2021-01-02 21:59:37: INFO[Main]: Couldn't convert UTF-8 string 0x4d696e6574657374 into wstring 2021-01-02 21:59:37: INFO[Main]: Couldn't convert UTF-8 string 0x352e302e31 into wstring 2021-01-02 21:59:38: INFO[Main]: Couldn't convert UTF-8 string 0x into wstring
Imho firstly need to deal with those errors, and if errors from newlib didn't go, then investigate after.
I put some printfs right before call to that "convert()" function and "inbuf" there surely correct, i can just prinfs("%s\n") it. The same it correct if I put printf in the convert() function itself. But something going wrong exactly when we call "convert()" and it didn't translate the things as expected.
Maybe iconv() call is different on our side? Strangely that i have no needs to do -liconv on linking, it takes from somewhere else in SDK, so maybe just different implementations?
// Allow spawned thread to continue
m_start_finished_mutex.unlock();
while (!m_running)
sleep_ms(1);
m_joinable = true;
return true;
}
So it indeed a catch, is it mean some threads can't be created? And newlib just throw errors about RemTask(NULL) being called from the wrong process?
EDIT2: Find out that minecraft can be running with "--run-unittests" so can be checked all the code. And when it just tryied to test module TestThreading, it then shows me the same error from newlib.library:
Quote:
"exit() of process 214 called from wrong process 216, using IExec->RemTask(NULL). Process: "New Process".
and in the console i have:
Quote:
======== Testing module TestThreading terminate called after throwing an instance of 'std::system_error' what(): Device or resource busy
try {
m_thread_obj = new std::thread(threadProc, this);
// try logging here
} catch (const std::system_error &e) {
// try logging here
return false;
}
The exception was catched here so I think the problem is somewhere else (an uncaught exception: try-catch missing). If you put a log after thread creation, will it appear or not?
Device or Resource busy: would this refer to errno EBUSY somewhere?
You could try to surround the "join" call with before/after logs, or just add the try-catch.
Added printfs around "join" in Thread::wait as you say, and there is output:
Quote:
=============Testing module TestThreading log 1 terminate called after throwing an instance of 'std::system_error' what(): Device or resource busy before join <newlib.library error about exit() from wrong process using IEXEC->RemTask(NULL)>
And I never see "after join" printf, output just stops So .. in the end, it join() fail?
Quote:
EDIT: EBUSY might trigger from the GCC thread patch. In try_lock, is there also an increment missing on successful attempt:
Yeah, it looks that thread::join threw that exception due some EBUSY error.
1) add try-catch around "join" call. It should help with program termination. 2) change the GCC thread patch, add "mx->u.i.acquired++" before return 0. 3) add serial logging to GCC thread patch in EBUSY branches.
Hopefully this will shine some light on the issue.
For testing, what happens when you run the example on this page: