【Linux系列】Fedora40安装VMware Workstation Pro报错

广龙宇 2024-07-05 14:37:01 阅读 99

在这里插入图片描述

问题描述

由于Fedora 40使用的Linux内核是6.9,导致安装VMware Workstation Pro 时,安装依赖无法成功,具体报错如下

<code>..................

CC [M] /tmp/modconfig-a8Fcf5/vmnet-only/smac.o

CC [M] /tmp/modconfig-a8Fcf5/vmnet-only/vnetEvent.o

CC [M] /tmp/modconfig-a8Fcf5/vmnet-only/vnetUserListener.o

In file included from ./include/linux/spinlock.h:305,

from ./include/linux/sched.h:2138,

from /tmp/modconfig-a8Fcf5/vmnet-only/bridge.c:25:

/tmp/modconfig-a8Fcf5/vmnet-only/bridge.c: In function ‘VNetBridgeReceiveFromVNet’:

/tmp/modconfig-a8Fcf5/vmnet-only/vmnetInt.h:44:39: error: ‘dev_base_lock’ undeclared (first use in this function); did you mean ‘device_lock’?

44 | #define dev_lock_list() read_lock(&dev_base_lock)

| ^~~~~~~~~~~~~

./include/linux/rwlock.h:56:48: note: in definition of macro ‘read_lock’

56 | #define read_lock(lock) _raw_read_lock(lock)

| ^~~~

/tmp/modconfig-a8Fcf5/vmnet-only/bridge.c:587:4: note: in expansion of macro ‘dev_lock_list’

587 | dev_lock_list();

| ^~~~~~~~~~~~~

/tmp/modconfig-a8Fcf5/vmnet-only/vmnetInt.h:44:39: note: each undeclared identifier is reported only once for each function it appears in

44 | #define dev_lock_list() read_lock(&dev_base_lock)

| ^~~~~~~~~~~~~

./include/linux/rwlock.h:56:48: note: in definition of macro ‘read_lock’

56 | #define read_lock(lock) _raw_read_lock(lock)

| ^~~~

/tmp/modconfig-a8Fcf5/vmnet-only/bridge.c:587:4: note: in expansion of macro ‘dev_lock_list’

587 | dev_lock_list();

| ^~~~~~~~~~~~~

/tmp/modconfig-a8Fcf5/vmnet-only/bridge.c: In function ‘VNetBridgeUp’:

/tmp/modconfig-a8Fcf5/vmnet-only/vmnetInt.h:44:39: error: ‘dev_base_lock’ undeclared (first use in this function); did you mean ‘device_lock’?

44 | #define dev_lock_list() read_lock(&dev_base_lock)

| ^~~~~~~~~~~~~

./include/linux/rwlock.h:56:48: note: in definition of macro ‘read_lock’

56 | #define read_lock(lock) _raw_read_lock(lock)

| ^~~~

/tmp/modconfig-a8Fcf5/vmnet-only/bridge.c:902:4: note: in expansion of macro ‘dev_lock_list’

902 | dev_lock_list();

| ^~~~~~~~~~~~~

make[3]: *** [scripts/Makefile.build:244: /tmp/modconfig-a8Fcf5/vmnet-only/bridge.o] Error 1

make[2]: *** [/usr/src/linux-6.9-rc1/Makefile:1919: /tmp/modconfig-a8Fcf5/vmnet-only] Error 2

make[1]: *** [Makefile:240: __sub-make] Error 2

make[1]: Leaving directory '/usr/src/linux-6.9-rc1'

make: *** [Makefile:117: vmnet.ko] Error 2

make: Leaving directory '/tmp/modconfig-a8Fcf5/vmnet-only'

Unable to install all modules. See log for details.

在我探索了好久,才发现解决这个问题需要两步。(Github讨论的,开源就是坑)


解决方案:

1. 下载依赖源码

其中的17.0.0是你VMware的版本号,如果你也不清楚,建议去github看看,地址是https://github.com/mkubecek

wget https://github.com/mkubecek/vmware-host-modules/archive/workstation-17.0.0.tar.gz

tar -xzf workstation-17.0.0.tar.gz

现在如果你编译安装,肯定是会报错的,如果报错跟我一样,那么跟着下一步走。

编译安装是

cd vmware-host-modules-workstation-17.0.0

make

sudo make install

2. 修改源代码

修改/vmnet-only/vmnetInt.h

# 找到

@@ -41,8 +41,13 @@

compat_skb_set_network_header(skb, sizeof (struct ethhdr)), \

dev_queue_xmit(skb) \

)

-#define dev_lock_list() read_lock(&dev_base_lock)

-#define dev_unlock_list() read_unlock(&dev_base_lock)

+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 9, 0)

+# define dev_lock_list() rcu_read_lock()

+# define dev_unlock_list() rcu_read_unlock()

+#else

+# define dev_lock_list() read_lock(&dev_base_lock)

+# define dev_unlock_list() read_unlock(&dev_base_lock)

+#endif

extern struct proto vmnet_proto;

- 意思是删除

+ 意思是增加

3. 编译安装依赖

此时再次编译安装

cd vmware-host-modules-workstation-17.0.0

make

sudo make install

就可以成功打开软件了。

在这里插入图片描述

成功进入软件。

自动VMware被收购了,个人用户免费以后就不那么容易安装了,真是坑。

如果你安装失败了,可以看看大佬们的讨论贴

https://github.com/mkubecek/vmware-host-modules/issues/239



声明

本文内容仅代表作者观点,或转载于其他网站,本站不以此文作为商业用途
如有涉及侵权,请联系本站进行删除
转载本站原创文章,请注明来源及作者。