Termux #1278
Replies: 2 comments 13 replies
-
Interesting! May I ask what is the motivation for wanting to run VSCode directly on the Android device?
One of my goals is to make CodeLLDB as portable as practically possible across various Linux distros and their versions. So I'm linking everything statically, except for the required and very common shared libraries. To ensure that nothing else creeps in, the test suite validates that CodeLLDB has only whitelisted runtime dependencies. |
Beta Was this translation helpful? Give feedback.
-
For your final step I found that linking the binary didn't work. Had better luck creating an So the commands would be:
cd ~/.vscode-oss/extensions/vadimcn.vscode-lldb-*/
mv lldb lldb-bin
mkdir -p lldb/lib
ln -sf /data/data/com.termux/files/usr/lib/liblldb.so lldb/lib/liblldb.so I don't personally care about vscode either since I'm using it with nvim but I'm afraid I have no idea which steps, if any are unnecessary and if I can do any significant cleanup after these steps to reduce the storage footprint. Would appreciate any advice. For any other lost soul on their termux nvim debugger journey I went with nvchad and made a % cat .config/nvim/lua/plugins/dap.lua
return {
{ "julianolf/nvim-dap-lldb",
dependencies = { "mfussenegger/nvim-dap" }, },
{ "mfussenegger/nvim-dap",
dependencies = { "leoluz/nvim-dap-go",
"rcarriga/nvim-dap-ui", "nvim-neotest/nvim-nio",
"williamboman/mason.nvim",
}, config = function() local dap = require "dap"
local ui = require "dapui"
require("dapui").setup()
require("dap-go").setup() dap.adapters.lldb = {
type = "executable", command = "/data/data/com.termux/files/home/.vscode-oss/extensions/vadimcn.vscode-lldb-1.11.4-dev.2508092032/adapter/codelldb", name = "lldb"
}
dap.configurations.cpp = {
{
name = "Launch C++ file",
type = "lldb",
request = "launch",
program = function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
end,
cwd = "${workspaceFolder}",
stopOnEntry = false,
args = {},
runInTerminal = false,
}
}
-- More setup here
}
} |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Important
This is now upstreamed to Termux, making manual building no longer necessary.
You can get the precompiled build with these commands:
A slightly more in-depth guide for
code-server
is now here:Termux is a complete Terminal Emulator Application and distribution of
bash
,apt
,nodejs
,cargo
,rustc
,clang
,lldb
,make
,cmake
, X11 Server andcode-oss
for Android.With Termux, cross-compilation becomes optional, instead of required, for writing, building, and debugging C, C++, and Rust on Android.
Unlike the situation near the beginning of Android's lifecycle (2010-2015), a second device other than Android is no longer necessarily required.
I am going to write the full steps that I used to successfully compile, install and use codelldb entirely inside of Termux, which is to say, to use codelldb on Android with cross-compilation entirely disabled, as opposed to the standard Android development workflow which normally requires the use of cross-compilation at some point.
Unfortunately, the steps are a little bit messy, and I am not completely sure yet if all of these steps and patches are absolutely required or if some of them can be removed or refactored to streamline the installation process in a better way, but this is what is initially working for me so I wanted to share this.
Install Dependencies
Note
pkg install tur-repo
to getcode-oss
might not be required in the future eventually after this series of events has concluded:Retrieve Code
Note
Last designed and tested for codelldb commit 8aa3be2
Apply Patch
Note
I created this patch onto codelldb to implement Android support.
I am not sure about this part:
AllowedDependencies
. I do not understand what that is for, so the list of things I typed there is just guessing.Fetch Cargo Crates and
sed
-patchweaklink
Note
This Cargo Crate, https://github.com/vadimcn/weaklink, was designed only for GNU/Linux, and must be patched in the "treat Android as Linux" style in order to avoid build errors.
Set Environment Variables
Note
These environment variables helped me bypass errors during the build process
Configure and Build
Note
The codelldb documentation states "You will get linker errors if you don't use the toolchain file", but for some reason, it seems to still work for me even though I didn't technically use
-DCMAKE_TOOLCHAIN_FILE
. I am not sure exactly why.Install
.vsix
Note
For some reason, the
lldb
binary does not get placed in the necessary location automatically after--install-extension
, so I use another command to create a symbolic link to the original location, which appears to work.Done
Note
After the above steps,
code-oss
shows that codelldb is installed for me, and it begins working in the "run and debug" menu exactly the same as it works on VSCodium on GNU/Linux! Here is an example of how to launchcode-oss
in the Termux:X11 app, but I suspect that other editors that do not necessarily require X11, likecode-server
frompkg install code-server
, might also work with it!Beta Was this translation helpful? Give feedback.
All reactions