Unable to build due to spaces in file names

Issue #96 new
Former user created an issue

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:

==== Building Tut 08 Gimbal Lock (debug) ====
Creating obj/Debug/Tut 08 Gimbal Lock
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:

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

that produces this kind of command:

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.

Comments (4)

  1. Jason McKesson repo owner

    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?

  2. InĂªs Almeida

    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.

    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

  3. Christoph Hoffmann

    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

    $ 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

  4. Log in to comment