Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work for out-of-tree builds #4

Closed
marmistrz opened this issue Aug 8, 2020 · 0 comments
Closed

Doesn't work for out-of-tree builds #4

marmistrz opened this issue Aug 8, 2020 · 0 comments

Comments

@marmistrz
Copy link

marmistrz commented Aug 8, 2020

For instance, during Android Linux kernel development, the builds are usually done by a make bootimage is the global repo-workspace. (repo is an Android-specific tool for managing multiple git repositories) This builds the kernel with proper flags and configuration. This affects the paths. For instance:

repo workspace: /path/to/lineage-src
kernel repository and the VS Code workspace: /path/to/lineage-src/kernel/fxtec/msm8998
build artifacts: /path/to/lineage-src/out/target/product/pro1/obj/KERNEL_OBJ/usr/.initramfs_data.cpio.gz.cmd

However, the python script expects the cmd files to be present in the current working directory tree. One can change directory to point to some build artifact directory, but then the relative paths are incorrect. Trying to correct them manually causes some include path errors.

Out of tree builds are nothing new for the Linux kernel and are not Android-specific: https://lwn.net/Articles/90818/


Note: I tried playing around with includePath but it after arriving at:

            "includePath": [
                "${workspaceFolder}/include",
                "${workspaceFolder}/arch/arm64/include",
                "/path/to/lineage/out/target/product/pro1/obj/KERNEL_OBJ/arch/arm64/include/",
                "/path/to/lineage/out/target/product/pro1/obj/KERNEL_OBJ/arch/arm64/include/generated",
                "/path/to/lineage/out/target/product/pro1/obj/KERNEL_OBJ/include/",
                "/path/to/lineage/out/soong/ndk/sysroot/usr/include"
            ]

I ended up having errors like function type is not allowed for bool inside a definition of a struct, so something is completely wrong here


To reproduce, follow https://wiki.lineageos.org/devices/pro1/build, instead of the Start the build step, execute make bootimage in the root of the LineageOS tree. You can probably use some different device, the outcome should be the same.

Here's my compile commands, both vanilla and with paths adjusted.

compile_commands.json.zip
compile_commands_patched.json.zip


EDIT: the following contents of c_cpp_properties.json worked for me:

{
    "configurations": [
        {
            "name": "Linux",
            "cStandard": "c11",
            "intelliSenseMode": "gcc-x64",
            "compileCommands": "${workspaceFolder}/compile_commands.json",
            "defines": ["__KERNEL__"],
            "includePath": [
                "${workspaceFolder}/include",
                "${workspaceFolder}/arch/arm64/include",
                "/marcin/proj/lineage/out/target/product/pro1/obj/KERNEL_OBJ/arch/arm64/include/",
                "/marcin/proj/lineage/out/target/product/pro1/obj/KERNEL_OBJ/arch/arm64/include/generated",
                "/marcin/proj/lineage/out/target/product/pro1/obj/KERNEL_OBJ/include/",
                "/marcin/proj/lineage/out/soong/ndk/sysroot/usr/include"
            ]
        }
    ],
    "version": 4
}
@amezin amezin closed this as completed in 5c73f51 Sep 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant