RudjiGames / MTuner

MTuner is a C/C++ memory profiler and memory leak finder for Windows, PlayStation 4 and 3, Android and other platforms
BSD 2-Clause "Simplified" License
2.63k stars 145 forks source link

feedback on readme and build instructions #38

Closed didito closed 6 years ago

didito commented 6 years ago

Hi,

I'm trying to build this project since the release version does not work for me - it always hangs (main thread) on finishing the capture (presumably on symbolicating or compression ). Also can't load the capture trace file separately. Without symbols in the release it is hard to tell what is going on. Maybe you should offer them as separate downloads like other projects do. But anyway, that is another story and I might file a separate issue on that if I succeed.

Regarding improving usage instructions. I would mention:

Regarding improving build instructions. I would mention more Qt related infos:

Then on build you rely on your build scripts collection from https://github.com/milostosic/build.git but you do not mention that I need the following prerequisites:

*) Newer Qt versions do not seem to support x86 anymore, so ignore this - maybe I should be able to choose that in the genie call though?

Again, I don't think you need to explain everything (although it would be better) but at least mention those things. Nothing ruins an experience more than not working build instructions. Other than that, great work. Can't wait to use it. The UI seems promising.

milostosic commented 6 years ago

Hi,

Thanks for the feedback! I agree that information on building MTuner could be substantially better... I'll add some notes to readme right away.

Regarding the build project related prerequisites for building Qt projects, this will be addressed as I plan to add examples and documentation for it which should clarify all of that. Qt has deprecated 32bit and I'm doing exactly the same as what you do, both env variables point to the same dir and I only build 64bit. Now, clearly this is a room for improvement in the build project...

Unfortunately I'm quite short on time lately so I cannot commit to any time frame for this :/

edit: GENie executable is included in build: /build/tools/windows/genie.exe

Mistuke commented 6 years ago

Yeah I couldn't figure genie out either. Running it inside the genie directory as the readme says returns me

e:/temp/MTuner/genie/genie.lua:16: attempt to call a nil value (global 'setPlatforms')
stack traceback:
        e:/temp/MTuner/genie/genie.lua:16: in main chunk
        [C]: in upvalue 'builtin_dofile'
        [string "premake = { }..."]:84: in function 'dofile'
        [string "_WORKING_DIR        = os.getcwd()..."]:45: in function '_premake_main'

Running it from the top level gives me


using

genie.exe --cc=gcc gmake


I wanted to build so I could figure out why it's not working with my binary but it seems quite hard to build..

Building configurations...
Running action 'gmake'...
Done. Generated 0/0 projects.

PS, have you considered simplifying the checkout of all the dependencies by using git submodules?

milostosic commented 6 years ago

@Mistuke There is no "--cc" switch, you should use "--gcc", also you can't just say "--gcc=gcc" as this switch is used to specify a GCC 'flavor' - for example mingw-gcc.

I'm actually using submodules but I have another big project that references all MTuner dependencies and MTuner itself as submodules. The problem with this is that I don't want to have the same submodule referenced twice (once by MTuner and once by the MTuner's parent "project")... One thing I considered is to create a new repository which would be just a 'build MTuner' repo where MTuner itself would become a submodule just like it is in my 'main project'.

Mistuke commented 6 years ago

@Mistuke There is no "--cc" switch, you should use "--gcc", also you can't just say "--gcc=gcc" as this switch is used to specify a GCC 'flavor' - for example mingw-gcc.

@milostosic Well I tried cc since --help doesn't show a --gcc option. Using the genie.exe in the repository shows:

Tamar@Yellow /e/t/MTuner> ./build/tools/windows/genie.exe --help
GENie - Project generator tool version 844 (commit 746bd1e9bec0abcb51df6c363a8d3bc493a2c63d)
https://github.com/bkaradzic/GENie

Usage: genie [options] action [arguments]

OPTIONS

 --cc=VALUE        Choose a C/C++ compiler set; one of:
     gcc            GNU GCC (gcc/g++)
     ow             OpenWatcom
     ghs            Green Hills Software
...

and if I try --gcc=mingw-gcc it claims it's not a valid option:

Tamar@Yellow /e/t/M/genie> ./../build/tools/windows/genie.exe --gcc=mingw-gcc gmake
e:/temp/MTuner/genie/genie.lua:16: attempt to call a nil value (global 'setPlatforms')
stack traceback:
        e:/temp/MTuner/genie/genie.lua:16: in main chunk
        [C]: in upvalue 'builtin_dofile'
        [string "premake = { }..."]:84: in function 'dofile'
        [string "_WORKING_DIR        = os.getcwd()..."]:45: in function '_premake_main'

Tamar@Yellow /e/t/M/genie> cd ..

Tamar@Yellow /e/t/MTuner> ./build/tools/windows/genie.exe --gcc=mingw-gcc gmake
Error: invalid option 'gcc'
stack traceback:
        [C]: in function 'error'
        [string "_WORKING_DIR        = os.getcwd()..."]:61: in function '_premake_main'

The problem with this is that I don't want to have the same submodule referenced twice (once by MTuner and once by the MTuner's parent "project")...

Ah ok, that makes sense. I was just wondering when I saw the extra clones that needed to be done :)

milostosic commented 6 years ago

It's complaining that "--gcc=mingw-gcc" isn't a valid option as it, likely, fails to find 'build' project where this toolchain is configured. See toolchain.lua for more info. If this file isn't loaded, then option isn't added.

Now why is it failing to find 'build' project... try adding some debug printf code to this file

Mistuke commented 6 years ago

RIght, my repo layout looks like this

-rw-r--r-- 1 Tamar Tamar   29 Mar 24 21:47 _config.yml
drwxr-xr-x 1 Tamar Tamar    0 Mar 24 21:49 build/
drwxr-xr-x 1 Tamar Tamar    0 Mar 24 22:13 DIA/
drwxr-xr-x 1 Tamar Tamar    0 Mar 30 16:44 genie/
drwxr-xr-x 1 Tamar Tamar    0 Mar 24 21:47 img/
drwxr-xr-x 1 Tamar Tamar    0 Mar 24 21:47 install/
-rw-r--r-- 1 Tamar Tamar 1.3K Mar 24 21:47 LICENSE
-rw-r--r-- 1 Tamar Tamar 2.4K Mar 24 21:47 makefile
drwxr-xr-x 1 Tamar Tamar    0 Mar 24 21:50 MTunerCmd/
drwxr-xr-x 1 Tamar Tamar    0 Mar 24 21:50 MTunerDLL/
drwxr-xr-x 1 Tamar Tamar    0 Mar 24 21:51 MTunerInject/
drwxr-xr-x 1 Tamar Tamar    0 Mar 24 21:49 rbase/
drwxr-xr-x 1 Tamar Tamar    0 Mar 24 21:49 rdebug/
-rw-r--r-- 1 Tamar Tamar 5.4K Mar 24 21:47 README.md
drwxr-xr-x 1 Tamar Tamar    0 Mar 24 21:47 resources/
drwxr-xr-x 1 Tamar Tamar    0 Mar 24 21:50 rmem/
drwxr-xr-x 1 Tamar Tamar    0 Mar 24 21:50 rqt/
drwxr-xr-x 1 Tamar Tamar    0 Mar 24 21:47 src/

but when running the command in the genie folder the first path it tries is ../.. which is already outside of the repo. I dropped the first .. from https://github.com/milostosic/MTuner/blob/master/genie/genie.lua#L6 and it seems to have worked. Thanks!

Mistuke commented 6 years ago

I've noticed the instructions say

cd ../../.build/windows/mingw-gcc/projects/MTuner

should that be

cd ../../.build/windows/mingw-gcc/MTuner/projects/

instead?

I also made a small modification to support msys2 which has much newer GCCs than the toolchains you linked to.

-                       if not os.getenv("MINGW") then
-                               print("Set MINGW environment variable.")
-                       end
+                       if os.getenv("MSYSTEM") == "MINGW64" then
+                               premake.gcc.cc  = "/mingw64/bin/gcc"
+                               premake.gcc.cxx = "/mingw64/bin/g++"
+                               premake.gcc.ar  = "/mingw64/bin/ar"
+                       elseif os.getenv("MSYSTEM") == "MINGW32" then
+                               premake.gcc.cc  = "/mingw32/bin/gcc"
+                               premake.gcc.cxx = "/mingw32/bin/g++"
+                               premake.gcc.ar  = "/mingw32/bin/ar"
+                       else
+                               if not os.getenv("MINGW") then
+                                       print("Set MINGW environment variable.")
+                               end

-                       premake.gcc.cc  = "$(MINGW)/bin/x86_64-w64-mingw32-gcc"
-                       premake.gcc.cxx = "$(MINGW)/bin/x86_64-w64-mingw32-g++"
-                       premake.gcc.ar  = "$(MINGW)/bin/ar"
+                               premake.gcc.cc  = "$(MINGW)/bin/x86_64-w64-mingw32-gcc"
+                               premake.gcc.cxx = "$(MINGW)/bin/x86_64-w64-mingw32-g++"
+                               premake.gcc.ar  = "$(MINGW)/bin/ar"
+                       end

and running

Tamar@Yellow /e/t/M/genie> make config=debug64 -C ../.build/windows/mingw-gcc/MTuner/projects/
make: Entering directory '/e/temp/MTuner/.build/windows/mingw-gcc/MTuner/projects'
==== Building rbase (debug64) ====
==== Building rdebug (debug64) ====
==== Building MTunerCmd (debug64) ====
==== Building rmem (debug64) ====
==== Building MTunerDLL (debug64) ====
==== Building MTunerInject (debug64) ====
make: Leaving directory '/e/temp/MTuner/.build/windows/mingw-gcc/MTuner/projects'

works, but looking at the Makefile, how do you build the main application? I don't see it in the Makefile.

Did I miss something?

milostosic commented 6 years ago

Hi, I've been away from github for a while, sorry about that... Actually, your repo layout is not correct as you cloned all projects within MTuner directory while they should be at the same level as MTuner. I'd suggest taking a look at AppVeyor and travis scripts, those build MTuner on both Windows and Linux.

Mistuke commented 6 years ago

@milostosic ah thanks! I'll take a look at the AppVeyor script.