Linux compiling FOR Linux help needed

  • captmurphi
    28th Nov 2012 Member 0 Permalink

    Just to outline the goal here, I want to:

    Compile the newer Powder version 84 (with the sensors and new interface) for Linux.

    Also, I must compile it on my system for Powder to work. The pre-built versions never work properly for my Fedora.

    Do so on a 64 System running Fedora 17 (using provided makefiles I can compile older versions, so it will do it; No question there).

    Compile for Linux only (I don't want Windows and don't want to run WINE for Powder to function [I have reasons]).

     

    What I have:

    I have the necessary libs for compiling Powder (and, as stated, can compile older [x<82] versions).

    I have code::blocks.

    Forked source from jacob1 at github.

    A very limited understanding of c++ (Just started taking a course), but a stubborn mindset.

     

    So far, I have been unable to find any new v84 sources at github that contain a makefile (since that is what I used in the past) or information on how to compile for linux (or at least instructions that are recent, not for cross-compiling, and not debian based).

    I am really hoping that someone might have an idea of what I might be able to do. I have been randomly experimenting and tweaking what I know how to tweak --and also what I don't know how to tweak-- but nothing has worked so far.

     

    Help?

    -Capt.

  • Pilihp64
    28th Nov 2012 Developer 0 Permalink

    Yes, there is no makefile anymore, it is now using scons.

    It was on a new repo for a while, and now back on the original (https://github.com/FacialTurd/The-Powder-Toy)

    As far as I know, it is simply just getting scons installed, then do 'scons --lin --64bit'

    (I have not actually compiled the newest source on linux, someone else may have more info)

  • jacob1
    28th Nov 2012 Developer 0 Permalink
    @Ristovski wrote a tutorial on the wiki for compiling it here. I'm not on linux, so I can't test it, or offer much other advice. Use the source link given above though.

    And the latest source is Simon's, he's the main developer, but I do have a fork which you can compile if you want, but i'm guessing you were just confused since I made the latest commit to the official version.
  • captmurphi
    28th Nov 2012 Member 0 Permalink

    I followed the instructions for compiling with scons and everything looked to be building fine until I received these last few lines:

     

    Traceback (most recent call last):
      File "generator.py", line 206, in <module>
        generateElements()
      File "generator.py", line 123, in generateElements
        f = open("generated/ElementClasses.h", "w")
    IOError: [Errno 2] No such file or directory: 'generated/ElementClasses.h'
    scons: *** [build/generated/ElementClasses.cpp] Error 1
    scons: building terminated because of errors.

    I have looked through github to see if these files didn't download, but I cannot find them there.
    I found a similar error on this thread, but no solution: https://powdertoy.co.uk/Discussions/Thread/View.html?Thread=15341

  • Pilihp64
    28th Nov 2012 Developer 0 Permalink

    @captmurphi (View Post)

    Those files should be auto-created from 'generator.py' (which is called from scons).

    It appears it couldn't write the file, maybe try creating an empty folder named 'generated' to help it out?

  • captmurphi
    28th Nov 2012 Member 0 Permalink

    The folder is auto-genterated when scons is run, but nothing is put into it. I checked permissions, even ran scons with sudo (both with and without the folder being present) -- But I still get the same errors.

    For generator.py

    The error calls at line 123     f = open("generated/ElementClasses.h", "w")

    and error calls at line 206     generateElements()

     

  • boxmein
    28th Nov 2012 Former Staff 0 Permalink
    @captmurphi (View Post)
    It -should- create both your missing headers automatically :P
  • captmurphi
    28th Nov 2012 Member 0 Permalink

         In the generator.py I changed the file paths from and to:

    L123 "generated/ElementsClasses.h" to "build/generated/ElementsClasses.h"

    L127 "generated/ToolClasses.h" to "build/generated/ToolClasses.h

    L198 "generated/ElementsClasses.cpp" to "build/generated/ElementsClasses.cpp"

    L202 "generated/ToolClasses.cpp" to "build/generated/ToolClasses.cpp"

         Now it writes to the generated file (I hope this helps others and not just me), and shows a long list of elements compiling. But...

     

    Now I have to figure out this error:

    build/generated/ElementClasses.o build/generated/ToolClasses.o -lSDL -lpthread -lfftw3f -lbz2 -lz -llua -lpthread -lm -lX11 -lrt
    /usr/bin/ld: skipping incompatible /usr/lib64/libfftw3f.so when searching for -lfftw3f
    /usr/bin/ld: cannot find -lfftw3f
    /usr/bin/ld: skipping incompatible /usr/lib64/libbz2.so when searching for -lbz2
    /usr/bin/ld: cannot find -lbz2
    /usr/bin/ld: skipping incompatible /usr/lib64/libz.so when searching for -lz
    /usr/bin/ld: cannot find -lz
    /usr/bin/ld: skipping incompatible /usr/lib64/liblua.so when searching for -llua
    /usr/bin/ld: skipping incompatible /usr/lib64/liblua.a when searching for -llua
    /usr/bin/ld: cannot find -llua
    collect2: error: ld returned 1 exit status
    scons: *** [build/powder-legacy] Error 1
    scons: building terminated because of errors.

         I am not sure what is going on because I am pretty sure that all my libs are correct. I have built powder using these the same libs I have now before and did not have any issues arise.

  • jacob1
    28th Nov 2012 Developer 0 Permalink
    it looks like those are 64 bit libs, maybe it only is looking for 32 bit ones. I don't know why it does though, or how to make it use the 64 bit ones. --64bit ?
  • captmurphi
    28th Nov 2012 Member 0 Permalink

    I added the 32 bit libraries for fftw and libzip, the output is listed below. Why it won't accept 64bit libraries, I have no clue (all the older versions did) unless --like in the old makefile-- you have to add "-DLUA_R_INCL" and change "-llua5.1" to "-llua". I would like to try that, but I don't know where that information is located. Added the --64bit switch to the scons command, looks good, but still compiling errors as listed below.

    I am also thinking that by making the generator.py write to /build/generated rather than /generated, other files are still looking for the /generated path to pull the ElementClasses.h. But the error below says that src/simulation/Element.h cannot be found (I checked and it is residing there).

    Next step I am going to try is to move /generated from /build/generated (which is where it is located when cloned from github) and place it directly under the make directory and see what happens. <I meant change the generator.py file as to where to build, but that did not work>

     

    g++ -o build/src/PowderToyRenderer.o -c -w -std=c++98 -fkeep-inline-functions -m32 -O3 -ftree-vectorize -funsafe-math-optimizations -ffast-math -fomit-frame-pointer -funsafe-loop-optimizations -Wunsafe-loop-optimizations -D_GNU_SOURCE=1 -D_REENTRANT -DLUACONSOLE -DGRAVFFT -D_GNU_SOURCE -DUSE_STDINT -D_POSIX_C_SOURCE=200112L -DUSE_SDL -DLIN -DX86 -I/usr/include/SDL -Ibuild/src -Ibuild/data -Ibuild/generated build/src/PowderToyRenderer.cpp
    g++ -o build/src/PowderToySDL.o -c -w -std=c++98 -fkeep-inline-functions -m32 -O3 -ftree-vectorize -funsafe-math-optimizations -ffast-math -fomit-frame-pointer -funsafe-loop-optimizations -Wunsafe-loop-optimizations -D_GNU_SOURCE=1 -D_REENTRANT -DLUACONSOLE -DGRAVFFT -D_GNU_SOURCE -DUSE_STDINT -D_POSIX_C_SOURCE=200112L -DUSE_SDL -DLIN -DX86 -I/usr/include/SDL -Ibuild/src -Ibuild/data -Ibuild/generated build/src/PowderToySDL.cpp
    In file included from build/src/simulation/Elements.h:97:0,
                     from build/src/simulation/Simulation.h:15,
                     from build/src/game/GameModel.h:7,
                     from build/src/game/GameView.h:9,
                     from build/src/game/GameController.h:5,
                     from build/src/PowderToySDL.cpp:39:
    build/generated/ElementClasses.h:6:36: fatal error: src/simulation/Element.h: No such file or directory
    compilation terminated.
    scons: *** [build/src/PowderToySDL.o] Error 1
    scons: building terminated because of errors.

    Could this be where the to change -llua5.1 to llua? (I'm checking to see).

     

    scons: Reading SConscript files ...
    Package lua5.1 was not found in the pkg-config search path.
    Perhaps you should add the directory containing `lua5.1.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'lua5.1' found

    Changed L88 in SConscript from --cflags lua5.1 to --cflags lua 

    Gets rid of the lua error message, but I won't know how well it actually works until I can get past the "build/generated/ElementClasses.h:6:36: fatal error: src/simulation/Element.h: No such file or directory"