on Hægland的指示,它工作得很好,谢谢!
我无法使用cpan正确下载Wx,并且不断出现错误,所以我尝试强制安装它,现在,当运行:
#!/usr/bin/perl -w
use strict;
use Wx;
我得到以下错误:
Can't load '/usr/local/lib64/perl5/auto/Wx/Wx.so' for module Wx: libenchant.so.1: cannot open shared object file: No such file or directory at /usr/lib64/perl5/DynaLoader.pm line 193.
at test.pl line 3.
Compilation failed in require at test.pl line 3.
BEGIN failed--compilation aborted at test.pl line 3.
编辑:我终于让它工作了!首先,我下载了libenchant1c2a.deb,并使用deb2tgz将其转换为。txz,提取它并将文件放入usr/lib usr/lib64和usr/share中,之后我只是遵循了h我能够在Ubuntu 21.04和perl版本5.32.0上从源代码安装Wx。我首先通过从source:
安装Alien::wxWidgets安装了wxWidgets库(来自prdownloads.sourceforge.net/wxwindows/wxWidgets-3.0.2.tar.bz2的3.0.2版本)。$ wget https://cpan.metacpan.org/authors/id/M/MD/MDOOTSON/Alien-wxWidgets-0.69.tar.gz
$ tar zxvf Alien-wxWidgets-0.69.tar.gz
$ cd Alien-wxWidgets-0.69.tar.gz
$ perl Makefile.PL
perl Makefile.PL
# running Build.PL
Do you want to fetch and build wxWidgets from sources? [no ]yes
Which wxWidgets version? (2.8.10, 2.8.11, 2.8.12, 2.9.0, 2.9.1, 2.9.2, 2.9.3, 2.9.4, 3.0.0, 3.0.1, 3.0.2) [3.0.2 ]
3.0.2
Which archive type? [tar.bz2 ]
tar.bz2
Do you want to include OpenGL support [no ]
no
Created MYMETA.yml and MYMETA.json
Creating new 'Build' script for 'Alien-wxWidgets' version '0.69'
$ make
[...]
/home/hakon/test/perl/Alien-wxWidgets-0.69/wxWidgets-3.0.2/bld/bk-deps g++ -c -o gldll_glx11.o -I./.pch/wxprec_gldll -D__WXGTK__ -DWXBUILDING -I../src/regex -DWXUSINGDLL -DWXMAKINGDLL_GL -fPIC -DPIC -Wall -Wundef -Wunused-parameter -Wno-ctor-dtor-privacy -Woverloaded-virtual -D_FILE_OFFSET_BITS=64 -I/home/hakon/test/perl/Alien-wxWidgets-0.69/wxWidgets-3.0.2/bld/lib/wx/include/gtk2-unicode-3.0 -I../include -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/harfbuzz -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -DWX_PRECOMP -pthread -O2 -fno-strict-aliasing -pthread -I/usr/include/gtk-unix-print-2.0 -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -fvisibility=hidden -fvisibility-inlines-hidden ../src/unix/glx11.cpp
g++ -shared -fPIC -o /home/hakon/test/perl/Alien-wxWidgets-0.69/wxWidgets-3.0.2/bld/lib/libwx_gtk2u_gl-3.0.so.0.2.0 gldll_glcmn.o gldll_gtk_glcanvas.o gldll_glx11.o -L/home/hakon/test/perl/Alien-wxWidgets-0.69/wxWidgets-3.0.2/bld/lib -Wl,-soname,libwx_gtk2u_gl-3.0.so.0 -pthread -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lharfbuzz -lfontconfig -lfreetype -lgthread-2.0 -pthread -lglib-2.0 -lX11 -lSM -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lfontconfig -lfreetype -lpng -lz -ljpeg -ltiff -lwxregexu-3.0 -pthread -Wl,--version-script,/home/hakon/test/perl/Alien-wxWidgets-0.69/wxWidgets-3.0.2/bld/version-script -lz -ldl -lm -lwx_gtk2u_core-3.0 -lwx_baseu-3.0 -lGL -lGLU -lz -ldl -lm
(cd /home/hakon/test/perl/Alien-wxWidgets-0.69/wxWidgets-3.0.2/bld/lib/; rm -f libwx_gtk2u_gl-3.0.so libwx_gtk2u_gl-3.0.so.0; ln -s libwx_gtk2u_gl-3.0.so.0.2.0 libwx_gtk2u_gl-3.0.so.0; ln -s libwx_gtk2u_gl-3.0.so.0 libwx_gtk2u_gl-3.0.so)
(if test -f utils/wxrc/Makefile ; then cd utils/wxrc && make all ; fi)
make[2]: Entering directory '/home/hakon/test/perl/Alien-wxWidgets-0.69/wxWidgets-3.0.2/bld/utils/wxrc'
/home/hakon/test/perl/Alien-wxWidgets-0.69/wxWidgets-3.0.2/bld/bk-deps g++ -c -o wxrc_wxrc.o -D__WXGTK__ -I../../../utils/wxrc -DWXUSINGDLL -DwxUSE_GUI=0 -Wall -Wundef -Wunused-parameter -Wno-ctor-dtor-privacy -Woverloaded-virtual -D_FILE_OFFSET_BITS=64 -I/home/hakon/test/perl/Alien-wxWidgets-0.69/wxWidgets-3.0.2/bld/lib/wx/include/gtk2-unicode-3.0 -I../../../include -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/harfbuzz -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -DWX_PRECOMP -pthread -O2 -fno-strict-aliasing -pthread -I/usr/include/gtk-unix-print-2.0 -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -fvisibility=hidden -fvisibility-inlines-hidden ../../../utils/wxrc/wxrc.cpp
g++ -o wxrc wxrc_wxrc.o -L/home/hakon/test/perl/Alien-wxWidgets-0.69/wxWidgets-3.0.2/bld/lib -pthread -lwx_baseu_xml-3.0 -lexpat -lwx_baseu-3.0 -lwxregexu-3.0 -pthread -Wl,--version-script,/home/hakon/test/perl/Alien-wxWidgets-0.69/wxWidgets-3.0.2/bld/version-script -lz -ldl -lm -lz -ldl -lm
make[2]: Leaving directory '/home/hakon/test/perl/Alien-wxWidgets-0.69/wxWidgets-3.0.2/bld/utils/wxrc'
make[1]: Leaving directory '/home/hakon/test/perl/Alien-wxWidgets-0.69/wxWidgets-3.0.2/bld'
$ make test
/home/hakon/perlbrew/perls/perl-5.32.0/bin/perl Build --makefile_env_macros 1 test
t/01_load.t .......... ok
t/zy_pod_coverage.t .. ok
t/zz_pod.t ........... ok
All tests successful.
Files=3, Tests=15, 0 wallclock secs ( 0.01 usr 0.00 sys + 0.25 cusr 0.05 csys = 0.31 CPU)
Result: PASS
$ make install
/home/hakon/perlbrew/perls/perl-5.32.0/bin/perl Build --makefile_env_macros 1 install
Building Alien-wxWidgets
make[1]: Entering directory '/home/hakon/test/perl/Alien-wxWidgets-0.69/wxWidgets-3.0.2/bld'
(if test -f utils/wxrc/Makefile ; then cd utils/wxrc && make all ; fi)
make[2]: Entering directory '/home/hakon/test/perl/Alien-wxWidgets-0.69/wxWidgets-3.0.2/bld/utils/wxrc'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/hakon/test/perl/Alien-wxWidgets-0.69/wxWidgets-3.0.2/bld/utils/wxrc'
make[1]: Leaving directory '/home/hakon/test/perl/Alien-wxWidgets-0.69/wxWidgets-3.0.2/bld'
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
make[1]: Entering directory '/home/hakon/test/perl/Alien-wxWidgets-0.69/wxWidgets-3.0.2/bld'
mkdir -p /home/hakon/perlbrew/perls/perl-5.32.0/lib/site_perl/5.32.0/x86_64-linux/Alien/wxWidgets/gtk_3_0_2_uni/lib
/bin/install -c -m 644 /home/hakon/test/perl/Alien-wxWidgets-0.69/wxWidgets-3.0.2/bld/lib/libwx_baseu-3.0.so /home/hakon/perlbrew/perls/perl-5.32.0/lib/site_perl/5.32.0/x86_64-linux/Alien/wxWidgets/gtk_3_0_2_uni/lib
/bin/install -c /home/hakon/test/perl/Alien-wxWidgets-0.69/wxWidgets-3.0.2/bld/lib/libwx_baseu-3.0.so.0.2.0 /home/hakon/perlbrew/perls/perl-5.32.0/lib/site_perl/5.32.0/x86_64-linux/Alien/wxWidgets/gtk_3_0_2_uni/lib
(cd /home/hakon/perlbrew/perls/perl-5.32.0/lib/site_perl/5.32.0/x86_64-linux/Alien/wxWidgets/gtk_3_0_2_uni/lib ; rm -f libwx_baseu-3.0.so libwx_baseu-3.0.so.0; ln -s libwx_baseu-3.0.so.0.2.0 libwx_baseu-3.0.so.0; ln -s libwx_baseu-3.0.so.0 libwx_baseu-3.0.so)
[...]
done
------------------------------------------------------
The installation of wxWidgets is finished. On certain
platforms (e.g. Linux) you'll now have to run ldconfig
if you installed a shared library and also modify the
LD_LIBRARY_PATH (or equivalent) environment variable.
wxWidgets comes with no guarantees and doesn't claim
to be suitable for any purpose.
Read the wxWindows Licence on licencing conditions.
------------------------------------------------------
然后,我能够编译Wx
:
$ wget https://cpan.metacpan.org/authors/id/M/MD/MDOOTSON/Wx-0.9932.tar.gz
$ tar zxvf Wx-0.9932.tar.gz
$ cd Wx-0.9932
$ perl Makefile.PL
Checking if your kit is complete...
Looks good
'WX' is not a known MakeMaker parameter name.
Writing MYMETA.yml and MYMETA.json
Writing MYMETA.yml and MYMETA.json
Writing MYMETA.yml and MYMETA.json
Writing MYMETA.yml and MYMETA.json
Writing MYMETA.yml and MYMETA.json
Writing MYMETA.yml and MYMETA.json
Writing MYMETA.yml and MYMETA.json
Writing MYMETA.yml and MYMETA.json
Writing MYMETA.yml and MYMETA.json
Writing MYMETA.yml and MYMETA.json
Warning (mostly harmless): No library found for -lwx_gtk2u_webview-3.0
Writing MYMETA.yml and MYMETA.json
Writing MYMETA.yml and MYMETA.json
Writing MYMETA.yml and MYMETA.json
Writing MYMETA.yml and MYMETA.json
Writing MYMETA.yml and MYMETA.json
Writing MYMETA.yml and MYMETA.json
Writing MYMETA.yml and MYMETA.json
Writing MYMETA.yml and MYMETA.json
Warning (mostly harmless): No library found for -lwx_gtk2u_media-3.0
Writing MYMETA.yml and MYMETA.json
Writing MYMETA.yml and MYMETA.json
Writing MYMETA.yml and MYMETA.json
Writing MYMETA.yml and MYMETA.json
Writing MYMETA.yml and MYMETA.json
Writing MYMETA.yml and MYMETA.json
Writing MYMETA.yml and MYMETA.json
Writing MYMETA.yml and MYMETA.json
Writing MYMETA.yml and MYMETA.json
Generating a Unix-style Makefile
Writing Makefile for Wx
Writing MYMETA.yml and MYMETA.json
======================================================================
For installation instructions and further help please see
docs/INSTALL.pod
For command line switches help use:
perl Makefile.PL --help
======================================================================
$ make
[...]
g++ -pthread -c -I. -I.. -I/home/hakon/perlbrew/perls/perl-5.32.0/lib/site_perl/5.32.0/x86_64-linux/Alien/wxWidgets/gtk_3_0_2_uni/lib/wx/include/gtk2-unicode-3.0 -I/home/hakon/perlbrew/perls/perl-5.32.0/lib/site_perl/5.32.0/x86_64-linux/Alien/wxWidgets/gtk_3_0_2_uni/include/wx-3.0 -I. -I. -I/home/hakon/perlbrew/perls/perl-5.32.0/lib/site_perl/5.32.0/x86_64-linux/Alien/wxWidgets/gtk_3_0_2_uni/lib/wx/include/gtk2-unicode-3.0 -I/home/hakon/perlbrew/perls/perl-5.32.0/lib/site_perl/5.32.0/x86_64-linux/Alien/wxWidgets/gtk_3_0_2_uni/include/wx-3.0 -I. -I../.. -I/home/hakon/perlbrew/perls/perl-5.32.0/lib/site_perl/5.32.0/x86_64-linux/Alien/wxWidgets/gtk_3_0_2_uni/lib/wx/include/gtk2-unicode-3.0 -I/home/hakon/perlbrew/perls/perl-5.32.0/lib/site_perl/5.32.0/x86_64-linux/Alien/wxWidgets/gtk_3_0_2_uni/include/wx-3.0 -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION="0.01" -DXS_VERSION="0.01" -fPIC "-I/home/hakon/perlbrew/perls/perl-5.32.0/lib/5.32.0/x86_64-linux/CORE" -DWXPL_EXT -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -DWXPL_EXT -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ XRC.c
rm -f ../../blib/arch/auto/Wx/XRC/XRC.so
LD_RUN_PATH="/home/hakon/perlbrew/perls/perl-5.32.0/lib/site_perl/5.32.0/x86_64-linux/Alien/wxWidgets/gtk_3_0_2_uni/lib" g++ -shared -O2 -fstack-protector-strong XRC.o -o ../../blib/arch/auto/Wx/XRC/XRC.so
-L/home/hakon/perlbrew/perls/perl-5.32.0/lib/site_perl/5.32.0/x86_64-linux/Alien/wxWidgets/gtk_3_0_2_uni/lib -lpthread -lwx_gtk2u_xrc-3.0 -lwx_baseu_xml-3.0 -lwx_gtk2u_html-3.0 -lwx_gtk2u_adv-3.0 -lwx_gtk2u_core-3.0 -lwx_baseu-3.0
[...]
但最初运行测试失败。由于某些原因,Perl生成的共享对象中的嵌入式运行路径不能帮助动态加载器找到wx库的位置。所以我需要显式地设置LD_LIBRARY_PATH
:
$ perl -MAlien::wxWidgets -E 'say Alien::wxWidgets->prefix'
/home/hakon/perlbrew/perls/perl-5.32.0/lib/site_perl/5.32.0/x86_64-linux/Alien/wxWidgets/gtk_3_0_2_uni
$ LD_LIBRARY_PATH=/home/hakon/perlbrew/perls/perl-5.32.0/lib/site_perl/5.32.0/x86_64-linux/Alien/wxWidgets/gtk_3_0_2_uni/lib make test
"/home/hakon/perlbrew/perls/perl-5.32.0/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- DataView.bs ../../blib/arch/auto/Wx/DataView/DataView.bs 644
PERL_DL_NONLAZY=1 "/home/hakon/perlbrew/perls/perl-5.32.0/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, '../../blib/lib', '../../blib/arch')" t/*.t
t/01_load.t ......... ok
t/02_inheritance.t .. ok
t/03_threads.t ...... skipped: no threads
t/08_ovl_func.t ..... ok
All tests successful.
Files=4, Tests=25, 1 wallclock secs ( 0.02 usr 0.00 sys + 0.25 cusr 0.03 csys = 0.30 CPU)
Result: PASS
make[2]: Leaving directory '/home/hakon/test/perl/Wx-0.9932/ext/dataview'
make[2]: Entering directory '/home/hakon/test/perl/Wx-0.9932/ext/docview'
"/home/hakon/perlbrew/perls/perl-5.32.0/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- DocView.bs ../../blib/arch/auto/Wx/DocView/DocView.bs 644
PERL_DL_NONLAZY=1 "/home/hakon/perlbrew/perls/perl-5.32.0/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, '../../blib/lib', '../../blib/arch')" t/*.t
t/01_load.t ......... ok
t/02_inheritance.t .. ok
[...]
make[3]: Entering directory '/home/hakon/test/perl/Wx-0.9932/ext/pperl/carp'
PERL_DL_NONLAZY=1 "/home/hakon/perlbrew/perls/perl-5.32.0/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, '../../../blib/lib', '../../../blib/arch')" t/*.t
t/01_load.t .. ok
All tests successful.
Files=1, Tests=1, 0 wallclock secs ( 0.01 usr 0.01 sys + 0.08 cusr 0.00 csys = 0.10 CPU)
Result: PASS
make[3]: Leaving directory '/home/hakon/test/perl/Wx-0.9932/ext/pperl/carp'
make[3]: Entering directory '/home/hakon/test/perl/Wx-0.9932/ext/pperl/textval'
PERL_DL_NONLAZY=1 "/home/hakon/perlbrew/perls/perl-5.32.0/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, '../../../blib/lib', '../../../blib/arch')" t/*.t
t/01_load.t .. ok
All tests successful.
Files=1, Tests=1, 0 wallclock secs ( 0.01 usr 0.00 sys + 0.07 cusr 0.02 csys = 0.10 CPU)
Result: PASS
make[3]: Leaving directory '/home/hakon/test/perl/Wx-0.9932/ext/pperl/textval'
No tests defined for Wx::Perl extension.
make[2]: Leaving directory '/home/hakon/test/perl/Wx-0.9932/ext/pperl'
No tests defined for Wx extension.
make[1]: Leaving directory '/home/hakon/test/perl/Wx-0.9932/ext'
PERL_DL_NONLAZY=1 "/home/hakon/perlbrew/perls/perl-5.32.0/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/01_load.t ........... ok
t/02_inheritance.t .... ok
t/03_event.t .......... ok
t/04_userdata.t ....... ok
t/05_timer.t .......... ok
t/06_loadxpm.t ........ ok
t/07_overload.t ....... ok
t/08_ovl_func.t ....... ok
t/09_create_delete.t .. ok
t/10_oor.t ............ ok
t/11_twostage.t ....... ok
t/12_pod.t ............ skipped: Author tests
t/13_nbksizer.t ....... ok
t/14_eh_die.t ......... ok
t/15_threads.t ........ skipped: no threads
t/16_stream.t ......... ok
t/17_thread_evt.t ..... skipped: no threads
t/18_unicode.t ........ ok
t/19_overlay.t ........ ok
t/20_ctx_threads.t .... skipped: no threads
t/21_locale.t ......... ok
t/22_interface.t ...... ok
t/zz_distrib.t ........ skipped: Author tests
All tests successful.
Test Summary Report
-------------------
t/04_userdata.t (Wstat: 0 Tests: 65 Failed: 0)
TODO passed: 25, 49, 57
Files=23, Tests=770, 6 wallclock secs ( 0.12 usr 0.02 sys + 1.82 cusr 0.52 csys = 2.48 CPU)
Result: PASS
然后我可以安装它:
$ make install
$ perl -E 'use Wx; say "It works"'
It works