AZO234 / NP2kai

Neko Project II kai
http://domisan.sakura.ne.jp/article/np2kai/np2kai.html
MIT License
246 stars 61 forks source link

Error when building non-ia32 version #103

Closed tokumeiwokiboushimasu closed 4 years ago

tokumeiwokiboushimasu commented 4 years ago

$ cmake .. -D BUILD_X=ON -D BUILD_I286=ON $ make

causes the following error.

/home/hoge/NP2kai/vram/videofilter.c: In function 'VideoFilter_SetPalette': /home/hoge/NP2kai/vram/videofilter.c:638:15: error: 'NP2PAL_GRPHEX' undeclared (first use in this function); did you mean 'NP2PAL_GRPH'? 638 | u32Pallet = NP2PAL_GRPHEX; | ^~~~~ | NP2PAL_GRPH /home/hoge/NP2kai/vram/videofilter.c:638:15: note: each undeclared identifier is reported only once for each function it appears in /home/hoge/NP2kai/vram/videofilter.c: In function 'VideoFilter_Import98': /home/hoge/NP2kai/vram/videofilter.c:666:22: error: 'NP2PAL_GRPHEX' undeclared (first use in this function); did you mean 'NP2PAL_GRPH'? 666 | ptMng->u32Pallet = NP2PAL_GRPHEX; | ^~~~~ | NP2PAL_GRPH make[2]: [CMakeFiles/xnp2kai.dir/build.make:2995: CMakeFiles/xnp2kai.dir/vram/videofilter.c.o] Error 1 make[1]: [CMakeFiles/Makefile2:243: CMakeFiles/xnp2kai.dir/all] Error 2 make: *** [Makefile:150: all] Error 2

AZO234 commented 4 years ago

Thanks!⭐ I fixed this.

tokumeiwokiboushimasu commented 4 years ago

Thunks. Now it compiles. But xnp2kai stops running immediately with Segmentation Fault. The backtrace is below.

0 0x0000000000000000 in ()

1 0x00007ffff7ae2dbe in g_hash_table_add () at /lib64/libglib-2.0.so.0

2 0x00007ffff7a69b78 in g_param_spec_pool_insert ()

at /lib64/libgobject-2.0.so.0

3 0x00007ffff7a63636 in validate_and_install_class_property.part ()

at /lib64/libgobject-2.0.so.0

4 0x00007ffff7a7b529 in g_type_class_ref () at /lib64/libgobject-2.0.so.0

5 0x00007ffff7a647e8 in g_object_new_with_properties ()

at /lib64/libgobject-2.0.so.0

6 0x00007ffff7a65331 in g_object_new () at /lib64/libgobject-2.0.so.0

7 0x00007ffff74c7a3d in gdk_display_manager_get ()

at /lib64/libgdk-x11-2.0.so.0

8 0x00007ffff7162d18 in _gtk_modules_init () at /lib64/libgtk-x11-2.0.so.0

9 0x00007ffff71433fb in post_parse_hook () at /lib64/libgtk-x11-2.0.so.0

10 0x00007ffff7b030e7 in g_option_context_parse () at /lib64/libglib-2.0.so.0

11 0x00007ffff7143980 in gtk_parse_args () at /lib64/libgtk-x11-2.0.so.0

12 0x00007ffff7143a1d in gtk_init () at /lib64/libgtk-x11-2.0.so.0

13 0x00000000004cf9a0 in gui_gtk_arginit ()

14 0x0000000000408819 in main ()

AZO234 commented 4 years ago

I checked working correctly on Ubuntu 20.04. (Work some games on MS-DOS 5.0A) How do you use environment?

tokumeiwokiboushimasu commented 4 years ago

My envionment is Fedora 32 (x86_64).

AZO234 commented 4 years ago

I could build and work xnp2kai on Fedora 32. (But keyboard works strangely...)

I wrote README.md to need yum packages when building NP2kai.

tokumeiwokiboushimasu commented 4 years ago

Yeah I have already installed these packages.
Actually, before you changed build system from auto tools to cmake, it worked perfectly. I tested xnp21kai, and it also dies with segmentation fault... By the way, Fedora's package tool is now dnf instead of yum.

AZO234 commented 4 years ago

Ah, yum changed!? I need to understand more computer environment. I'm sorry for my poor knowledge and inconvenience to you...😓

My Fedora 32 shows like follow fig. Fedora 32

Your backtrace is seem GLib/GObject's problem. There is some incorrect in my implementation maybe.

tokumeiwokiboushimasu commented 4 years ago

Anyway, the error with i286 building has been fixed. So I close this issue. Thanks.

AZO234 commented 4 years ago

Oh, I want ask one.

How about work on your environment with removing 'SUPPORT_VIDEOFILTER' from CMakeList.txt (line 236)? This is new function, and this may not have removed the bug. Sorry.

tokumeiwokiboushimasu commented 4 years ago

Sorry for the late reply. It still crashes after removing 'SUPPORT_VIDEOFILTER' from CMakeList.txt.

AZO234 commented 4 years ago

Thank you!

How do you use graphic HW/Driver?

tokumeiwokiboushimasu commented 4 years ago

I'm using a normal laptop with Skylake's internal GPU. I'm not using Wayland. Just using Fedora's X11 driver.

AZO234 commented 4 years ago

How work build option '-D USE_SDL2=OFF'? (SDL1 using)

tokumeiwokiboushimasu commented 4 years ago

xnp2kai_sdl1 also crashes with segmentation fault.

AZO234 commented 4 years ago

Can you compile and run follow code?

test.c

#include <gtk/gtk.h>

int main(int argc,char *argv[])
{
    GtkWidget *window;

    gtk_init(&argc, &argv);

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_widget_show(window);

    gtk_main();

    return 0;
}

Compile.

$ gcc test.c -o test `pkg-config --cflags --libs gtk+-2.0`

Run.

$ ./test
tokumeiwokiboushimasu commented 4 years ago

Running the code makes an empty window. No segmentation fault.

tokumeiwokiboushimasu commented 4 years ago

One note. When running cmake, there are warnings below.

CMake Warning (dev) at CMakeLists.txt:848: Syntax Warning in cmake code at column 54

Argument not separated from preceding token by whitespace. This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeLists.txt:864: Syntax Warning in cmake code at column 56

Argument not separated from preceding token by whitespace. This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeLists.txt:923: Syntax Warning in cmake code at column 54

Argument not separated from preceding token by whitespace. This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeLists.txt:939: Syntax Warning in cmake code at column 56

Argument not separated from preceding token by whitespace. This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeLists.txt:998: Syntax Warning in cmake code at column 54

Argument not separated from preceding token by whitespace. This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeLists.txt:1014: Syntax Warning in cmake code at column 56

Argument not separated from preceding token by whitespace. This warning is for project developers. Use -Wno-dev to suppress it.

AZO234 commented 4 years ago

A windows should be displayed by this code...Umm. I thank Graphics Board matter.

Those syntax warnings are for OpenDingux building. (I fixed warnings.)

tokumeiwokiboushimasu commented 4 years ago

A windows should be displayed by this code...Umm.

Yes, a window which is empty (just white) is displayed. I think it is normal even on my environment.

tokumeiwokiboushimasu commented 4 years ago

I commentted out the lines from 151 to 156 of main.c and it still fails with segmentation fault on line 159. So, apparently something is wrong. But the program above runs normally, so I think if there is some mistake of linking libray for example linking a non-thread-safe libraly or something? If so, it makes sense why the configure script version was OK and the cmake version is problematic. What do you think?

AZO234 commented 4 years ago

I waybacked Autotools files. Please try.

./autogen.sh -> ./configure -> make

I found no writing about 'XF86VidMode extension' in CMakeList.txt. This maybe occur something wrong.

Edit: 'XF86VidMode extension' was handled in CMake correctly.

tokumeiwokiboushimasu commented 4 years ago

Seems there's no autogen.sh ...

tokumeiwokiboushimasu commented 4 years ago

I copied other project's autogen.sh, and editted configure.ac and Makefile.am a bit (Removed 'no-installinfo' from configure.ac, and removed about np2tool/np2tool.d88 from Makefile.am). Now, xnp2kai can build successfully, and it runs perfectly.

tokumeiwokiboushimasu commented 4 years ago

Ahh, doesn't run perfectly in fact. ROM BASIC boots (I can input a number when asked 'How many files'), but doesn't respond to any key inputs after it displays 'OK'. It doesn't display the cursor caret. Disk BASIC seems OK. I don't know since when this problem has been there.

AZO234 commented 4 years ago

Oh, sorry. I add it. Please try this.

tokumeiwokiboushimasu commented 4 years ago

Still I have to comment out the line 8 of Makefile.am. But other than that, building has no problem. And this time, both the ROM BASIC and disk BASIC do not respond to any input. Other games that I have seem to have no problem.

tokumeiwokiboushimasu commented 4 years ago

Oh, sorry. BASIC's problem is just my mistake. Specifying the right config file resolves the problem.

AZO234 commented 4 years ago

I add to Freetype and Fontconfig library link to CMakeLists.txt. How work this?

My purpose is to eliminate the difference between CMake and Autotools. After all, Autotools will be abolished.

tokumeiwokiboushimasu commented 4 years ago

I add to Freetype and Fontconfig library link to CMakeLists.txt. How work this?

Segmentation Fault. Same as the previous CMakeList.txt's case.

AZO234 commented 4 years ago

I compared Makefiles that generated by CMake and Autotools.

CMake one, link dynamic libraries. (/usr/lib/x86_64-linux-gnu/libglib-2.0.so) Autotools one, link by name (-lglib-2.0). Probably static libraries.

There shouldn't be difference...😣 But I changed CMakeLists.txt to glib-2.0 is static linked.

I'm sorry to you trying many times. Please check it.

tokumeiwokiboushimasu commented 4 years ago

Bingo! Now cmake version boots without segmentation fault.

CMake one, link dynamic libraries. (/usr/lib/x86_64-linux-gnu/libglib-2.0.so) Autotools one, link by name (-lglib-2.0). Probably static libraries.

I think using -lglib-2.0 links system's dynamic library, and the right way to do so.

AZO234 commented 4 years ago

Congratulations!!⭐

I'll make option about glib-2.0 linking. Default is '-lglib-2.0' of course.

It is long time battle. Thanks for your cooperation!

That's all for this problem.

tokumeiwokiboushimasu commented 4 years ago

Thank you!