尝试安装
Text::Unaccent
模块
我有下一个错误,有人可以帮忙吗?
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
Unaccent.o:Unaccent.c:(.text+0x96):
undefined reference to `unac_debug_callback'
collect2.exe: error: ld returned 1 exit status
gmake: *** [Makefile:480: blib\arch\auto\Text\Unaccent\Unaccent.xs.dll] Error 1
LDACHARY/Text-Unaccent-1.08.tar.gz
C:\STRAWB~1\c\bin\gmake.exe -- NOT OK
Stopping: 'install' failed for 'Text::Unaccent'.
[为了可读性而单独包裹]
对 unac_debug_callback 的未定义引用
此问题已在此之前报告过: https://rt.cpan.org/Public/Bug/Display.html?id=124815
正如 SREZIC 在该线程中评论的那样:添加
#define HAS_VPRINTF
to
unac.c
似乎可以解决这个问题。我在 Windows 11、Strawberry Perl 版本 5.32.1 上对此进行了测试,效果很好:
在此处下载 tar 球:https://cpan.metacpan.org/authors/id/L/LD/LDACHARY/Text-Unaccent-1.08.tar.gz
打开包装并提取焦油球
cd 进入解压后的目录,然后编辑
unac.c
。就像下面的补丁所示:
diff --git a/unac.c b/unac.c
index 20863d2..2c63fc2 100644
--- a/unac.c
+++ b/unac.c
@@ -20,6 +20,7 @@
#include "config.h"
#endif /* HAVE_CONFIG_H */
+#define HAS_VPRINTF
/*
* Perl config.h defines HAS_VPRINTF if printf variants are
* available
运行
perl Makefile.PL; gmake; gmake test; gmake install
:
:
>perl Makefile.PL
Checking if your kit is complete...
Looks good
Generating a gmake-style Makefile
Writing Makefile for Text::Unaccent
Writing MYMETA.yml and MYMETA.json
>gmake
cp Unaccent.pm blib\lib\Text\Unaccent.pm
Running Mkbootstrap for Unaccent ()
"C:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command -e chmod -- 644 "Unaccent.bs"
"C:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command::MM -e cp_nonempty -- Unaccent.bs blib\arch\auto\Text\Unaccent\Unaccent.bs 644
"C:\Strawberry\perl\bin\perl.exe" "C:\Strawberry\perl\lib\ExtUtils/xsubpp" -typemap C:\STRAWB~1\perl\lib\ExtUtils\typemap Unaccent.xs > Unaccent.xsc
"C:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command -e mv -- Unaccent.xsc Unaccent.c
gcc -c -I. -DWIN32 -DWIN64 -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fwrapv -fno-strict-aliasing -mms-bitfields -s -O2 -DVERSION=\"1.08\" -DXS_VERSION=\"1.08\" "-IC:\STRAWB~1\perl\lib\CORE" -DHAVE_CONFIG_H Unaccent.c
Unaccent.xs: In function 'XS_Text__Unaccent_unac_string':
Unaccent.xs:71:20: warning: passing argument 5 of 'unac_string' from incompatible pointer type [-Wincompatible-pointer-types]
&buffer, &buffer_length) == 0) {
^~~~~~~~~~~~~~
In file included from Unaccent.xs:35:
unac.h:96:23: note: expected 'size_t *' {aka 'long long unsigned int *'} but argument is of type 'int *'
char** out, size_t* out_length);
~~~~~~~~^~~~~~~~~~
Unaccent.xs: In function 'XS_Text__Unaccent_unac_string_utf16':
Unaccent.xs:88:19: warning: passing argument 4 of 'unac_string_utf16' from incompatible pointer type [-Wincompatible-pointer-types]
&buffer, &buffer_length) == 0) {
^~~~~~~~~~~~~~
In file included from Unaccent.xs:35:
unac.h:79:23: note: expected 'size_t *' {aka 'long long unsigned int *'} but argument is of type 'int *'
char** out, size_t* out_length);
~~~~~~~~^~~~~~~~~~
Unaccent.xs: In function 'XS_Text__Unaccent_unac_debug':
Unaccent.xs:109:10: warning: implicit declaration of function 'unac_debug_callback'; did you mean 'unac_debug_print'? [-Wimplicit-function-declaration]
unac_debug_callback(in, unac_debug_print, NULL);
^~~~~~~~~~~~~~~~~~~
unac_debug_print
gcc -c -I. -DWIN32 -DWIN64 -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fwrapv -fno-strict-aliasing -mms-bitfields -s -O2 -DVERSION=\"1.08\" -DXS_VERSION=\"1.08\" "-IC:\STRAWB~1\perl\lib\CORE" -DHAVE_CONFIG_H unac.c
unac.c: In function 'unac_string':
unac.c:13889:59: warning: passing argument 6 of 'convert' from incompatible pointer type [-Wincompatible-pointer-types]
if(convert(charset, utf16be(), in, in_length, &utf16, &utf16_length) < 0) {
^~~~~~~~~~~~~
unac.c:13774:27: note: expected 'size_t *' {aka 'long long unsigned int *'} but argument is of type 'int *'
char** outp, size_t* out_lengthp)
~~~~~~~~^~~~~~~~~~~
unac.c:13893:63: warning: passing argument 4 of 'unac_string_utf16' from incompatible pointer type [-Wincompatible-pointer-types]
unac_string_utf16(utf16, utf16_length, &utf16_unaccented, &utf16_unaccented_length);
^~~~~~~~~~~~~~~~~~~~~~~~
unac.c:13674:30: note: expected 'size_t *' {aka 'long long unsigned int *'} but argument is of type 'int *'
char** outp, size_t* out_lengthp)
~~~~~~~~^~~~~~~~~~~
"C:\Strawberry\perl\bin\perl.exe" -MExtUtils::Mksymlists \
-e "Mksymlists('NAME'=>\"Text::Unaccent\", 'DLBASE' => 'Unaccent', 'DL_FUNCS' => { }, 'FUNCLIST' => [], 'IMPORTS' => { }, 'DL_VARS' => []);"
g++ Unaccent.def -o blib\arch\auto\Text\Unaccent\Unaccent.xs.dll -mdll -s -L"C:\STRAWB~1\perl\lib\CORE" -L"C:\STRAWB~1\c\lib" Unaccent.o unac.o "C:\STRAWB~1\perl\lib\CORE\libperl532.a" "C:\STRAWB~1\c\lib\libiconv.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libmoldname.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libkernel32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libuser32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libgdi32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libwinspool.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libcomdlg32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libadvapi32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libshell32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libole32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\liboleaut32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libnetapi32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libuuid.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libws2_32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libmpr.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libwinmm.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libversion.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libodbc32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libodbccp32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libcomctl32.a" -Wl,--enable-auto-image-base
"C:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command -e chmod -- 755 blib\arch\auto\Text\Unaccent\Unaccent.xs.dll
>gmake test
"C:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command::MM -e cp_nonempty -- Unaccent.bs blib\arch\auto\Text\Unaccent\Unaccent.bs 644
"C:\Strawberry\perl\bin\perl.exe" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib\lib', 'blib\arch')" t/*.t
t/unac.t .. ok
All tests successful.
Files=1, Tests=4, 0 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)
Result: PASS
> gmake install
[...]
Files found in blib\arch: installing files in blib\lib into architecture dependent library tree
Installing C:\STRAWB~1\perl\site\lib\auto\Text\Unaccent\Unaccent.xs.dll
Installing C:\STRAWB~1\perl\site\lib\Text\Unaccent.pm
Appending installation info to C:\STRAWB~1\perl\lib/perllocal.pod