有人成功将 wmic 安装到 Ubuntu 16.04 LTS Server 上吗?这些说明适用于 14.04(包括使用 14.04 的用户),但我在 16.04 上遇到一个又一个错误,想知道是否有其他人成功了
cd /tmp
mkdir wmic
cd wmic
apt install autoconf gcc libdatetime-perl make build-essential g++ python-dev
wget http://www.opsview.com/sites/default/files/wmi-1.3.16.tar_.bz2
bunzip2 wmi-1.3.16.tar_.bz2
tar -xvf wmi-1.3.16.tar_
cd wmi-1.3.16/
vim Samba/source/pidl/pidl
:583 (to jump to line 583)
remove the word defined before @$pidl
:wq
export ZENHOME=/usr
make "CPP=gcc -E -ffreestanding"
cp Samba/source/bin/wmic /bin
非常感谢
答案1
为了知识共享,这里介绍如何让 wmic 在 Ubuntu 16.04 LTS 上运行,问题是打开文件数量的限制
ulimit -n 100000
cd /tmp
mkdir wmic
cd wmic
apt install autoconf gcc libdatetime-perl make build-essential g++ python-dev
wget http://www.opsview.com/sites/default/files/wmi-1.3.16.tar_.bz2
bunzip2 wmi-1.3.16.tar_.bz2
tar -xvf wmi-1.3.16.tar_
cd wmi-1.3.16/
vim Samba/source/pidl/pidl
:583 (to jump to line 583)
remove the word defined before @$pidl
:wq
export ZENHOME=/usr
make "CPP=gcc -E -ffreestanding"
cp Samba/source/bin/wmic /bin
现在应该可以工作了。
答案2
按照 trevrobwhite 的答案中的步骤进行操作,但遇到以下问题:
Linking bin/wmic
bin/static/libtls.a(tls.o): In function `tls_init_server':
/tmp/wmic/wmi-1.3.16/Samba/source/lib/tls/tls.c:508: undefined reference to `gnutls_transport_set_lowat'
bin/static/libtls.a(tls.o): In function `tls_init_client':
/tmp/wmic/wmi-1.3.16/Samba/source/lib/tls/tls.c:579: undefined reference to `gnutls_certificate_type_set_priority'
/tmp/wmic/wmi-1.3.16/Samba/source/lib/tls/tls.c:587: undefined reference to `gnutls_transport_set_lowat'
collect2: error: ld returned 1 exit status
Makefile:9029: recipe for target 'bin/wmic' failed
make[1]: *** [bin/wmic] Error 1
make[1]: Leaving directory '/tmp/wmic/wmi-1.3.16/Samba/source'
搜索了一下这些功能,它们似乎已经过时了,可以删除(如此处所示https://git.kernel.org/pub/scm/network/connman/connman.git/tree/gweb/giognutls.c?id=HEAD)
diff wmi-1.3.16_fixed/Samba/source/lib/tls/tls.c wmi-1.3.16/Samba/source/lib/tls/tls.c
507a508
> gnutls_transport_set_lowat(tls->session, 0);
577a579
> gnutls_certificate_type_set_priority(tls->session, cert_type_priority);
584a587
> gnutls_transport_set_lowat(tls->session, 0);
现在可以编译并且 wmic 似乎工作正常