lronaldo / cpctelera

Astonishingly fast Amstrad CPC game engine for C developers
http://lronaldo.github.io/cpctelera/
GNU Lesser General Public License v3.0
222 stars 53 forks source link

Problem trying to install cpctelera in cygwin (on windows 11) #170

Closed chipacoxyz closed 10 months ago

chipacoxyz commented 11 months ago

I'm having an error with a cpctelera's tool (sdcc) when running the setup.sh.

I installed Cygwin from the official website and followed the installation instructions exactly. I also downloaded the dependencies from the cocktailer website. I cloned the project repository, switched to the development branch, and executed the setup.sh script. The program starts up, but then it throws an error.

The error:

Welcome to...
 ____     ____     ____     __            ___
/\  _`\  /\  _`\  /\  _`\  /\ \__        /\_ \
\ \ \/\_\\ \ \L\ \\ \ \/\_\\ \ ,_\     __\//\ \       __   _ __    __
 \ \ \/_/_\ \ ,__/ \ \ \/_/_\ \ \/   /'__`\\ \ \    /'__`\/\`'__\/'__`\
  \ \ \L\ \\ \ \/   \ \ \L\ \\ \ \_ /\  __/ \_\ \_ /\  __/\ \ \//\ \L\.\_
   \ \____/ \ \_\    \ \____/ \ \__\\ \____\/\____\\ \____\\ \_\\ \__/.\_\
    \/___/   \/_/     \/___/   \/__/ \/____/\/____/ \/____/ \/_/ \/__/\/_/

This setup script will help you configure CPCtelera in your system.

===============================================================
== 1: CPCtelera initial tests
===============================================================
> Checking directory structure... [ OK ]
> Checking important files....... [ OK ]
> Checking required commands...
>>> Looking for 'gcc'... [ OK ]
>>> Looking for 'g++'... [ OK ]
>>> Looking for 'make'... [ OK ]
>>> Looking for 'bison'... [ OK ]
>>> Looking for 'flex'... [ OK ]
> Checking command versions...
>>> GNU GCC/G++ Version >= 4.6... [ OK ]
> Checking required libraries...
>>> Looking for 'boost/graph/adjacency_list.hpp'... [ OK ]
>>> Looking for 'libintl.h'... [ OK ]
Everything seems to be OK.

===============================================================
== 2: Building CPCtelera tools, z80 library and examples
===============================================================
> Proceeding to build required tools to build and manage CPCtelera and other software for Amstrad CPC (This might take a while, depending on your system).
>>> Building compilation tools:                                            0%

#########################
## UNRECOVERABLE ERROR ##
#########################
##> There was an error building CPCtelera tools. Please, check '/home/chipacu/cpctelera/cpctelera/logs/tool_building.log' for details. Aborting.

The log:

cat /home/chipacu/cpctelera/cpctelera/logs/tool_building.log
make: Entering directory '/home/chipacu/cpctelera/cpctelera/tools'
[ToolMaker] Building  2cdt...
make[1]: Entering directory '/home/chipacu/cpctelera/cpctelera/tools/2cdt'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/chipacu/cpctelera/cpctelera/tools/2cdt'
[ToolMaker] Building  hex2bin-2.0...
make[1]: Entering directory '/home/chipacu/cpctelera/cpctelera/tools/hex2bin-2.0'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/chipacu/cpctelera/cpctelera/tools/hex2bin-2.0'
[ToolMaker] Building  iDSK-0.13...
make[1]: Entering directory '/home/chipacu/cpctelera/cpctelera/tools/iDSK-0.13'
make[1]: 'bin/iDSK' is up to date.
make[1]: Leaving directory '/home/chipacu/cpctelera/cpctelera/tools/iDSK-0.13'
[ToolMaker] Building  sdcc-3.6.8-r9946...
make[1]: Entering directory '/home/chipacu/cpctelera/cpctelera/tools/sdcc-3.6.8-r9946'
Configuring SDCC for z80...
cd src && ./configure_sdcc_for_z80.sh
./configure_sdcc_for_z80.sh: line 20: $'\r': command not found
./configure_sdcc_for_z80.sh: line 31: $'\r': command not found
./configure_sdcc_for_z80.sh: line 36: $'\r': command not found
./configure_sdcc_for_z80.sh: line 40: $'\r': command not found
./configure_sdcc_for_z80.sh: line 43: $'\r': command not found
./configure_sdcc_for_z80.sh: line 45: cd: $'/home/chipacu/cpctelera/cpctelera/tools/sdcc-3.6.8-r9946/src/../\r': No such file or directory
: invalid option_for_z80.sh: line 47: cd: -
cd: usage: cd [-L|[-P [-e]] [-@]] [dir]
./configure_sdcc_for_z80.sh: line 48: $'\r': command not found
./configure_sdcc_for_z80.sh: line 54: $'\r': command not found
./configure_sdcc_for_z80.sh: line 88: syntax error: unexpected end of file
make[1]: *** [Makefile:59: sdcc] Error 2
make[1]: Leaving directory '/home/chipacu/cpctelera/cpctelera/tools/sdcc-3.6.8-r9946'
make: *** [Makefile:74: sdcc-3.6.8-r9946] Error 2
make: Leaving directory '/home/chipacu/cpctelera/cpctelera/tools'

I think it's an error caused by Windows' handling of spaces and line breaks. I've tried to fix it by converting the file to a Windows format (a bit hackish) using the unix2dos utility, but it didn't work.

Other details: I can provide more details if necessary. I'm giving up for now. I've tried everything I can think of, and I'm going to use the Manjaro virtual machine. This is a viable solution, but it's not ideal because it requires a lot of resources and can affect my silly idea of good performance 😅.

As a side note: I tried to use WSL2, but I couldn't get RetroVirtualMachine to work. I might have to make a separate issue for that later. I apologize for the length of this message. I tried to include everything that might be helpful, but if you need anything else, please let me know.

chipacoxyz commented 11 months ago

I didn't realize I wrote the issue in Spanish so that people from other countries can understand it. I'm sorry, if necessary, you can translate it with a translator. Thanks.

⏖⏖⏖

I have edited my previous post, it is now in English.

lronaldo commented 10 months ago

With respect to the language, you may edit your post and translate it to english, if you don't mind :). You may even use automatic tools. That would be perfectly ok :)

Your problem may come from these sources:

  1. You have used a windows tool to download or unpack CPCtelera files, and it has introduced \r\n carriage returns in the configure sdcc script.
  2. You are not using cygwin terminal to perform the instalation.
  3. You are most probably trying to install CPCtelera master (1.4) which is 4 years old and outdated. Please, try installing CPCtelera 1.5 (develpment branch).
  4. If you did use git to download CPCtelera, your system's path is configured in a manner in which you are using Windows' version of git instead of cygwin's, even if you are using it from the cygwin terminal (that happens, I have seen it several times).

In order to launch RetroVM from WSL2, you need to change the script so that it uses Windows' version and not Linux's (which is what it tries to do under WSL2). It's a simple change to the script and has already been discussed.

Please, check these points (specially 3) and come back with your results :).

chipacoxyz commented 10 months ago

Finally I was able to fix it!

As you said, it was a problem with cygwin's git. I fixed it with wsl2 by positioning myself in the cygwin home cygpath -w ~ and cloning it there. It worked the first time. I don't know why cygwin uses Windows git instead of its own binary, it must be the nature of the program. I need to read more about how cygwin works... It was funny, I almost had a heart attack when I typed git --version and it shows git version 2.41.0.windows.1 😅, now I'm ready to use cpctelera on windows! Thank you very much, professor!

Should I close the issue or you will close it?

lronaldo commented 10 months ago

The problem is usually related to Windows' PATH environment variable, not cygwin. Usually, PATH points to Windows' git folder before cygwin's folder, which makes it be picked with preference. As simple as that :).

Enjoy CPCtelera and hope to see your creations soon :)

chipacoxyz commented 8 months ago

In order to launch RetroVM from WSL2, you need to change the script so that it uses Windows' version and not Linux's (which is what it tries to do under WSL2). It's a simple change to the script and has already been discussed.

I've been looking for a way to make the cpct_rvm script work on wsl2, It was a bit tricky to me to find information, but thanksfully a little CarlSonic1230's youtube comment appeared and made me realize that the redirections in the script doesnt work well on wsl, and I also got an issue with some wsl interop caused by the mono package.

Everything working now.

I've created a gist file explaining everything done step by step to get my personal adapt. Similar to franky52's one, but working 😋.

https://gist.github.com/chipacoxyz/1d304cab190849864dba563517719685

I wish It works for any new cpctelera learner with wsl2 😉.