I'm building AOSP from source and have created a small C++ program that prints some messages to logcat when started. Now I wanted to debug the program according to https://source.android.com/devices/tech/debug/gdb
In the reference you're encouraged to use lldb in favor of gdb and there is also a short section on using vs code as debugger.
However, I cannot find the mentioned script lldbclient anywhere in my source nor in Android Code Search, only gdbclient.py seems to be present.
Q1: Where can I find lldbclient script?
When running the gdbclient.py script the option --setup-forwarding vscode seems to be ignored and gdb is always started.
Q2: If there isn't a lldbclient script, what options do I have to pass to gdbclient.py to enable debugging with lldb and vs code?
What did I do so far?
gdbclient.py -r /data/mysample_bin --setup-forwarding vscode
Starts my native program with attached gdb and allows me to step through my program.
Though I do not know how to code python, I was able to track down a call sequence in the script to method generate_setup_script, which is called with parameter debugger=gdb. Therefore no lldb configuration for vs code is created. Passing --no-gdb or --lldb to the script doesn't change this behavior.
Q1: You can find lldbclient.py script in the repository https://android.googlesource.com/platform/development, branch android-s-beta-2 (or another android-s branch).
Q2: Android also provides some tutorial debugging with Vscode: https://source.android.com/devices/tech/debug/gdb#vscode.
Related:
How to compile srlua?
How do I Make an executable Lua script using srlua?
The first link is the exact question I am asking here. However, the sole answer is unsatisfactory as it assumes multiple things, namely that the OP is already using Cmake (a fact disproved by the OP's comment on the answer). The second link seems to already be most of the way through a tutorial, and while a link to precompiled binaries for both srlua.exe and srglue.exe are provided, the link no longer contains binaries but instead the source.
I have found several other threads on various websites all asking the same thing, but all of them either assume that you essentially already know how, or explain nothing (many have potentially helpful links, but they are old and no longer work).
I have already tried to compile srlua, and got a srglue.exe, but when I tried srlua.c I ended up with a list of undefined references (such as "lua_type" or "lua_getfield").
lua_getfield, lua_type, lua_settop, lua_getfield, lua_type, lua_settop, lua_pushstring, lua_pushinteger, lua_call, lua_pushfstring, lua_load, lua_tolstring, lua_tointeger, lua_touserdata, luaL_openlibs, lua_createtable, lua_pushstring, lua_rawseti, lua_setfield, luaL_checkstack, lua_pushstring, lua_call, lua_tolstring, luaL_callmeta, lua_type, lua_type, lua_typename, lua_pushfstring, luaL_newstate, lua_pushcclosure, lua_pushcclosure, lua_pushinteger, lua_pushlightuserdata, lua_pcall, lua_tolstring, lua_close
My question is this:
How does one use a C compiler (I know the basics of gcc) to compile srlua specifically? Or, if anyone has a functioning link to either precompiled binaries or a tool to compile the binaries, could they share it?
Important: I am on Windows. Thus, I cannot just use make. I must actually compile the .c files to .exe files. I am asking how. If you simply provide links to threads with the aforementioned problems, you are not helping. If you give an answer that assumes in-depth prior knowledge of a particular tool that does not have good documentation, you are not being helpful. If you tell me tools to use, but not the specific procedure for compiling srlua, you are not being helpful. If there is a better place for this, tell me and I can move it there.
I don't know any Windows pre-compiled binaries for srLua.
To compile srLua, you should first install the Mingw compiler to use GCC as a C compiler : you can install TDM-GCC (https://jmeubank.github.io/tdm-gcc) or http://winlibs.com.
You can then open a Console prompt. Enter the "gcc" command to be sure that the compiler is working (and that the PATH is correctly set).
Then go to the directory you extracted the srLua source files and type the command :
mingw32-make
Cross your fingers and it should compile everything :)
When linking, you should include the Lua libraries with the -l Switch : -llua54 for Lua 5.4 library for examples.
I found this already compiled release on webarchive, it's kinda old but works:
https://web.archive.org/web/20130721014948/http://www.soongsoft.com/lhf/lua/5.1/srlua.tgz
I have installed MinGW on my windows7 machine, using instructions from here. Basically I used the GUI installer assistant called mingw-get-setup.exe. The installation manager allowed me to select a package called mingw32-libpthreadgc which installs bin/pthreadGC2.dll and bin/pthreadGCE2.dll.
To my knowledge that is not sufficient to compile code depending on the pthread library. E.g. trying to compile a file with a header-include like #include "pthread.h" - to no surprise - results in a "file not found" compile error. I can't find that header in my MinGW directory. If I use includes/headers from elsewhere, I'm afraid they might not match with the DLL's interface. How is this meant to be working?
(Furthermore I like to use CodeBlocks as the IDE. How would I set up a simple "HelloWorld"-like pthread program to get it all to work? There seems to be a lot of conflicting messages out there on how to set it up. Use "-pthread" vs "-lpthread". Set it in compiler and linker settings, right? Copy-paste the DLL's? What else???)
I had similar problem, https://www.sourceware.org/pthreads-win32/ this did job for me,
I used this in combination with mingw32. It also has nice README file.
Thinking about NetBeans or Eclipse I was wondering how an IDE compiles code when you click run. Does it open a command line in the background to compile it? How exactly does it work?
Each IDE will have it's own approach for how they actually achieve compilation. Usually they will have their own compilers or wrappers around existing compilers to which they delegate actual compilation.
Eclipse comes with a built in compiler of its own:
How does Eclipse compile classes with only a JRE?
I don't actually personally know much about how other ones achieve the compilation in any detail; somebody else may provide a better answer in that regard.
IDEs use compilers. That's actually the difference between them.
For instance, Code::Blocks uses MinGW Compiler which is a port of the GCC set of compilers.
Every compiler has its own method, some use their own wrappers and ports for known compilers. (See Codeblocks)
I also noticed that some basic IDEs out there, just run the simple command line using gcc, clang, etc and let you pass parameters from an option window.
I am trying to compile a gcc project on cygwin for the first time. The build is failing, because an underbar is being prefixed to all symbols. This is causing a symbol mismatch to the GLIB library (installed via CYGWIN package management system) which does not have the leading underbar. Is this tendency to place a leading underbar documented in some place?
Use -fleading-underscore and/or -fno-leading-underscore to get the behaviour you want. This question has a lot of information related to what you're doing.
Cygwin's compiler does this because Visual C++ does. They're trying to minimize the number of needless differences between the two, to aid linking code built with one to code built with the other. There are often other things that prevent you from using Cygwin code with Visual C++ and vice versa, but this isn't one of them.