OdnetninI / Gameboy-Emulator

Just an experimental gb emulator for the c3 language
GNU General Public License v3.0
17 stars 2 forks source link

help on build under win10 64bit #1

Closed LukyGuyLucky closed 7 months ago

LukyGuyLucky commented 9 months ago

When I tried to build under window10 64 bit following the instruction,that is c3c build the compiler complained "Required library 'raylib' could not be found."

The project file structure maintained exactly as the same as downloaded.When failed to compile,I tried to place raylib.lib,raylib.3ci,raylib.dll(copy from other places) to several places to expect the compiler could find them but all failed,the same error message as the above.

Those places are: -the root of the project -root/lib -root/raylib -root/build

So was I missing something?

Thanks for the help in advance.

OdnetninI commented 9 months ago

Hi @LukyGuyLucky

I don't have a Windows 10 computer to try it but probably the issue is that the raylib.c3l is a folder instead of a file. On Linux there is no difference but I think for Windows could be the case.

Remove the lib/raylib.c3l folder and replace it with the file downloaded from executing c3c vendor-fetch raylib. So you will have a file called lib/raylib.c3l instead of the folder.

Then, try to compile it again.

Hope it helps, please tell me if you found any other issue.

LukyGuyLucky commented 9 months ago

Hi @LukyGuyLucky

I don't have a Windows 10 computer to try it but probably the issue is that the raylib.c3l is a folder instead of a file. On Linux there is no difference but I think for Windows could be the case.

Remove the lib/raylib.c3l folder and replace it with the file downloaded from executing c3c vendor-fetch raylib. So you will have a file called lib/raylib.c3l instead of the folder.

Then, try to compile it again.

Hope it helps, please tell me if you found any other issue.

Thanks for the reply.Actually I have placed raylib.c3l,raylib.lib in almost everywhere I could imagine but it doesn't help.Now I did exactly as you figured out(by executing c3c vendor-fetch raylib and replaced the raylib.c3l folder),all the same.The compiler just complained "Required library 'raylib' could not be found."

OdnetninI commented 9 months ago

Let's try to find the root issue.

Create a new empty project using c3c init test

Now, edit the project.json file adding the following:

  "dependency-search-paths": [ "lib" ],
  "dependencies": [ "raylib" ],

Then create a folder called lib and execute the c3c vendor-fetch raylib. Finally, place the raylib.c3l inside the lib folder.

Try to compile and run the project.

LukyGuyLucky commented 9 months ago

Let's try to find the root issue.

Create a new empty project using c3c init test

Now, edit the project.json file adding the following:

  "dependency-search-paths": [ "lib" ],
  "dependencies": [ "raylib" ],

Then create a folder called lib and execute the c3c vendor-fetch raylib. Finally, place the raylib.c3l inside the lib folder.

Try to compile and run the project.

Thank you.

It is weird last time I got a whole folder by executing c3c vendor-fetch raylib,but this time just got a single file raylib.c3l which is neither a lib,nor a header file,seems a binary file.That's ok~

the test project compiled ok and runs ok.

When I tried to build the GameBoy Emulator project,got below error message,it seems it is an issue about platform,not the project itself.

windows10 64bit +VS community 2019.

E:\Learning\c3pack\gbe>c3c build lld-link: error: duplicate symbol: __report_gsfailure

defined at D:\a_work\1\s\src\vctools\crt\vcstartup\src\gs\gs_report.c:217 msvcrt.lib(gs_report.obj) defined at VCRUNTIME140.dll Failed to create an executable: (null)

OdnetninI commented 9 months ago

The raylib.c3l is a zip file with everything needed inside. I am booting a windows 10 VM to debug it.

I will be back to you asap.

Thanks for the patience.

LukyGuyLucky commented 9 months ago

Appreciated!

when I tested raylib with c3/resources/examples/raylib/raylib_arkanoid.c3,I got exactly the same compiler error.Not sure whether this information is helpful.

[BTW,Seems the author is in linux system as well(please refer to enum custom value/int a @noinit issues report in c3 )]

OdnetninI commented 9 months ago

I was able to find the same issue.

I see you already opened an issue regarding raylib and C3. https://github.com/c3lang/c3c/issues/1123

I will be in touch for any progress on it.

Thank you for reporting it :)

LukyGuyLucky commented 9 months ago

I was able to find the same issue.

I see you already opened an issue regarding raylib and C3. c3lang/c3c#1123

I will be in touch for any progress on it.

Thank you for reporting it :)

Thank you very much,really appreciated.

LukyGuyLucky commented 9 months ago

I have successfully built 3 raylib examples following the guideline.Acutally the full command is : c3c compile example.c3 --lib raylib --libdir . --wincrt=none that is it.

But I still can't compile your project,this time the error message is--- E:\Learning\c3pack\gbe>c3c build --lib raylib --libdir --wincrt=none
error: --libdir needs a directory.

E:\Learning\c3pack\gbe>c3c build --lib raylib --libdir . --wincrt=none
lld-link: error: undefined symbol: getaddrinfo

referenced by E:\c3\lib\std\net\inetaddr.c3:269
build/tmp/std.net.obj:(std.net.addrinfo)

lld-link: error: undefined symbol: setsockopt

referenced by E:\c3\lib\std\net\socket.c3:110
build/tmp/std.net.obj:(std.net.Socket.set_option)

lld-link: error: undefined symbol: closesocket

referenced by E:\c3\lib\std\net\socket.c3:142
build/tmp/std.net.obj:(std.net.Socket.destroy)
referenced by E:\c3\lib\std\net\os\win32.c3:36
build/tmp/std.net.obj:(std.net.Socket.close)

lld-link: error: undefined symbol: WSAPoll

referenced by E:\c3\lib\std\net\socket.c3:70
build/tmp/std.net.obj:(std.net.poll)

lld-link: error: undefined symbol: socket

referenced by E:\c3\lib\std\net\socket.c3:18
build/tmp/std.net.obj:(std.net.connect_from_addrinfo)
referenced by E:\c3\lib\std\net\socket.c3:18
build/tmp/std.net.obj:(std.net.connect_with_timeoutfrom referenced by E:\c3\lib\std\net\socket.c3:18
build/tmp/std.net.tcp.obj:(std.net.tcp.listen_to)

lld-link: error: undefined symbol: connect

referenced by E:\c3\lib\std\net\socket_private.c3:15
build/tmp/std.net.obj:(std.net.connect_from_addrinfo)
referenced by E:\c3\lib\std\net\socket_private.c3:45
build/tmp/std.net.obj:(std.net.connect_with_timeoutfrom

lld-link: error: undefined symbol: WSAGetLastError

referenced by E:\c3\lib\std\net\socket_private.c3:26
build/tmp/std.net.obj:(std.net.last_error_is_delayed_conn referenced by E:\c3\lib\std\net\os\win32.c3:86
build/tmp/std.net.os.obj:(std.net.os.socket_error)

lld-link: error: undefined symbol: ioctlsocket

referenced by E:\c3\lib\std\net\os\win32.c3:28
build/tmp/std.net.os.obj:(std.net.os.NativeSocket.set_non

lld-link: error: undefined symbol: freeaddrinfo

referenced by E:\c3\lib\std\net\tcp.c3:11
build/tmp/std.net.tcp.obj:(std.net.tcp.connect)
referenced by E:\c3\lib\std\net\tcp.c3:11
build/tmp/std.net.tcp.obj:(std.net.tcp.connect)
referenced by E:\c3\lib\std\net\tcp.c3:11
build/tmp/std.net.tcp.obj:(std.net.tcp.connect)
referenced 3 more times

lld-link: error: undefined symbol: accept

referenced by E:\c3\lib\std\net\tcp.c3:46
build/tmp/std.net.tcp.obj:(std.net.tcp.accept)

lld-link: error: undefined symbol: bind

referenced by E:\c3\lib\std\net\tcp.c3:56
build/tmp/std.net.tcp.obj:(std.net.tcp.listen_to)

lld-link: error: undefined symbol: listen

referenced by E:\c3\lib\std\net\tcp.c3:56
build/tmp/std.net.tcp.obj:(std.net.tcp.listen_to)
Failed to create an executable: (null)

Looking forward to hearing from you.

Thanks and best regards

OdnetninI commented 9 months ago

Hey, I am glad you got the examples to work.

What you are doing is to not link with the windows runtime thing... wincrt.

The problem you are facing now is about the network library. I am not 100% sure, but probably the C3 network std library depends on wincrt.

You are probably asking... Why the hell an experimental GB emulator has networking? That is, I was trying to make multiplayer to work. Unfortunately, it does not.

Let me move all networking things to another branch.

OdnetninI commented 9 months ago

I just updated the repository with the updated version of raylib.c3l (no more folder), and networking disabled.

LukyGuyLucky commented 9 months ago

I just updated the repository with the updated version of raylib.c3l (no more folder), and networking disabled.

I built it successfully(should provide --wincrt=none option,otherwise failed to build) ,but it crashed when running,seems it is related to c3 bultins--- INFO: Initializing raylib 4.5 INFO: Supported raylib modules: INFO: > rcore:..... loaded (mandatory) INFO: > rlgl:...... loaded (mandatory) INFO: > rshapes:... loaded (optional) INFO: > rtextures:. loaded (optional) INFO: > rtext:..... loaded (optional) INFO: > rmodels:... loaded (optional) INFO: > raudio:.... loaded (optional) INFO: AUDIO: Device initialized successfully INFO: > Backend: miniaudio / WASAPI INFO: > Format: 32-bit IEEE Floating Point -> 32-bit IEEE Floating Point INFO: > Channels: 2 -> 2 INFO: > Sample rate: 48000 -> 48000 INFO: > Periods size: 1440 INFO: STREAM: Initialized successfully (48000 Hz, 16 bit, Stereo)

ERROR: 'Array index out of bounds (array had size 1, index was 1)' in panicf (E:\c3\lib\std\core\builtin.c3:135) [E:\Learning\c3pack\gem\gb.exe] in main (E:\Learning\c3pack\gem\src\main.c3:20) [E:\Learning\c3pack\gem\gb.exe] in _$main (E:\c3\lib\std\core\private\main_stub.c3:164) [E:\Learning\c3pack\gem\gb.exe] in __scrt_common_main_seh (D:\a_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288) [E:\Learning\cINFO: DISPLAY: Device initialized successfully INFO: > Display size: 1920 x 1080 INFO: > Screen size: 640 x 432 cINFO: > Render size: 640 x 432 kINFO: > Viewport offsets: 0, 0 gem\gbINFO: GLAD: OpenGL extensions loaded successfully eINFO: GL: Supported extensions count: 220 eINFO: GL: OpenGL device information: ] INFO: > Vendor: Intel INFO: > Renderer: Intel(R) HD Graphics 530 nINFO: > Version: 3.3.0 - Build 23.20.16.4901 BINFO: > GLSL: 3.30 - Build 23.20.16.4901 aINFO: GL: VAO extension detected, VAO functions loaded successfully eINFO: GL: NPOT textures extension detected, full NPOT textures supported TINFO: GL: DXT compressed textures supported rINFO: GL: ETC2/EAC compressed textures supported adInitTINFO: TEXTURE: [ID 1] Texture loaded successfully (1x1 | R8G8B8A8 | 1 mipmaps)h unINFO: TEXTURE: [ID 1] Default texture loaded successfully k (sourINFO: SHADER: [ID 1] Vertex shader compiled successfully e unaINFO: SHADER: [ID 2] Fragment shader compiled successfully ailable) [C:\windows\System32\KERNEL32.DLL] in RtlUserThINFO: SHADER: [ID 3] Program shader loaded successfully rINFO: SHADER: [ID 3] Default shader loaded successfully adStarINFO: RLGL: Render batch vertex buffers loaded successfully in RAM (CPU) (sINFO: RLGL: Render batch vertex buffers loaded successfully in VRAM (GPU) INFO: RLGL: Default OpenGL state initialized successfully ource unavailaINFO: TEXTURE: [ID 2] Texture loaded successfully (128x128 | GRAY_ALPHA | 1 mipmaps) bINFO: FONT: Default font loaded successfully (224 glyphs) lINFO: TIMER: Target time per frame: 16.667 milliseconds ) [CINFO: TEXTURE: [ID 3] Texture loaded successfully (160x144 | R8G8B8A8 | 1 mipmaps) :\windows\SYSTEM32\ntdll.dll]

Press Enter or Esc to exit...

OdnetninI commented 9 months ago

You need to add the bios and the rom to the argument when running gb.exe

./gb path_to_bios.bin path_to_rom.gb

I will eventually, increase the error detection and give error messages instead of crashing.

LukyGuyLucky commented 9 months ago

You need to add the bios and the rom to the argument when running gb.exe

./gb path_to_bios.bin path_to_rom.gb

I will eventually, increase the error detection and give error messages instead of crashing.

Sorry,I just don't know these two stuffs.Could you please elaborate and please figure me out how to fix the issue?There is just one more step next to success :)

OdnetninI commented 9 months ago

You need to add the bios and the rom to the argument when running gb.exe

./gb path_to_bios.bin path_to_rom.gb

I will eventually, increase the error detection and give error messages instead of crashing.

Sorry,I just don't know these two stuffs.Could you please elaborate and please figure me out how to fix the issue?There is just one more step next to success :)

Basically, the emulator expects a bios file and the rom you want to play to be included as parameters.

For the bios, just look on Internet for a DMG bios. It should be 256 Bytes. Then, the rom you want to play.

As an example, if the bios file is called dmg00.bin and the rom I want to play is pokered.gb, then I want put those in the same folder as gb.exe and execute:

gb.exe dmg00.bin pokered.gb

And it should start in the same way as a normal gameboy will do.

LukyGuyLucky commented 9 months ago

Got it,I will try.

Thank you so much!

OdnetninI commented 8 months ago

I guess this is solved :)

LukyGuyLucky commented 8 months ago

I guess this is solved :)

Sorry,no,I downloaded several DMG a like files but none of them is ok.Maybe it is harder to do this in Windows vs. In linux.

Really appreicated taking care of this issue.

Regards, Peter

OdnetninI commented 8 months ago

Can you provide more info of what have you tried?

The dmg bios is 256 bytes big.

What error are you facing? Does the window open?

OdnetninI commented 8 months ago

I just pussed a change that allows to play without a BIOS.

Just do ./gb game.gb It should just work.

LukyGuyLucky commented 8 months ago

Can you provide more info of what have you tried?

The dmg bios is 256 bytes big.

What error are you facing? Does the window open?

Sorry,I just could not find the proper file on internet.I searched but only got 2 zip file:GBC Bios(gbc_bios.bin).zip & RetroPieBIOS-master.zip but it seems none of them is the proper file the application want.

LukyGuyLucky commented 8 months ago

I just pussed a change that allows to play without a BIOS.

Just do ./gb game.gb It should just work.

I just tried to compile with the lastes version 0.5.5 ,the compiler complained cart.c3 (E:/Learning/c3pack/Gameboy-Emulator-0309main/ge/src/cart.c3:160:22) Error: 'Mapper' is an interface and has undefined size, please use 'Mapper*' instead. So I do a search & replace and run : c3c build --wincrt=none,it compiled,when I run gb.exe,got this: E:\Learning\c3pack\Gameboy-Emulator-0309main\ge>gb INFO: Initializing raylib 4.5 INFO: Supported raylib modules: INFO: > rcore:..... loaded (mandatory) INFO: > rlgl:...... loaded (mandatory) INFO: > rshapes:... loaded (optional) INFO: > rtextures:. loaded (optional) INFO: > rtext:..... loaded (optional) INFO: > rmodels:... loaded (optional) INFO: > raudio:.... loaded (optional) INFO: AUDIO: Device initialized successfully INFO: > Backend: miniaudio / WASAPI INFO: > Format: 32-bit IEEE Floating Point -> 32-bit IEEE Floating Point INFO: > Channels: 2 -> 2 INFO: > Sample rate: 48000 -> 48000 INFO: > Periods size: 1440 INFO: STREAM: Initialized successfully (48000 Hz, 16 bit, Stereo)

Usage: gb [bios.dmg.bin] rom.gb

BTW: have you ever visit https://c3lang.discourse.group/chat/c/general/2 ? Nothing special,just a easy reference.

OdnetninI commented 8 months ago

I just pussed a change that allows to play without a BIOS. Just do ./gb game.gb It should just work.

Oh, right. I have it updated for the upcoming 0.5.6, sorry about that.

I just tried to compile with the lastes version 0.5.5 ,the compiler complained cart.c3 (E:/Learning/c3pack/Gameboy-Emulator-0309main/ge/src/cart.c3:160:22) Error: 'Mapper' is an interface and has undefined size, please use 'Mapper*' instead. So I do a search & replace and run : c3c build --wincrt=none,it compiled,when I run gb.exe,got this: E:\Learning\c3pack\Gameboy-Emulator-0309main\ge>gb INFO: Initializing raylib 4.5 INFO: Supported raylib modules: INFO: > rcore:..... loaded (mandatory) INFO: > rlgl:...... loaded (mandatory) INFO: > rshapes:... loaded (optional) INFO: > rtextures:. loaded (optional) INFO: > rtext:..... loaded (optional) INFO: > rmodels:... loaded (optional) INFO: > raudio:.... loaded (optional) INFO: AUDIO: Device initialized successfully INFO: > Backend: miniaudio / WASAPI INFO: > Format: 32-bit IEEE Floating Point -> 32-bit IEEE Floating Point INFO: > Channels: 2 -> 2 INFO: > Sample rate: 48000 -> 48000 INFO: > Periods size: 1440 INFO: STREAM: Initialized successfully (48000 Hz, 16 bit, Stereo)

Usage: gb [bios.dmg.bin] rom.gb

Cool, that is working. Please instead of just running gb, run gb game.gb being game.gb the path of the game you want to play.

BTW: have you ever visit https://c3lang.discourse.group/chat/c/general/2 ? Nothing special,just a easy reference.

Thanks, I am there, but not in the chat :P

LukyGuyLucky commented 8 months ago

I am sorry,but what do you mean game.db? Is it something you mentioned before that I should get a proper bois file or something else?As I mentioned,I searched and downloaded a copule of sort of this kind of zip files,but none is correct.May I ask do you have ?Since it is a quite small file,would you please uploaded here?Sorry for that.

Thanks and best regards, Peter

LukyGuyLucky commented 8 months ago

I tried with bgc_bios.bin with gb bgc_bios.bin and got it runs as attached screenshot. Is it working ok? Snipaste_2024-03-10_11-29-43

OdnetninI commented 8 months ago

Good. As I told you, I have updated it to not need a bios file. Look the text in your screenshot: - No BIOS provided, using DMG-0 integrated one

Instead of gbc_bios.bin use a proper gameboy game. For example, if a want to play a rom called: pokemon_red.gb, I will use the following command having pokemon_red.gb in the current directory.

gb pokemon_red.gb

OdnetninI commented 8 months ago

I am sorry,but what do you mean game.db? Is it something you mentioned before that I should get a proper bois file or something else?As I mentioned,I searched and downloaded a copule of sort of this kind of zip files,but none is correct.May I ask do you have ?Since it is a quite small file,would you please uploaded here?Sorry for that.

Thanks and best regards, Peter

I cannot upload it because it is nintendo copyright material. But the the last update, as I told you, you don't need it anymore.

LukyGuyLucky commented 8 months ago

Good. As I told you, I have updated it to not need a bios file. Look the text in your screenshot: - No BIOS provided, using DMG-0 integrated one

Instead of gbc_bios.bin use a proper gameboy game. For example, if a want to play a rom called: pokemon_red.gb, I will use the following command having pokemon_red.gb in the current directory.

gb pokemon_red.gb

Thank you so much for the help.

OdnetninI commented 8 months ago

So.... Is it working?

LukyGuyLucky commented 8 months ago

So.... Is it working?

I am so sorry that I did not make it.Is it need a *.gb file? Acutally I know little about gaming programming.

OdnetninI commented 8 months ago

This is an emulator, it play gameboy games. A .gb file is a gameboy boy game.

Just look online for a gameboy rom and use it as an argument for calling the emulator.