Проблема сборки PAPyRUS под OpenBSD 6.2
-
Скомпилировал с данной опцией - нулевой эффект. Но да, я согласен, не может быть ошибки в коде, выложенном в репах, к тому же там и бинарники имеются. Скорее всего, несовместимость систем, библиотек, и их версий.
И кривые руки у того, кто пытается это оживить. -
Я остановил попытку оживить самую первую версию, ибо это бессмысленно. И вернулся ко второй версии его кода, за кою брался изначально. Насколько я понял вот еще одна ошибка:
Program received signal SIGSEGV, Segmentation fault. StyleItem::set_attr (this=0x0, t=STYLE_TAG, value=0xa8) at kernel/StyleManager/styleItem.cc:233 233 this->_tag=tmp_1;
То есть, при записи в переменную класса _tag значения она сыплется, причем первый раз значение устанавливается, то есть, при первой инициализации класса, и даже из void* изымается нормально, а вот позже - никак. Не подскажите, с чем это связано (я грешил на приватность переменной, но даже когда я сделал ее публичной, это ничего не дало)?
styleItem.h:/* * styleItem.h -- * * This file contains the declaration of the 'StyleItem' class. * * Copyright (C) 1996-1997 Carlos Nunes - loscar@mime.univ-paris8.fr * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ #ifndef STYLE_ITEM #define STYLE_ITEM #include "../FontManager/fontFamily.h" #include "../margin.h" /* * Allowed alignment types */ typedef enum { STYLE_ALIGN_LEFT, STYLE_ALIGN_RIGHT, STYLE_ALIGN_CENTER, STYLE_ALIGN_FULL } StyleAlignType; /* * Allowed list types */ typedef enum { NOT_LIST, UNNUMBERED_LIST, NUMBERED_LIST } StyleListType; /* * Allowed style attributes types. */ typedef enum { STYLE_NAME = 1<<0, STYLE_ALIGNMENT = 1<<1, STYLE_FLINE_MARGIN = 1<<2, STYLE_BOTTOM_MARGIN = 1<<3, STYLE_TOP_MARGIN = 1<<4, STYLE_LEFT_MARGIN = 1<<5, STYLE_RIGHT_MARGIN = 1<<6, STYLE_TAG = 1<<7, STYLE_POINTER = 1<<8, STYLE_NEXT_STYLE = 1<<9, STYLE_FONT = 1<<10 } StyleAttrType; #define STYLE_MARGINS (STYLE_TOP_MARGIN | STYLE_BOTTOM_MARGIN | \ STYLE_LEFT_MARGIN | STYLE_RIGHT_MARGIN) /* * The class StyleItem class is derived from the Margin class. */ class StyleItem : public Margin { private: char *_name; /* Name of the style */ FontItem *_font; /* Font of the style */ StyleAlignType _alignment; /* Alignment of the style */ unsigned int _fline; /* First line margin */ char *_nstyle; /* Style name to apply on the next paragraph */ StyleItem *_next; /* Next style in the chained list */ StyleItem *_prev; /* Previous style in the chained list */ int set_tag(int); public: int _tag; /* Tag of the style */ StyleItem(); ~StyleItem(); void *get_attr(StyleAttrType); void set_attr(StyleAttrType, void *); inline StyleItem *get_next(void) const { return _next; } inline void set_next(StyleItem *n) { _next = n; } inline StyleItem *get_prev(void) const { return _prev; } inline void set_prev(StyleItem *n) { _prev = n; } }; #endif
-
styleItem.cc:
/* * styleItem.cc -- * * This file contains the definitions of the 'StyleItem' class * methods. * * Copyright (C) 1996-1997 Carlos Nunes - loscar@mime.univ-paris8.fr * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ extern "C" { #include <stdio.h> #include <string.h> } #include <stdint.h> #include <iostream> #include "styleItem.h" using namespace std; /* *---------------------------------------------------------------------- * * StyleItem -- * * This method is invoked every time a StyleItem is created. * * Results: * None. * * Side effects: * The datas class are initialized. * *---------------------------------------------------------------------- */ StyleItem::StyleItem(void) { _name = NULL; _font = NULL; _tag = 0; _nstyle = NULL; } /* *---------------------------------------------------------------------- * * ~StyleItem -- * * This method is invoked every time a StyleItem is deleted. * * Results: * None. * * Side effects: * None. * *---------------------------------------------------------------------- */ StyleItem::~StyleItem() { _name = NULL; _font = NULL; _tag = 0; _nstyle = NULL; } /* *---------------------------------------------------------------------- * * get_attr -- * * This method is invoked to get an attribute of the StyleItem. * * Results: * Returns the value of the attribute which type is 't', or * NULL if not found. * * Side effects: * None. * *---------------------------------------------------------------------- */ void * StyleItem::get_attr(StyleAttrType t) { switch( t ) { case STYLE_NAME: printf("STYLE_NAME\n"); printf(">%s\n", _name); return (void *)_name; break; case STYLE_ALIGNMENT: return (void *)_alignment; break; case STYLE_FLINE_MARGIN: return (void *)_fline; break; case STYLE_BOTTOM_MARGIN: return (void *)get_bmargin(); break; case STYLE_TOP_MARGIN: return (void *)get_tmargin(); break; case STYLE_LEFT_MARGIN: return (void *)get_lmargin(); break; case STYLE_RIGHT_MARGIN: return (void *)get_rmargin(); break; case STYLE_TAG: return reinterpret_cast<void*>(_tag); printf("<get: %d\n", _tag); break; case STYLE_NEXT_STYLE: return (void *)((_nstyle==NULL) ? "Normal" : _nstyle); return (char *)_nstyle; break; case STYLE_FONT: return (void *)_font; break; default: fprintf(stderr, "StyleItem::get_attr: StyleAttrType %d not allowed\n", (int)t); } return NULL; } /* *---------------------------------------------------------------------- * * set_attr -- * * This method is invoked to set an attribute of the StyleItem. * * Results: * None. * * Side effects: * None. * *---------------------------------------------------------------------- */ int StyleItem::set_tag(int i){ this->_tag = i; } void StyleItem::set_attr(StyleAttrType t, void *value) { printf("....set_attr: start\n"); unsigned int tmp_1; unsigned char a,b; unsigned short datatum; switch( t ) { case STYLE_NAME: if( _name != NULL ) delete _name; _name = strdup((char *)value); break; case STYLE_ALIGNMENT: _alignment = reinterpret_cast<StyleAlignType &>(value); break; case STYLE_FLINE_MARGIN: _fline = (unsigned int)value; break; case STYLE_BOTTOM_MARGIN: printf("%p\n", value); datatum = (unsigned short)value; printf("%hu\n", value); set_bmargin(value); break; case STYLE_TOP_MARGIN: set_tmargin((unsigned int)value); break; case STYLE_LEFT_MARGIN: set_lmargin((unsigned int)value); break; case STYLE_RIGHT_MARGIN: set_rmargin((unsigned int)value); break; case STYLE_TAG: printf("....set_attr[tag]: started\n"); printf("....set_attr[tag]: started!\n"); if(value!=0x0){ tmp_1 = (int)value; printf("....set_attr: tmp_1=%d\n",tmp_1); this->_tag=tmp_1; printf("....set_attr: _tag=%d\n",_tag); } break; case STYLE_NEXT_STYLE: if( _nstyle != NULL ) delete _nstyle; _nstyle = strdup((char *)value); break; case STYLE_FONT: _font = (FontItem *)value; break; default: fprintf(stderr, "StyleItem::set_attr: StyleAttrType %d not allowed\n", (int)t); }; }
-
papyrus-menus.tcl:
# # papyrus-menus.tcl -- # # This file contains the standard menu definitions. # # Copyright (C) 1996-1997 Carlos Nunes - loscar@mime.univ-paris8.fr # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # Function : Load_Style_Menus # # Invoked at the init of Papyrus, this function defines the standard styles. # puts "TCL:Load_Style_Menus..0.0\n" proc Load_Fonts {} { puts "TCL:Load_Fonts..0.1\n" # # "Times" family # puts "TCL:Load_Font..0.2\n" AddFont -family "Times" -style "normal" \ -x11 "-adobe-times-medium-r-normal--*-*-*-*-*-*-iso8859-1" \ -ps "Times-Roman" puts "TCL:Load_Font..0.3\n" AddFont -family "Times" -style "bold" \ -x11 "-adobe-times-bold-r-normal--*-*-*-*-*-*-iso8859-1" \ -ps "Times-Bold" puts "TCL:Load_Font..0.4\n" AddFont -family "Times" -style "italic" \ -x11 "-adobe-times-medium-i-normal--*-*-*-*-*-*-iso8859-1" \ -ps "Times-Italic" AddFont -family "Times" -style "bold_italic" \ -x11 "-adobe-times-bold-i-normal--*-*-*-*-*-*-iso8859-1" \ -ps "Times-BoldItalic" puts "TCL:Load_Font..0.5\n" puts "TCL:Load_Font..Done\n" # # "Helvetica" family # AddFont -family "Helvetica" -style "normal" \ -x11 "-adobe-helvetica-medium-r-normal--*-*-*-*-*-*-iso8859-1" \ -ps "Helvetica" AddFont -family "Helvetica" -style "bold" \ -x11 "-adobe-helvetica-bold-r-normal--*-*-*-*-*-*-iso8859-1" \ -ps "Helvetica-Bold" AddFont -family "Helvetica" -style "italic" \ -x11 "-adobe-helvetica-medium-o-normal--*-*-*-*-*-*-iso8859-1" \ -ps "Helvetica-Oblique" AddFont -family "Helvetica" -style "bold_italic" \ -x11 "-adobe-helvetica-bold-o-normal--*-*-*-*-*-*-iso8859-1" \ -ps "Helvetica-BoldOblique" # # "Courier" family # AddFont -family "Courier" -style "normal" \ -x11 "-adobe-courier-medium-r-normal--*-*-*-*-*-*-iso8859-1" \ -ps "Courier" AddFont -family "Courier" -style "bold" \ -x11 "-adobe-courier-bold-r-normal--*-*-*-*-*-*-iso8859-1" \ -ps "Courier-Bold" AddFont -family "Courier" -style "italic" \ -x11 "-adobe-courier-medium-o-normal--*-*-*-*-*-*-iso8859-1" \ -ps "Courier-Oblique" AddFont -family "Courier" -style "bold_italic" \ -x11 "-adobe-courier-bold-o-normal--*-*-*-*-*-*-iso8859-1" \ -ps "Courier-BoldOblique" # # "Symbol" family # AddFont -family "Symbol" -style "normal" \ -x11 "-adobe-symbol-medium-r-normal--*-*-*-*-*-*-adobe-fontspecific" \ -ps "Symbol" Add_Family_Entry "Courier" Add_Family_Entry "Helvetica" Add_Family_Entry "Times" Add_Family_Entry "Symbol" } # Function : Load_Style_Menus # # Invoked at the init of Papyrus, this function defines the standard styles. # proc Load_Default_Styles {} { puts "TCL:Load_Default_Styles..0.1\n" set normal_font { Times normal 10 } puts "TCL:Load_Default_Styles..0.2\n" set title1_font { Helvetica bold 14 } puts "TCL:Load_Default_Styles..0.3\n" set title2_font { Helvetica bold_italic 12 } puts "TCL:Load_Default_Styles..0.4\n" set title3_font { Helvetica normal 12 } puts "TCL:Load_Default_Styles..0.5\n" set listing_font { Courier normal 10 } puts "TCL:Load_Default_Styles..0.6\n" AddStyle -name "Normal" -font $normal_font -align "left" -margins {0 0 0 0} -fline 0.5c puts "TCL:Load_Default_Styles..Add_Style..0.0\n" AddStyle -name "Titre1" -font $title1_font -align "left" -margins {12p 3p 0 0} puts "TCL:Load_Default_Styles..Add_Style..0.1\n" AddStyle -name "Titre2" -font $title2_font -base "Titre1" puts "TCL:Load_Default_Styles..Add_Style..0.2\n" AddStyle -name "Titre3" -font $title3_font -base "Titre1" puts "TCL:Load_Default_Styles..Add_Style..0.3\n" AddStyle -name "Listing" -font $listing_font -base "Normal" -fline 0 -next "Listing" puts "TCL:Load_Default_Styles..Add_Style..0.4\n" AddStyle -name "Liste1" -base "Normal" -margins {0 0 0.5c 0} \ -fline -0.5c -tag 168 -next "Liste1" puts "TCL:Load_Default_Styles..Add_Style..0.5\n" AddStyle -name "Liste2" -base "Normal" -margins {0 0 1c 0} \ -fline -0.5c -tag 183 -next "Liste2" puts "TCL:Load_Default_Styles..Add_Style..0.6\n" AddStyle -name "Liste3" -base "Normal" -margins {0 0 1.5c 0} \ -fline -0.5c -tag 174 -next "Liste3" puts "TCL:Load_Default_Styles..Add_Style..0.7\n" puts "TCL:Load_Default_Styles..Done\n" } # # Function : Load_Default_OptionMenus # # Invoked at the init of Papyrus, this function defines some standard option menus. # proc Load_Default_OptionMenus {} { # # Defines the zoom optionMenu # foreach zoom {50 75 100 150 200 300} { Add_Zoom_Entry $zoom } # # Defines the font family optionMenu # # foreach family {Courier Helvetica "new century schoolbook" times} { # Add_Family_Entry $family # } # # Defines the font size optionMenu # foreach size {8 9 10 11 12 14 16 18 20 22 24 26 28 36 48 72} { Add_Size_Entry $size } }
log:....>AddStyle..0.11 10 168 ....set_attr: start ....set_attr[tag]: started ....set_attr[tag]: started! ....set_attr: tmp_1=168 Program received signal SIGSEGV, Segmentation fault. StyleItem::set_attr (this=0x0, t=STYLE_TAG, value=0xa8) at kernel/StyleManager/styleItem.cc:233 233 this->_tag=tmp_1; (gdb) q The program is running. Exit anyway? (y or n) y $
-
Тогда он запускается и валится вот на этом при попытке создать новый документ и/либо открыть:
Program received signal SIGSEGV, Segmentation fault. MoveCursorUp_Cmd (interp=0x825d8408, argc=1) at shape.h:82 82 inline Line *get_line_parent(void) const { return (Line *)get_parent()->get_parent(); }
Видимо, не происходит загрузки стилей, если не загрузить _tag. -
>И всё же, код из исходников не может быть с ошибками.
Я и не спорю с этим, я сам удивлен, так как тот-же yrolo, примерно того-же времени собрался всего лишь после правильного указания путей в Makefile для линковки с Motif, и CDE пусть и с пятого раза, но собралась, а он явно посложнее будет, чем недо-Word ( И тоже, кстати, использует TCL). -
А вот это уже интересно - вы были правы, проблема с системой. Я не пользовался ни календарем, ни другими функциями CDE, в коих зайдействован tcl, но, решив создать напоминание на завтра, я столкнулся с тем, что у меня вылетел календарь. С Segmention Fault.
Я использовал gdb, и, мягко говоря, удивился, ибо да, сейчас ошибка в PAPyRUS другая, видимо созданная моими "исправлениями", но я прекрастно помню схожую один в один ругань на язык:
dtcm [календарь]:Program received signal SIGSEGV, Segmentation fault. sprintf (str=Variable "str" is not available. ) at /usr/src/lib/libc/stdio/sprintf.c:61 61 /usr/src/lib/libc/stdio/sprintf.c: No such file or directory. in /usr/src/lib/libc/stdio/sprintf.c Current language: auto; currently minimal (gdb) c Continuing. Program terminated with signal SIGSEGV, Segmentation fault. The program no longer exists.
Видимо, CDE не вся завязана на TCL, с коим у меня, безусловно очень серьезные проблемы, или с локалью, что тоже вероятно. Но хотя бы теперь очевидно что не так с PAPyRUS'ом, ну, либо это - очередной ложный след. В любом случае, мне пришлось бы рано или поздно править LC_ALL и LANG при запуске. -
Одни ложные следы... Меня тоже насторожило "C" когда я первый раз Вас про локаль спрашивал. И кстати, у меня тоже тут были проблемы с WindowMaker, который нигде не запускается. Хотя все остальное от Fluxbox до MATE работает нормально.
Попробуйте в какой-нибудь тестовой системе установить старый TCL (который ровно соответствует сис.требованиям).