Opened 15 years ago
Closed 14 years ago
#2021 closed bug (fixed)
[FreeBSD] problem compiling Qgis with grass. Kpty.c qtermwidget
Reported by: | slash | Owned by: | nobody |
---|---|---|---|
Priority: | major: does not work as expected | Milestone: | Version 1.5.0 |
Component: | Build/Install | Version: | 1.3.0 |
Keywords: | freebsd grass | Cc: | |
Must Fix for Release: | No | Platform: | FreeBSD |
Platform Version: | 8.0 | Awaiting user input: | no |
Description
On FreeBSD 8.0RC1 (i don't know for older version) you can't compile Qgis with Grass option. There is a problem with kpty.c file in qtermwidget
[ 77%] Building CXX object src/plugins/grass/CMakeFiles/grassplugin.dir/qtermwidget/kpty.o /usr/ports/graphics/qgis/work/qgis-1.3.0/src/plugins/grass/qtermwidget/kpty.cpp: In member function 'void KPty::login(const char*, const char*)':
/usr/ports/graphics/qgis/work/qgis-1.3.0/src/plugins/grass/qtermwidget/kpty.cpp:489: error: 'utmpname' was not declared in this scope /usr/ports/graphics/qgis/work/qgis-1.3.0/src/plugins/grass/qtermwidget/kpty.cpp:490: error: 'setutent' was not declared in this scope
/usr/ports/graphics/qgis/work/qgis-1.3.0/src/plugins/grass/qtermwidget/kpty.cpp:491: error: 'pututline' was not declared in this scope /usr/ports/graphics/qgis/work/qgis-1.3.0/src/plugins/grass/qtermwidget/kpty.cpp:492: error: 'endutent' was not declared in this scope
/usr/ports/graphics/qgis/work/qgis-1.3.0/src/plugins/grass/qtermwidget/kpty.cpp:493: error: 'updwtmp' was not declared in this scope /usr/ports/graphics/qgis/work/qgis-1.3.0/src/plugins/grass/qtermwidget/kpty.cpp: In member function 'void KPty::logout()':
/usr/ports/graphics/qgis/work/qgis-1.3.0/src/plugins/grass/qtermwidget/kpty.cpp:539: error: 'utmpname' was not declared in this scope /usr/ports/graphics/qgis/work/qgis-1.3.0/src/plugins/grass/qtermwidget/kpty.cpp:540: error: 'setutent' was not declared in this scope
/usr/ports/graphics/qgis/work/qgis-1.3.0/src/plugins/grass/qtermwidget/kpty.cpp:541: error: 'getutline' was not declared in this scope /usr/ports/graphics/qgis/work/qgis-1.3.0/src/plugins/grass/qtermwidget/kpty.cpp:558: error: 'pututline' was not declared in this scope
/usr/ports/graphics/qgis/work/qgis-1.3.0/src/plugins/grass/qtermwidget/kpty.cpp:560: error: 'endutent' was not declared in this scope * Error code 1
Stop in /usr/ports/graphics/qgis/work/qgis-1.3.0.
* Error code 1
Stop in /usr/ports/graphics/qgis/work/qgis-1.3.0. * Error code 1
Stop in /usr/ports/graphics/qgis/work/qgis-1.3.0. * Error code 1
Stop in /usr/ports/graphics/qgis. * Error code 1
Stop in /usr/ports/graphics/qgis.
Attachments (2)
Change History (9)
comment:1 by , 15 years ago
Priority: | critical: causes crash or data corruption → major: does not work as expected |
---|
by , 15 years ago
comment:2 by , 15 years ago
I have found the problem by myself (and maybe the solution).
The file kpty.cpp in /qgis/src/plugins/grass/qtermwidget make a call to functions in utmp.h header of the GLIBC. setutent updwtmp & co...
In fact we don't have this functions in FreeBSD Headers.
So the solution is to copy/paste the code source of this functions in the ktpy file like in the attached file.
It's not beautiful but it works. I have can build install and use grass plugins without crash with this solutions.
Regards.
comment:3 by , 15 years ago
Milestone: | → Version 1.4.0 |
---|
comment:5 by , 14 years ago
Must Fix for Release: | Yes → No |
---|
comment:6 by , 14 years ago
Sorry, i was away from qgis for a time.
The bug is still true in the current trunk.
The solutions is the same :
QGis use some functions of the Glibc. If you see the man page of getutent & the others you have this disclaimer :
Portability Note: Although many operating systems provide a subset of these functions, they are not standardized. There are often subtle differences in the return types, and there are considerable differences between the various definitions of struct utmp. When programming for the GNU system, it is probably best to stick with the functions described in this section. If however, you want your program to be portable, consider using the XPG functions described in XPG Functions, or take a look at the BSD compatible functions in Logging In and Out.
You can also include the functions in other source code like this change i've made to compile with grass plugins on my FreeBSD :
Change in src/plugins/grass/qtermwidget/kpty.cpp :
--- src/plugins/grass/qtermwidget/kpty.cpp.orig 2010-08-24 18:47:22.000000000 +0 +++ src/plugins/grass/qtermwidget/kpty.cpp 2010-08-24 18:48:06.000000000 +0 @@ -24,6 +24,10 @@
#include "kpty_p.h"
+#if defined(FreeBSD) +#include "kpty_hack_for_bsd" +#endif +
#ifdef sgi #define svr4 #endif
New file in src/plugins/grass/qtermwidget/: kpty_hack_for_bsd.h kpty_hack_for_bsd.cpp
(this files includes functions getutent & other).
This solutions is sometimes used on BSD.
Also, i have add a path in the FindGRASS.cmake.
In the attach file (freebsd_patch_qgis.tar.gz) you have :
The diff file for FindGRASS.cmake with the 2 files (original and modified) The diff file for src/plugins/grass/qtermwidget/ktpy.cpp with the 2 files (original and modified) The new files in src/plugins/grass/qtermwidget/.
by , 14 years ago
Attachment: | freebsd_patch_qgis.tar.gz added |
---|
The source code correct for FreeBSD (I hope)