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

does this project support to compile on WSL ? #87

Open
uyplayer opened this issue Sep 23, 2023 · 1 comment
Open

does this project support to compile on WSL ? #87

uyplayer opened this issue Sep 23, 2023 · 1 comment

Comments

@uyplayer
Copy link

uyplayer commented Sep 23, 2023

uyplayer@UYPLAYER-PC:~/linux/ldd3$ make
for n in misc-progs misc-modules skull scull scullc scullp lddbus sculld scullv shortprint simple tty pci usb sbull snull short; do make -C $n || exit 1; done
make[1]: Entering directory '/home/uyplayer/linux/ldd3/misc-progs'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/uyplayer/linux/ldd3/misc-progs'
make[1]: Entering directory '/home/uyplayer/linux/ldd3/misc-modules'
make -C /lib/modules/5.10.16.3-microsoft-standard-WSL2/build M=/home/uyplayer/linux/ldd3/misc-modules modules
make[2]: Entering directory '/home/uyplayer/linux/ldd3/misc-modules'
make[2]: *** /lib/modules/5.10.16.3-microsoft-standard-WSL2/build: No such file or directory.  Stop.
make[2]: Leaving directory '/home/uyplayer/linux/ldd3/misc-modules'
make[1]: *** [Makefile:20: modules] Error 2
make[1]: Leaving directory '/home/uyplayer/linux/ldd3/misc-modules'
make: *** [Makefile:10: subdirs] Error 1

@uyplayer uyplayer changed the title how to compile in microsoft-standard-WSL2 ? when I compile this project using **make** command in **WSL** , unable to compile Sep 23, 2023
@uyplayer uyplayer changed the title when I compile this project using **make** command in **WSL** , unable to compile does this project support to compile on WSL ? Sep 23, 2023
@ImanSeyed
Copy link
Contributor

ImanSeyed commented Sep 25, 2024

@uyplayer You may have already discovered your answer after a year, but I will explain to others who may have encountered the same error.

The problem with your build process is that /lib/modules/5.10.16.3-microsoft-standard-WSL2/build doesn't exist. This path must include either a symlink or the directory of your Linux kernel source code (containing only the header files should be fine as well). If you had an ordinary Linux distribution you could install a package called linux-headers*, but the version matters, and in WSL2 they use a fork of the Linux kernel, not the mainline one.

Unfortunately, WSL2 does not contain its kernel header files in any of its repositories, therefore you can't compile a kernel module with your default kernel. Packages such as linux-headers-$KVER might work for some cases if you create a symlink manually to what it installs (perhaps? haven't tried it, but it should be fine for the purpose of this repository I believe).

And of course, if linux-headers-$KVER does not work for you, you can clone this repo and build your own kernel. This makes module development much easier (you can setup auto-complete stuff as well with the gen_compile_commands.py script). You can read the build instructions from here.

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

2 participants