paroj / gltut

Learning Modern 3D Graphics Programming
https://paroj.github.io/gltut/
MIT License
1.57k stars 377 forks source link

Unable to build due to spaces in file names #65

Closed paroj closed 2 years ago

paroj commented 11 years ago

Originally reported by: Anonymous


I'm using Slackware Linux and GNU make to try and build the tutorials. I can build the glsdk and the framework both in Release and Debug mode. The tutorials fail with this kind of error:

#!log

==== Building Tut 08 Gimbal Lock (debug) ====
Creating obj/Debug/Tut 08 Gimbal Lock
GimbalLock.cpp
g++: error: 08: No such file or directory
g++: error: Gimbal: No such file or directory
g++: error: Lock/GimbalLock.d: No such file or directory
make[1]: *** [obj/Debug/Tut 08 Gimbal Lock/GimbalLock.o] Error 1
make: *** [Tut 08 Gimbal Lock] Error 2

Delving a little deeper, the problem is caused by this line (3rd) in the makefiles:

#!makefile

$(OBJDIR)/GimbalLock.o: GimbalLock.cpp
    @echo $(notdir $<)
    $(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -MF $(@:%.o=%.d) -c "$<"

that produces this kind of command:

#!log

g++ -MMD -MP -D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -DTIXML_USE_STL -DFREEGLUT_STATIC -DLOAD_X11 -D_LIB -DFREEGLUT_LIB_PRAGMAS=0 -DDEBUG -D_DEBUG -I../framework -I../glsdk/glload/include -I../glsdk/glimg/include -I../glsdk/glm -I../glsdk/glutil/include -I../glsdk/glmesh/include -I../glsdk/freeglut/include  -g  -o "obj/Debug/Tut 08 Gimbal Lock/GimbalLock.o" -MF obj/Debug/Tut 08 Gimbal Lock/GimbalLock.d -c "GimbalLock.cpp"

The problem is caused by the whitespace here: '-MF obj/Debug/Tut 08 Gimbal Lock/GimbalLock.d', adding quotes to $(@:%.o=%.d) in the Makefiles would solve the problem.

I couldn't find anyone else with this problem, but I have reproduced it in several machines.


paroj commented 9 years ago

Original comment by Daniel Gibson (Bitbucket: DGibson, GitHub: DGibson):


This is a bug in premake, see my comment at https://bitbucket.org/premake/premake-4.x/commits/7e583c84a367985227e0865bedfda6315416e288

Still, spaces in paths should be avoided.

paroj commented 10 years ago

Original comment by Christoph Hoffmann (Bitbucket: choffmann123, GitHub: Unknown):


hello, i had the same problem. adding "$(@:%.o=%.d)" solved my problem. unfortunately this has to be done to all probjects. additionally it will be overwritten if new makfiles will be generated.

my premake version

#!shell

$ premake4 --version
premake4 (Premake Build Script Generator) 4.4.0-beta4.3 premake-stable@15a1bd2 with ryanjmulder/vs2013@d22f2b4 and ryanjmulder/codelite-library-with-dots-in-filename2@4bfa3c1

a small recommendation: never ever put spaces in paths and/or file names. too many applications still have problems with this. even firefox couldn't open the html until i replaced the space in the root folder 'Tutorial 0.3.8'

still, many thanks for your tutorial

paroj commented 11 years ago

Original comment by Inês Almeida (Bitbucket: brita, GitHub: brita):


I have version 4.4-beta4 for 64bits of Premake.

I also don't know why this happens or what to change in the premake config to make it right (I've never used it as a developer). I just used a 'kick and dirty' solution for this: made a script that replaces all occurrences of that token in all Makefiles to include quotes.

#!bash

find -name 'Tut*.make' -exec  sed -i 's/-MF $(@:%.o=%.d)/-MF "$(@:%.o=%.d)"/g' {} \;

A rule for Tut* .make and another for Makefiles inside of the Tut * folders

paroj commented 11 years ago

Original comment by Jason McKesson (Bitbucket: alfonse, GitHub: alfonse):


Unfortunately, this appears to be a Premake4 issue. I don't have control over that project, so there's not much I can do about it.

My own build under Ubuntu and later Mint seems to work, so I don't know what it is that causes it to not work for you. Are you sure you're using version 4.3 of Premake?

Jose123456 commented 5 years ago

The Bitbucket repo for Premake is gone. The change that fixed this problem was checked in to the Github Premake-4 repo here:

https://github.com/premake/premake-4.x/commit/a9141dee8f470f624574f4e7a0fadac20a83a0db

Unfortunately that was after the last Premake 4.4 beta was cut 5 years ago.

Zaela24 commented 4 years ago

If anyone else runs into this issue (especially if you're using VS instead of GNU to build the project), I updated all the project files and .lua files in my fork to no longer include spaces, and added build instructions to the readme; I also added links to premake4 and glsdk in the readme so that it's all in one place.

Here's the fork: https://github.com/Zaela24/gltut

paroj commented 2 years ago

fixed by #134