关于VM虚拟机在Linux下安装的一个小问题

前言

系统

问题和解决方案

问题1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
make: 进入目录“/tmp/modconfig-3bVkgp/vmmon-only”
Using kernel build system.
/usr/bin/make -C /lib/modules/5.17.5-76051705-generic/build/include/.. M=$PWD SRCROOT=$PWD/. \
MODULEBUILDDIR= modules
make[1]: 进入目录“/usr/src/linux-headers-5.17.5-76051705-generic”
CC [M] /tmp/modconfig-3bVkgp/vmmon-only/linux/driver.o
CC [M] /tmp/modconfig-3bVkgp/vmmon-only/linux/driverLog.o
CC [M] /tmp/modconfig-3bVkgp/vmmon-only/linux/hostif.o
CC [M] /tmp/modconfig-3bVkgp/vmmon-only/common/apic.o
In file included from /tmp/modconfig-3bVkgp/vmmon-only/common/apic.c:19:
/tmp/modconfig-3bVkgp/vmmon-only/./include/vm_basic_defs.h:54:12: fatal error: stddef.h: 没有那个文件或目录
54 | # include <stddef.h>
| ^~~~~~~~~~
compilation terminated.
make[2]: *** [scripts/Makefile.build:288:/tmp/modconfig-3bVkgp/vmmon-only/common/apic.o] 错误 1
make[2]: *** 正在等待未完成的任务....
In file included from /tmp/modconfig-3bVkgp/vmmon-only/linux/driverLog.h:33,
from /tmp/modconfig-3bVkgp/vmmon-only/linux/driverLog.c:31:
/tmp/modconfig-3bVkgp/vmmon-only/./include/vm_assert.h:43:10: fatal error: stdarg.h: 没有那个文件或目录
43 | #include <stdarg.h>
| ^~~~~~~~~~
compilation terminated.
make[2]: *** [scripts/Makefile.build:288:/tmp/modconfig-3bVkgp/vmmon-only/linux/driverLog.o] 错误 1
In file included from /tmp/modconfig-3bVkgp/vmmon-only/./include/cpu_types.h:29,
from /tmp/modconfig-3bVkgp/vmmon-only/./include/modulecall.h:33,
from /tmp/modconfig-3bVkgp/vmmon-only/linux/hostif.c:58:
/tmp/modconfig-3bVkgp/vmmon-only/./include/vm_basic_defs.h:54:12: fatal error: stddef.h: 没有那个文件或目录
54 | # include <stddef.h>
| ^~~~~~~~~~
compilation terminated.
make[2]: *** [scripts/Makefile.build:288:/tmp/modconfig-3bVkgp/vmmon-only/linux/hostif.o] 错误 1
In file included from /tmp/modconfig-3bVkgp/vmmon-only/linux/driverLog.h:33,
from /tmp/modconfig-3bVkgp/vmmon-only/linux/driver.c:46:
/tmp/modconfig-3bVkgp/vmmon-only/./include/vm_assert.h:43:10: fatal error: stdarg.h: 没有那个文件或目录
43 | #include <stdarg.h>
| ^~~~~~~~~~
compilation terminated.
make[2]: *** [scripts/Makefile.build:288:/tmp/modconfig-3bVkgp/vmmon-only/linux/driver.o] 错误 1
make[1]: *** [Makefile:1837:/tmp/modconfig-3bVkgp/vmmon-only] 错误 2
make[1]: 离开目录“/usr/src/linux-headers-5.17.5-76051705-generic”
make: *** [Makefile:117:vmmon.ko] 错误 2
make: 离开目录“/tmp/modconfig-3bVkgp/vmmon-only”
make: 进入目录“/tmp/modconfig-3bVkgp/vmnet-only”

解决方案

1
2
3
4
5
6
7
8
9
find /usr -type f | grep stdarg.h

➜ /tmp find /usr -type f | grep stdarg.h
/usr/lib/gcc/x86_64-linux-gnu/11/include/stdarg.h
/usr/lib/gcc/x86_64-linux-gnu/11/include/cross-stdarg.h
/usr/src/linux-headers-5.17.5-76051705/include/linux/stdarg.h
/usr/src/virtualbox-6.1.32/include/iprt/stdarg.h
/usr/src/linux-headers-5.16.19-76051619/include/linux/stdarg.h
/usr/include/c++/11/tr1/stdarg.h

找到头文件的位置之后 在运行vmware-modconfig时包含进去

1
sudo CPATH=/usr/lib/gcc/x86_64-linux-gnu/11/include/ vmware-modconfig --console --install-all

问题2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
make: 进入目录“/tmp/modconfig-Y3VkRY/vmmon-only”
Using kernel build system.
/usr/bin/make -C /lib/modules/5.16.19-76051619-generic/build/include/.. M=$PWD SRCROOT=$PWD/. \
MODULEBUILDDIR= modules
make[1]: 进入目录“/usr/src/linux-headers-5.16.19-76051619-generic”
CC [M] /tmp/modconfig-Y3VkRY/vmmon-only/linux/driver.o
CC [M] /tmp/modconfig-Y3VkRY/vmmon-only/linux/driverLog.o
CC [M] /tmp/modconfig-Y3VkRY/vmmon-only/linux/hostif.o
CC [M] /tmp/modconfig-Y3VkRY/vmmon-only/common/apic.o
CC [M] /tmp/modconfig-Y3VkRY/vmmon-only/common/comport.o
CC [M] /tmp/modconfig-Y3VkRY/vmmon-only/common/cpuid.o
CC [M] /tmp/modconfig-Y3VkRY/vmmon-only/common/crosspage.o
CC [M] /tmp/modconfig-Y3VkRY/vmmon-only/common/memtrack.o
CC [M] /tmp/modconfig-Y3VkRY/vmmon-only/common/moduleloop.o
CC [M] /tmp/modconfig-Y3VkRY/vmmon-only/common/phystrack.o
/tmp/modconfig-Y3VkRY/vmmon-only/common/phystrack.o: warning: objtool: PhysTrack_Free() falls through to next function PhysTrack_Add()
/tmp/modconfig-Y3VkRY/vmmon-only/common/phystrack.o: warning: objtool: PhysTrack_Add() falls through to next function PhysTrack_Remove()
/tmp/modconfig-Y3VkRY/vmmon-only/common/phystrack.o: warning: objtool: PhysTrack_Remove() falls through to next function PhysTrack_Test()
CC [M] /tmp/modconfig-Y3VkRY/vmmon-only/common/sharedAreaVmmon.o
CC [M] /tmp/modconfig-Y3VkRY/vmmon-only/common/statVarsVmmon.o
CC [M] /tmp/modconfig-Y3VkRY/vmmon-only/common/task.o
CC [M] /tmp/modconfig-Y3VkRY/vmmon-only/common/vmx86.o
CC [M] /tmp/modconfig-Y3VkRY/vmmon-only/bootstrap/bootstrap.o
CC [M] /tmp/modconfig-Y3VkRY/vmmon-only/bootstrap/monLoader.o
CC [M] /tmp/modconfig-Y3VkRY/vmmon-only/bootstrap/monLoaderVmmon.o
In file included from /tmp/modconfig-Y3VkRY/vmmon-only/./include/x86desc.h:33,
from /tmp/modconfig-Y3VkRY/vmmon-only/./include/modulecall.h:34,
from /tmp/modconfig-Y3VkRY/vmmon-only/common/task.c:60:
/tmp/modconfig-Y3VkRY/vmmon-only/common/task.c: In function ‘TaskRestoreHostGDTTRLDT’:
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_asm_x86.h:67:44: error: expression in static assertion is not constant
67 | ASSERT_ON_COMPILE(sizeof(Selector) == 2 && \
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
68 | ((__builtin_constant_p(expr) && ((expr) >> 16) == 0) || \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69 | sizeof(expr) <= 2))
| ~~~~~~~~~~~~~~~~~~
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_assert.h:372:22: note: in definition of macro ‘ASSERT_ON_COMPILE’
372 | _Static_assert(e, #e); \
| ^
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_asm_x86.h:263:7: note: in expansion of macro ‘ASSERT_ON_COMPILE_SELECTOR_SIZE’
263 | ASSERT_ON_COMPILE_SELECTOR_SIZE(expr); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/modconfig-Y3VkRY/vmmon-only/common/task.c:726:7: note: in expansion of macro ‘SET_TR’
726 | SET_TR(tr);
| ^~~~~~
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_asm_x86.h:67:44: error: expression in static assertion is not constant
67 | ASSERT_ON_COMPILE(sizeof(Selector) == 2 && \
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
68 | ((__builtin_constant_p(expr) && ((expr) >> 16) == 0) || \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69 | sizeof(expr) <= 2))
| ~~~~~~~~~~~~~~~~~~
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_assert.h:372:22: note: in definition of macro ‘ASSERT_ON_COMPILE’
372 | _Static_assert(e, #e); \
| ^
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_asm_x86.h:129:7: note: in expansion of macro ‘ASSERT_ON_COMPILE_SELECTOR_SIZE’
129 | ASSERT_ON_COMPILE_SELECTOR_SIZE(expr); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/modconfig-Y3VkRY/vmmon-only/common/task.c:728:7: note: in expansion of macro ‘SET_LDT’
728 | SET_LDT(ldt);
| ^~~~~~~
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_asm_x86.h:67:44: error: expression in static assertion is not constant
67 | ASSERT_ON_COMPILE(sizeof(Selector) == 2 && \
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
68 | ((__builtin_constant_p(expr) && ((expr) >> 16) == 0) || \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69 | sizeof(expr) <= 2))
| ~~~~~~~~~~~~~~~~~~
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_assert.h:372:22: note: in definition of macro ‘ASSERT_ON_COMPILE’
372 | _Static_assert(e, #e); \
| ^
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_asm_x86.h:263:7: note: in expansion of macro ‘ASSERT_ON_COMPILE_SELECTOR_SIZE’
263 | ASSERT_ON_COMPILE_SELECTOR_SIZE(expr); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/modconfig-Y3VkRY/vmmon-only/common/task.c:751:10: note: in expansion of macro ‘SET_TR’
751 | SET_TR(tr);
| ^~~~~~
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_asm_x86.h:67:44: error: expression in static assertion is not constant
67 | ASSERT_ON_COMPILE(sizeof(Selector) == 2 && \
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
68 | ((__builtin_constant_p(expr) && ((expr) >> 16) == 0) || \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69 | sizeof(expr) <= 2))
| ~~~~~~~~~~~~~~~~~~
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_assert.h:372:22: note: in definition of macro ‘ASSERT_ON_COMPILE’
372 | _Static_assert(e, #e); \
| ^
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_asm_x86.h:129:7: note: in expansion of macro ‘ASSERT_ON_COMPILE_SELECTOR_SIZE’
129 | ASSERT_ON_COMPILE_SELECTOR_SIZE(expr); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/modconfig-Y3VkRY/vmmon-only/common/task.c:761:7: note: in expansion of macro ‘SET_LDT’
761 | SET_LDT(ldt);
| ^~~~~~~
/tmp/modconfig-Y3VkRY/vmmon-only/common/task.c: In function ‘Task_Switch’:
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_asm_x86.h:67:44: error: expression in static assertion is not constant
67 | ASSERT_ON_COMPILE(sizeof(Selector) == 2 && \
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
68 | ((__builtin_constant_p(expr) && ((expr) >> 16) == 0) || \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69 | sizeof(expr) <= 2))
| ~~~~~~~~~~~~~~~~~~
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_assert.h:372:22: note: in definition of macro ‘ASSERT_ON_COMPILE’
372 | _Static_assert(e, #e); \
| ^
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_asm_x86.h:215:7: note: in expansion of macro ‘ASSERT_ON_COMPILE_SELECTOR_SIZE’
215 | ASSERT_ON_COMPILE_SELECTOR_SIZE(expr); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_asm_x86.h:228:22: note: in expansion of macro ‘SET_SEGREG’
228 | #define SET_SS(expr) SET_SEGREG(ss, expr)
| ^~~~~~~~~~
/tmp/modconfig-Y3VkRY/vmmon-only/common/task.c:2620:13: note: in expansion of macro ‘SET_SS’
2620 | SET_SS(kernelStackSegment);
| ^~~~~~
CC [M] /tmp/modconfig-Y3VkRY/vmmon-only/bootstrap/vmmblob.o
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_asm_x86.h:67:44: error: expression in static assertion is not constant
67 | ASSERT_ON_COMPILE(sizeof(Selector) == 2 && \
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
68 | ((__builtin_constant_p(expr) && ((expr) >> 16) == 0) || \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69 | sizeof(expr) <= 2))
| ~~~~~~~~~~~~~~~~~~
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_assert.h:372:22: note: in definition of macro ‘ASSERT_ON_COMPILE’
372 | _Static_assert(e, #e); \
| ^
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_asm_x86.h:215:7: note: in expansion of macro ‘ASSERT_ON_COMPILE_SELECTOR_SIZE’
215 | ASSERT_ON_COMPILE_SELECTOR_SIZE(expr); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_asm_x86.h:224:22: note: in expansion of macro ‘SET_SEGREG’
224 | #define SET_DS(expr) SET_SEGREG(ds, expr)
| ^~~~~~~~~~
/tmp/modconfig-Y3VkRY/vmmon-only/common/task.c:2716:10: note: in expansion of macro ‘SET_DS’
2716 | SET_DS(ds);
| ^~~~~~
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_asm_x86.h:67:44: error: expression in static assertion is not constant
67 | ASSERT_ON_COMPILE(sizeof(Selector) == 2 && \
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
68 | ((__builtin_constant_p(expr) && ((expr) >> 16) == 0) || \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69 | sizeof(expr) <= 2))
| ~~~~~~~~~~~~~~~~~~
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_assert.h:372:22: note: in definition of macro ‘ASSERT_ON_COMPILE’
372 | _Static_assert(e, #e); \
| ^
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_asm_x86.h:215:7: note: in expansion of macro ‘ASSERT_ON_COMPILE_SELECTOR_SIZE’
215 | ASSERT_ON_COMPILE_SELECTOR_SIZE(expr); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_asm_x86.h:225:22: note: in expansion of macro ‘SET_SEGREG’
225 | #define SET_ES(expr) SET_SEGREG(es, expr)
| ^~~~~~~~~~
/tmp/modconfig-Y3VkRY/vmmon-only/common/task.c:2717:10: note: in expansion of macro ‘SET_ES’
2717 | SET_ES(es);
| ^~~~~~
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_asm_x86.h:67:44: error: expression in static assertion is not constant
67 | ASSERT_ON_COMPILE(sizeof(Selector) == 2 && \
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
68 | ((__builtin_constant_p(expr) && ((expr) >> 16) == 0) || \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69 | sizeof(expr) <= 2))
| ~~~~~~~~~~~~~~~~~~
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_assert.h:372:22: note: in definition of macro ‘ASSERT_ON_COMPILE’
372 | _Static_assert(e, #e); \
| ^
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_asm_x86.h:215:7: note: in expansion of macro ‘ASSERT_ON_COMPILE_SELECTOR_SIZE’
215 | ASSERT_ON_COMPILE_SELECTOR_SIZE(expr); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_asm_x86.h:226:22: note: in expansion of macro ‘SET_SEGREG’
226 | #define SET_FS(expr) SET_SEGREG(fs, expr)
| ^~~~~~~~~~
/tmp/modconfig-Y3VkRY/vmmon-only/common/task.c:2725:10: note: in expansion of macro ‘SET_FS’
2725 | SET_FS(fs);
| ^~~~~~
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_asm_x86.h:67:44: error: expression in static assertion is not constant
67 | ASSERT_ON_COMPILE(sizeof(Selector) == 2 && \
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
68 | ((__builtin_constant_p(expr) && ((expr) >> 16) == 0) || \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69 | sizeof(expr) <= 2))
| ~~~~~~~~~~~~~~~~~~
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_assert.h:372:22: note: in definition of macro ‘ASSERT_ON_COMPILE’
372 | _Static_assert(e, #e); \
| ^
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_asm_x86.h:215:7: note: in expansion of macro ‘ASSERT_ON_COMPILE_SELECTOR_SIZE’
215 | ASSERT_ON_COMPILE_SELECTOR_SIZE(expr); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/modconfig-Y3VkRY/vmmon-only/./include/vm_asm_x86.h:227:22: note: in expansion of macro ‘SET_SEGREG’
227 | #define SET_GS(expr) SET_SEGREG(gs, expr)
| ^~~~~~~~~~
/tmp/modconfig-Y3VkRY/vmmon-only/common/task.c:2726:10: note: in expansion of macro ‘SET_GS’
2726 | SET_GS(gs);
| ^~~~~~
make[2]: *** [scripts/Makefile.build:287:/tmp/modconfig-Y3VkRY/vmmon-only/common/task.o] 错误 1
make[2]: *** 正在等待未完成的任务....
make[1]: *** [Makefile:1852:/tmp/modconfig-Y3VkRY/vmmon-only] 错误 2
make[1]: 离开目录“/usr/src/linux-headers-5.16.19-76051619-generic”
make: *** [Makefile:117:vmmon.ko] 错误 2
make: 离开目录“/tmp/modconfig-Y3VkRY/vmmon-only”
make: 进入目录“/tmp/modconfig-Y3VkRY/vmnet-only”
Using kernel build system.
/usr/bin/make -C /lib/modules/5.16.19-76051619-generic/build/include/.. M=$PWD SRCROOT=$PWD/. \
MODULEBUILDDIR= modules
make[1]: 进入目录“/usr/src/linux-headers-5.16.19-76051619-generic”
CC [M] /tmp/modconfig-Y3VkRY/vmnet-only/driver.o
CC [M] /tmp/modconfig-Y3VkRY/vmnet-only/hub.o
CC [M] /tmp/modconfig-Y3VkRY/vmnet-only/userif.o
CC [M] /tmp/modconfig-Y3VkRY/vmnet-only/netif.o
/tmp/modconfig-Y3VkRY/vmnet-only/driver.c: In function ‘VNetFileOpUnlockedIoctl’:
/tmp/modconfig-Y3VkRY/vmnet-only/driver.c:966:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
966 | {
| ^
/tmp/modconfig-Y3VkRY/vmnet-only/driver.c:976:4: note: here
976 | case SIOCGETAPIVERSION:
| ^~~~
/tmp/modconfig-Y3VkRY/vmnet-only/hub.c:237:24: warning: argument 1 of type ‘uint8[]’ {aka ‘unsigned char[]’} with mismatched bound [-Warray-parameter=]
237 | VNetHub_AllocPvn(uint8 id[]) // IN: the PVN ID to alloc on
| ~~~~~~^~~~
In file included from /tmp/modconfig-Y3VkRY/vmnet-only/hub.c:43:
/tmp/modconfig-Y3VkRY/vmnet-only/vnetInt.h:173:34: note: previously declared as ‘uint8[20]’ {aka ‘unsigned char[20]’}
173 | VNetJack *VNetHub_AllocPvn(uint8 id[VNET_PVN_ID_LEN]);
| ~~~~~~^~~~~~~~~~~~~~~~~~~
/tmp/modconfig-Y3VkRY/vmnet-only/hub.c:261:20: warning: argument 3 of type ‘uint8[]’ {aka ‘unsigned char[]’} with mismatched bound [-Warray-parameter=]
261 | uint8 id[]) // IN: PVN ID to use (NULL if allocPvn == FALSE)
| ~~~~~~^~~~
/tmp/modconfig-Y3VkRY/vmnet-only/hub.c:68:37: note: previously declared as ‘uint8[20]’ {aka ‘unsigned char[20]’}
68 | uint8 id[VNET_PVN_ID_LEN]);
| ~~~~~~^~~~~~~~~~~~~~~~~~~
CC [M] /tmp/modconfig-Y3VkRY/vmnet-only/bridge.o
CC [M] /tmp/modconfig-Y3VkRY/vmnet-only/procfs.o
CC [M] /tmp/modconfig-Y3VkRY/vmnet-only/smac_compat.o
CC [M] /tmp/modconfig-Y3VkRY/vmnet-only/smac.o
CC [M] /tmp/modconfig-Y3VkRY/vmnet-only/vnetEvent.o
CC [M] /tmp/modconfig-Y3VkRY/vmnet-only/vnetUserListener.o
LD [M] /tmp/modconfig-Y3VkRY/vmnet-only/vmnet.o
MODPOST /tmp/modconfig-Y3VkRY/vmnet-only/Module.symvers
CC [M] /tmp/modconfig-Y3VkRY/vmnet-only/vmnet.mod.o
LD [M] /tmp/modconfig-Y3VkRY/vmnet-only/vmnet.ko
BTF [M] /tmp/modconfig-Y3VkRY/vmnet-only/vmnet.ko
Skipping BTF generation for /tmp/modconfig-Y3VkRY/vmnet-only/vmnet.ko due to unavailability of vmlinux
make[1]: 离开目录“/usr/src/linux-headers-5.16.19-76051619-generic”
/usr/bin/make -C $PWD SRCROOT=$PWD/. \
MODULEBUILDDIR= postbuild
make[1]: 进入目录“/tmp/modconfig-Y3VkRY/vmnet-only”
make[1]: “postbuild”已是最新。
make[1]: 离开目录“/tmp/modconfig-Y3VkRY/vmnet-only”
cp -f vmnet.ko ./../vmnet.o
make: 离开目录“/tmp/modconfig-Y3VkRY/vmnet-only”
Unable to install all modules. See log for details.

解决方案

这个问题查了蛮久的
好像是linux新内核的问题

1
2
3
4
5
6
➜  /tmp find /usr -type f | grep vmmon
/usr/lib/vmware/modules/source/vmmon.tar
/usr/lib/vmware/symvers/vmmon-5.17.5-76051705-generic
/usr/lib/vmware/symvers/vmmon-5.16.19-76051619-generic
/usr/lib/modules/5.16.19-76051619-generic/misc/vmmon.ko
/usr/lib/modules/5.17.5-76051705-generic/misc/vmmon.ko

找到vmware的vmmon模块源码的位置
修改第66到73行的源码

1
2
3
4
5
6
7
8
#ifndef USE_UBSAN
//#define ASSERT_ON_COMPILE_SELECTOR_SIZE(expr) \
// ASSERT_ON_COMPILE(sizeof(Selector) == 2 && \
// ((__builtin_constant_p(expr) && ((expr) >> 16) == 0) || \
// sizeof(expr) <= 2))
//#else
#define ASSERT_ON_COMPILE_SELECTOR_SIZE(expr)
//#endif

之后打包回去,重新编译


万能的Github

在Github上找到了一个修改后的模块repo
vmware-host-modules

使用方法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
1- Then make Tar vmmon-only and vmnet-only folders

tar -cf vmmon.tar vmmon-only

tar -cf vmnet.tar vmnet-only



2- Later copy the files to this path /usr/lib/vmware/modules/source/ :

cp -v vmmon.tar vmnet.tar /usr/lib/vmware/modules/source/



3- Finally, run this command to compile headers manually:

sudo vmware-modconfig --console --install-all
文章作者: 米澤 由香里
文章链接: https://0w0.live/2022/05/18/关于VM虚拟机在Linux下安装的一个小问题/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 私は米沢ユカリニャー