Giter VIP home page Giter VIP logo

Comments (3)

kyle-sylvestre avatar kyle-sylvestre commented on August 25, 2024

I used msvc on windows very early on for debugging the GDB MI record reader. I'm currently using Ubuntu 20.04 on WSL2, g++ version 9.3, vcxsrv for the X11 server.

I cleaned up the makefile, get the latest commits and check the platform section for the shared library dependencies. GLFW is needed for all platforms, libasan and libubsan are needed only if doing a debug build with -fsanitize=undefined,address. Let me know if you hit any other snags while trying to build.

from tug.

g40 avatar g40 commented on August 25, 2024

Hi Kyle. Thanks again.

Still cannot get a WSL2 build but thought I'd give it a try on Ubuntu 20.04. See screenshot. GLFW test also present just to show OpenGL is all good.

image

So everything is more or less up and running but I cannot get the debugger to load and run a test application.

  1. given a super simple executable tug_t in ./test
  2. start out with ./tug.elf ./test./tug_t.
  3. This fails as GDB apparently ends up trying to attach itself to the spawning process (i.e. tug).

I'd suggest this needs an example tug.ini file to kickstart things. Also drop the .elf file extension if building on linux?

I can do a PR when this works if you are interested.

Steps involved are relatively painless:

  1. Set up a known good GLFW.
git clone https://github.com/glfw/glfw.git && cd glfw
sudo apt install cmake
sudo apt install libx11-dev
sudo apt install libxrandr-dev
sudo apt install libxinerama-dev
sudo apt install libxcursor-dev
sudo apt install libxi-dev
cmake .
make clean
make 
# N.B. there are now also a bunch of applications in ./test i.e. windows
sudo make install 
Install the project...
-- Install configuration: ""
-- Up-to-date: /usr/local/lib/libglfw3.a
-- Up-to-date: /usr/local/include/GLFW
-- Up-to-date: /usr/local/include/GLFW/glfw3.h
-- Up-to-date: /usr/local/include/GLFW/glfw3native.h
-- Up-to-date: /usr/local/lib/cmake/glfw3/glfw3Config.cmake
-- Up-to-date: /usr/local/lib/cmake/glfw3/glfw3ConfigVersion.cmake
-- Up-to-date: /usr/local/lib/cmake/glfw3/glfw3Targets.cmake
-- Up-to-date: /usr/local/lib/cmake/glfw3/glfw3Targets-noconfig.cmake
-- Up-to-date: /usr/local/lib/pkgconfig/glfw3.pc
  1. Make minor changes to Makefile

change LIBS += -lpthread -lGL -lglfw to LIBS += -lpthread -lGL -lglfw3 -ldl

  1. Build with make
~/src/Tug$ make
g++ -I./third-party -I./src -g3 -gdwarf-2 -std=c++11 -Wall -Wformat -Wextra -Wshadow -pedantic -pthread -DDEBUG -O0  -c -o build_debug/main.o src/main.cpp
g++ -I./third-party -I./src -g3 -gdwarf-2 -std=c++11 -Wall -Wformat -Wextra -Wshadow -pedantic -pthread -DDEBUG -O0  -c -o build_debug/gdb.o src/gdb.cpp
g++ -I./third-party -I./src -g3 -gdwarf-2 -std=c++11 -Wall -Wformat -Wextra -Wshadow -pedantic -pthread -DDEBUG -O0  -c -o build_debug/dlmalloc.o third-party/dlmalloc.cpp
third-party/dlmalloc.cpp:1822:5: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
 1822 | #if USE_LOCKS > 1
      |     ^~~~~~~~~
third-party/dlmalloc.cpp:1822:5: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
g++ -I./third-party -I./src -g3 -gdwarf-2 -std=c++11 -Wall -Wformat -Wextra -Wshadow -pedantic -pthread -DDEBUG -O0  -c -o build_debug/imgui.o third-party/imgui/imgui.cpp
g++ -I./third-party -I./src -g3 -gdwarf-2 -std=c++11 -Wall -Wformat -Wextra -Wshadow -pedantic -pthread -DDEBUG -O0  -c -o build_debug/imgui_demo.o third-party/imgui/imgui_demo.cpp
g++ -I./third-party -I./src -g3 -gdwarf-2 -std=c++11 -Wall -Wformat -Wextra -Wshadow -pedantic -pthread -DDEBUG -O0  -c -o build_debug/imgui_draw.o third-party/imgui/imgui_draw.cpp
g++ -I./third-party -I./src -g3 -gdwarf-2 -std=c++11 -Wall -Wformat -Wextra -Wshadow -pedantic -pthread -DDEBUG -O0  -c -o build_debug/imgui_tables.o third-party/imgui/imgui_tables.cpp
g++ -I./third-party -I./src -g3 -gdwarf-2 -std=c++11 -Wall -Wformat -Wextra -Wshadow -pedantic -pthread -DDEBUG -O0  -c -o build_debug/imgui_widgets.o third-party/imgui/imgui_widgets.cpp
g++ -I./third-party -I./src -g3 -gdwarf-2 -std=c++11 -Wall -Wformat -Wextra -Wshadow -pedantic -pthread -DDEBUG -O0  -c -o build_debug/imgui_impl_glfw.o third-party/imgui/imgui_impl_glfw.cpp
g++ -I./third-party -I./src -g3 -gdwarf-2 -std=c++11 -Wall -Wformat -Wextra -Wshadow -pedantic -pthread -DDEBUG -O0  -c -o build_debug/imgui_impl_opengl2.o third-party/imgui/imgui_impl_opengl2.cpp
g++ -o tug.elf build_debug/main.o build_debug/gdb.o build_debug/dlmalloc.o build_debug/imgui.o build_debug/imgui_demo.o build_debug/imgui_draw.o build_debug/imgui_tables.o build_debug/imgui_widgets.o build_debug/imgui_impl_glfw.o build_debug/imgui_impl_opengl2.o -I./third-party -I./src -g3 -gdwarf-2 -std=c++11 -Wall -Wformat -Wextra -Wshadow -pedantic -pthread -DDEBUG -O0  -lpthread -lGL -lglfw3 -ldl
build complete for Linux
  1. Finally run the resulting binary tug.elf. This is just to prove we have a build. GDB errors come next.
~/src/Tug$ ./tug.elf
(src/gdb.cpp : 738 : GDB_SendBlockingInternal) Command Timeout: -list-featuresGNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
Attaching to process 7410
Could not attach to process.  If your uid matches the uid of the target
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf
ptrace: Operation not permitted.
(gdb) 

from tug.

kyle-sylvestre avatar kyle-sylvestre commented on August 25, 2024

ah the .gitignore was blocking my template tug.ini file. Originally I was blocking just the imgui.ini file generated on startup, it should work now (knock on wood).

from tug.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.