skmp / reicast-emulator

Reicast was a multiplatform Sega Dreamcast emulator
https://reicast.emudev.org
Other
1.1k stars 344 forks source link

can not compile reicast if path contains space(s) #1169

Open legluondunet opened 6 years ago

legluondunet commented 6 years ago

Hello, I tried to compile Reicast from git source today, but it wouldn't compile. I found the cause: I stored Reicast git sources folder on a path with space. I moved the sources on a path without space and it compiled without error. It's a little bug, it will be easy for you to resolve it, isn't it?

Thanks.

config: Ubuntu 18.04

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/59492653-can-not-compile-reicast-if-path-contains-space-s?utm_campaign=plugin&utm_content=tracker%2F500311&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F500311&utm_medium=issues&utm_source=github).
skmp commented 6 years ago

Good luck figuring that one out :p

skmp commented 6 years ago

jokes aside, we need to take a second look in our build systems

baka0815 commented 6 years ago

@legluondunet could you provide the log file of the failed build?

legluondunet commented 6 years ago

@baka0815 not necessary, if you have a path like this: /home/legluondunet/myemulators/reicast it compiles ok if you have a path with a space: /home/legluondunet/my emulators/reicast type "make" it says it can not find "/home/legluondunet/my" folder

Someone could reproduce this issue?

AbandonedCart commented 6 years ago

So the issue is not with running it, just building? That is fairly common. It seems like this has a fairly simple workaround and is very low priority.

skmp commented 6 years ago

I would still love to see this resolved if someone has the stomach to go through the makefiles

On Tue, 12 Jun 2018 at 11:08, TwistedUmbrella notifications@github.com wrote:

So the issue is not with running it, just building? That is fairly common. It seems like this has a fairly simple workaround and is very low priority.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/reicast/reicast-emulator/issues/1169#issuecomment-396520583, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYAMsCjqyNZBJVwhSB9XDGZeperShQxks5t74UBgaJpZM4Uh04w .

-- ~skmp

baka0815 commented 6 years ago

It's directly the first line: LOCAL_PATH := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))

If my reicast is in "/home//reicast emulator" and I try to run the makefile for Linux, I get the follwing in LOCAL_PATH: /home/<home> emulator/shell/linux. The /reicast part is missing.

skmp commented 6 years ago

prolly miss some “” there

On Tue, 12 Jun 2018 at 13:19, Christoph notifications@github.com wrote:

It's directly the first line: LOCAL_PATH := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))

If my reicast is in "/home//reicast emulator" and I try to run the makefile for Linux, I get the follwing in LOCAL_PATH: /home/ emulator/shell/linux. The /reicast part is missing.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/reicast/reicast-emulator/issues/1169#issuecomment-396554820, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYAMiRA-hLN-170pR4dQd5qessHpWH8ks5t76OkgaJpZM4Uh04w .

-- ~skmp

baka0815 commented 6 years ago

But that's not all. I tried to fix using LOCAL_PATH := $(shell dirname "$(realpath $(lastword $(MAKEFILE_LIST)))") and that gives me the correct value in LOCAL_PATH Also RZDCY_SRC_DIR later on has the correct value, but I still get Makefile:235: emulator/shell/linux/../../core/core.mk: No such file or directory

Using "" around the line like include "$(RZDCY_SRC_DIR)/core.mk" doesn't help.

include "/home/<user>/reicast emulator/shell/linux/../../core/core.mk" doesn't work, however include /home/<user>/reicast\ emulator/shell/linux/../../core/core.mk (escaping the space) works.

baka0815 commented 6 years ago

Looks like it should work using LOCAL_PATH := $(subst ${null} ${null},\${null} ${null},$(shell dirname "$(realpath $(lastword $(MAKEFILE_LIST)))")).

It "should" because I can't test the complete run (using cygwin here just to test, don't have a Linux box here).

AbandonedCart commented 6 years ago

That looks really ugly.

skmp commented 6 years ago

make a PR and let the builbots run?

On Tue, 12 Jun 2018 at 14:08, TwistedUmbrella notifications@github.com wrote:

That looks really ugly.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/reicast/reicast-emulator/issues/1169#issuecomment-396566461, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYAMrfl66TgUvhnQ5hS33UuetSQ3u2uks5t769TgaJpZM4Uh04w .

-- ~skmp

baka0815 commented 6 years ago

@LoungeKatt you could break that up into different lines.

First get the directory preserving spaces (add "") and then replace the space with an escaped space. I'm no Make specialist, but that's what I found out.

LOCAL_PATH := $(shell dirname "$(realpath $(lastword $(MAKEFILE_LIST)))")
LOCAL_PATH := $(subst ${null} ${null},\${null} ${null},$(LOCAL_PATH))
AbandonedCart commented 6 years ago

It's all the ${null} stuff. It's unavoidable, but still looks ugly.

baka0815 commented 6 years ago

I just corrected the lines above, but that's not the only things that need changing. There are also changes to be done to core.mkand maybe others too.

baka0815 commented 6 years ago

Ok, I gave it another go at the core.mk file and the next problem is with the $(foreach function.

But I got that fixed as well and now the path looks good. However it won't compile because make: *** No rule to make target 'obj-dreamcast-x64-sse4_1/hw/arm7/arm7.build_obj', needed by 'reicast.elf'. Stop.. This is the following line in the Makefile: $(BUILDDIR)/%.build_obj : $(RZDCY_SRC_DIR)/%.cpp and I do not know how I should replace that unfortunately. :-(

Those are the values of BUILDDIR and RZDCY_SRC_DIR on the failing build:

BUILDDIR: obj-dreamcast-x64-sse4_1
RZDCY_SRC_DIR: /home/baka/svn/reicast\ emulator/shell/linux/../../core

Those are the values of BUILDDIR and RZDCY_SRC_DIR on the successfull build:

BUILDDIR: obj-dreamcast-x64-sse4_1
RZDCY_SRC_DIR: /home/baka/svn/reicast-emulator/shell/linux/../../core

As you can see the space is correctly escaped, however it's not working.