New user registration is currently disabled due to spam abuse / Регистрация новых пользователей в настоящее время приостановлена из-за злоупотреблений спаммерами

GoldenDict & FreeBSD

Сообщаем о найденных ошибках сюда

GoldenDict & FreeBSD

Postby Gerk » Sun Aug 16, 2009 8:02 am

Добрый день!

Отчёт по сборке GD (0.9) под FreeBSD.

uname -a
FreeBSD xx.xx.org.ua 7.2-RELEASE-p2 FreeBSD 7.2-RELEASE-p2 #0: Wed Jun 24 00:14:35 UTC 2009 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64

Ошибки во время сборки:
Code: Select all
bgl_babylon.cc: In member function 'void Babylon::convertToUtf8(std::string&, unsigned int)':
bgl_babylon.cc:559: error: invalid conversion from 'char**' to 'const char**'
bgl_babylon.cc:559: error:   initializing argument 2 of 'size_t libiconv(void*, const char**, size_t*, char**, size_t*)'
*** Error code 1

Ошибка исправлена с помощью сл. хака (вывод diff -C5):
Code: Select all
*** goldendict-0.9.0-src.tmp/bgl_babylon.cc Sun Aug 16 09:58:22 2009
--- goldendict-0.9.0-src.org/bgl_babylon.cc Thu May  7 13:59:58 2009
***************
*** 543,554 ****
--- 543,559 ----
    char *outbuf, *defbuf;
    size_t inbufbytes, outbufbytes;

    inbufbytes = s.size();
    outbufbytes = s.size() * 6;
+ #ifdef _WIN32
    const char *inbuf;
    inbuf = s.data();
+ #else
+   char *inbuf;
+   inbuf = (char *)s.data();
+ #endif
    outbuf = (char*)malloc( outbufbytes + 1 );
    memset( outbuf, '\0', outbufbytes + 1 );
    defbuf = outbuf;
    while (inbufbytes) {
      if (iconv(cd, &inbuf, &inbufbytes, &outbuf, &outbufbytes) == (size_t)-1) {

Эта же ошибка возникала в файле iconv.cc:
Code: Select all
iconv.cc: In member function 'Iconv::Result Iconv::convert(const void*&, size_t&, void*&, size_t&)':
iconv.cc:53: error: invalid conversion from 'char**' to 'const char**'
iconv.cc:53: error:   initializing argument 2 of 'size_t libiconv(void*, const char**, size_t*, char**, size_t*)'

Хак был аналогичным:
Code: Select all
*** goldendict-0.9.0-src/iconv.cc   Sun Aug 16 10:20:26 2009
--- goldendict-0.9.0-src.org/iconv.cc       Sat Apr 18 20:20:12 2009
***************
*** 42,52 ****
--- 42,56 ----
  Iconv::Result Iconv::convert( void const * & inBuf, size_t  & inBytesLeft,
                                void * & outBuf, size_t & outBytesLeft )
    throw( exIncorrectSeq, exOther )
  {
    size_t result = iconv( state,
+                          #ifdef __WIN32
                           (char const **)&inBuf,
+                          #else
+                          (char **)&inBuf,
+                          #endif
                                             &inBytesLeft,
                           (char **)&outBuf, &outBytesLeft );

    if ( result == (size_t) -1 )
    {


Очередная ошибка:
Code: Select all
gcc -c -pipe -O2 -Wall -W -DPROGRAM_DATA_DIR=\"/usr/local/share/apps/goldendict/\" -DPROGRAM_VERSION=\"0.9.0\" -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_XML_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/share/qt4/mkspecs/freebsd-g++ -I. -I/usr/local/include/qt4/QtCore -I/usr/local/include/qt4/QtNetwork -I/usr/local/include/qt4/QtGui -I/usr/local/include/qt4/QtXml -I/usr/local/include/qt4/QtWebKit -I/usr/local/include/qt4 -I. -Ibuild -Ibuild -I/usr/local/include -o build/dictzip.o dictzip.c
In file included from dictzip.c:26:
dictzip.h:71: error: expected specifier-qualifier-list before 'time_t'
dictzip.c: In function 'dict_read_header':

Хакнуто добавлением #include <time.h> в dictzip.c перед строкой #include "dictzip.h".

Следующая ошибка:
Code: Select all
g++ -c -pipe -O2 -Wall -W -DPROGRAM_DATA_DIR=\"/usr/local/share/apps/goldendict/\" -DPROGRAM_VERSION=\"0.9.0\" -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_XML_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/share/qt4/mkspecs/freebsd-g++ -I. -I/usr/local/include/qt4/QtCore -I/usr/local/include/qt4/QtNetwork -I/usr/local/include/qt4/QtGui -I/usr/local/include/qt4/QtXml -I/usr/local/include/qt4/QtWebKit -I/usr/local/include/qt4 -I. -Ibuild -Ibuild -I/usr/local/include -o build/dsl.o dsl.cc
dsl.cc: In function 'std::vector<sptr<Dictionary::Class>, std::allocator<sptr<Dictionary::Class> > > Dsl::makeDictionaries(const std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, const std::string&, Dictionary::Initializing&)':
dsl.cc:1536: warning: format '%X' expects type 'unsigned int', but argument 4 has type 'size_t'
g++ -c -pipe -O2 -Wall -W -DPROGRAM_DATA_DIR=\"/usr/local/share/apps/goldendict/\" -DPROGRAM_VERSION=\"0.9.0\" -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_XML_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/share/qt4/mkspecs/freebsd-g++ -I. -I/usr/local/include/qt4/QtCore -I/usr/local/include/qt4/QtNetwork -I/usr/local/include/qt4/QtGui -I/usr/local/include/qt4/QtXml -I/usr/local/include/qt4/QtWebKit -I/usr/local/include/qt4 -I. -Ibuild -Ibuild -I/usr/local/include -o build/dsl_details.o dsl_details.cc
dsl_details.cc: In constructor 'Dsl::Details::ArticleDom::ArticleDom(const std::wstring&)':
dsl_details.cc:382: warning: format '%u' expects type 'unsigned int', but argument 3 has type 'size_t'
dsl_details.cc: In constructor 'Dsl::Details::DslScanner::DslScanner(const std::string&)':
dsl_details.cc:614: error: 'wcscasecmp' was not declared in this scope
dsl_details.cc: In member function 'bool Dsl::Details::DslScanner::readNextLine(std::wstring&, size_t&)':
dsl_details.cc:714: warning: dereferencing type-punned pointer will break strict-aliasing rules
dsl_details.cc:715: warning: dereferencing type-punned pointer will break strict-aliasing rules
dsl_details.cc:722: warning: dereferencing type-punned pointer will break strict-aliasing rules
dsl_details.cc:723: warning: dereferencing type-punned pointer will break strict-aliasing rules
*** Error code 1

Stop in goldendict-0.9.0-src.

Хак - пришлось убрать инструкции препроцессору для функции wcscasecmp в файле dsl_details.cc:
Code: Select all
*** goldendict-0.9.0-src/dsl_details.cc     Sun Aug 16 10:23:44 2009
--- goldendict-0.9.0-src.org/dsl_details.cc Fri May 15 00:16:50 2009
***************
*** 11,20 ****
--- 11,22 ----
  namespace Details {

  using gd::wstring;
  using std::list;

+ #ifdef __WIN32
+
  // wcscasecmp() function is a GNU extension, we need to reimplement it
  // for non-GNU systems.

  int wcscasecmp( const wchar *s1, const wchar *s2 )
  {
***************
*** 28,37 ****
--- 30,41 ----
    }

    return 0;
  }

+ #endif
+
  /////////////// ArticleDom

  wstring ArticleDom::Node::renderAsText() const
  {
    if ( !isTag )


Текущая проблема:
Не переключается язык интерфейса на русский. Делал сразу после установки GD так:
GD -> F4 -> Interface Language: Russian -> OK -> Ctrl+Q, запускаю GD повторно - в опциях русский стоит, интерфейс английский.
Помогите пожалуйста найти и устранить причину. Запускалось из консоли, вот вывод:
Code: Select all
oldendict
Load done
getResource: gdlookup://localhost?blank=1
scheme: gdlookup
host: localhost
getResource: gdlookup://localhost?blank=1
scheme: gdlookup
host: localhost
getResource: gdlookup://localhost?word=Welcome!&group=4294967295
scheme: gdlookup
host: localhost
In-place finish.
====reading 16384 bytes
====reading 16384 bytes
====reading 16384 bytes
====reading 16384 bytes
getResource: gdlookup://localhost?blank=1
scheme: gdlookup
host: localhost
[amg@srv2 ~]$ goldendict
Load done
getResource: gdlookup://localhost?blank=1
scheme: gdlookup
host: localhost
getResource: gdlookup://localhost?blank=1
scheme: gdlookup
host: localhost
getResource: gdlookup://localhost?word=Welcome!&group=4294967295
scheme: gdlookup
host: localhost
In-place finish.
====reading 16384 bytes
====reading 16384 bytes
====reading 16384 bytes
====reading 16384 bytes
Gerk
 
Posts: 4
Joined: Sun Aug 16, 2009 5:37 am

Re: GoldenDict & FreeBSD

Postby Gerk » Sun Aug 16, 2009 8:44 am

Скорее всего, что в FreeBSD до версии 8.0-CURRENT нет функции wcscasecmp.
пруфлинки:
http://www.gnu.org/software/gnulib/manu ... secmp.html
http://www.freebsd.org/doc/en/books/por ... /book.html (поишите wcscasecmp на странице)
К сожалению мне моих программистских знаний не хватает для создания корректного патча :oops:
Gerk
 
Posts: 4
Joined: Sun Aug 16, 2009 5:37 am

Re: GoldenDict & FreeBSD

Postby ikm » Wed Aug 19, 2009 1:58 pm

Я правильно понимаю, что все изменения, которые потребовались для сборки, это убирания #ifdef _WIN32 ?
ikm
Автор GoldenDict
 
Posts: 1595
Joined: Wed Feb 04, 2009 10:40 am

Re: GoldenDict & FreeBSD

Postby Gerk » Wed Aug 19, 2009 6:02 pm

Добрый день!

1) Потребовалось добавление #include <time.h> перед строкой #include "dictzip.h" в файл "dictzip.c"
2) остальные ошибки так или иначе были связаны с "#ifdef _WIN32"

Спасибо большое за Вашу программу!

==============================================================================
Русский язык добавил так:
скопировал каталог locale в папку с бинарником goldendict (в FreeBSD это /usr/local/bin)
==============================================================================
Gerk
 
Posts: 4
Joined: Sun Aug 16, 2009 5:37 am

Re: GoldenDict & FreeBSD

Postby ikm » Wed Aug 19, 2009 6:07 pm

А в остальном программа нормально функционирует на freebsd?
ikm
Автор GoldenDict
 
Posts: 1595
Joined: Wed Feb 04, 2009 10:40 am

Re: GoldenDict & FreeBSD

Postby Gerk » Wed Aug 19, 2009 7:21 pm

GD на FreeBSD работает великолепно :-)
Gerk
 
Posts: 4
Joined: Sun Aug 16, 2009 5:37 am


Return to Ошибки

Who is online

Users browsing this forum: No registered users and 21 guests