Wednesday, April 25, 2018

Solaris 11.4: FileZilla 3.31 builds on Solaris cleanly (nearly)

After seeing a post on twitter about building FileZilla on Solaris 11.3 I thought I would I would try it on Solaris 11.4.

I did get it working but with some "Dirty Fixes", by adding cast of "size_t" to a lot of code, but then I realised that there was a quicker fix..

Update: April 26th 2018:
Update: Auguest 14th 2019:
    Unable to build with Solaris 11.4 since does not build with GCC 7.3 and wxWidgets 3.0.3. You need GCC 7.1 which was only available on 11.4 beta.
# pkg list library/graphics/wxwidgets library/icu gnutls-3 library/motif developer/gcc/gcc-c-7 developer/gcc/gcc-common-7 build/make gnu-tar gnu-make text/gnu-grep xdg/xdg-utils
NAME (PUBLISHER)                                  VERSION                    IFO
archiver/gnu-tar                                  1.29-        i--
desktop/xdg/xdg-utils                             1.1.1-       i--
developer/build/gnu-make                          4.2.1-       i--
developer/build/make                              11.4-        i--
developer/gcc/gcc-c-7                             7.3.0-       i--
developer/gcc/gcc-common-7                        7.3.0-       i--
library/gnutls-3                                  3.5.16-      i--
library/graphics/wxwidgets                        3.0.3-       i--
library/icu                                       11.4-        i--
library/motif                                     0.5.12-     i--
text/gnu-grep                                     3.1-         i--

Need to check PATH so that it adds 64bit "/usr/bin/64" binaries forgetting this may give you errors. For example we need "/usr/bin/64/wx-config" and NOT "/usr/bin/wx-config"
# echo $PATH

# bzip2 -dc libfilezilla-0.12.1.tar.bz2 | gtar xf -
# cd libfilezilla-0.12.1
# ./configure --prefix=/usr/local
# gmake
# gmake install

# cd ..
# bzip2 -dc FileZilla_3.31.0_src.tar.bz2 | gtar xf -
# cd filezilla-3.31.0
# export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/share/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig/gnutls-3
# ./configure  --prefix=/usr/local CPPFLAGS="-I/usr/include/idn" LDFLAGS="-L/usr/lib/amd64/gnutls-3"  --with-pugixml=builtin --enable-precomp
# gmake
If you get the following then you have an error in the above since you are using the wrong 
 include file "/usr/lib/wx/include/gtk2-unicode-3.0/wx/setup.h" where you should be 
 using "/usr/lib/amd64/wx/include/gtk2-unicode-3.0/wx/setup.h"

/usr/include/wx-3.0/wx/filename.h: In static member function ‘static wxUniChar wxFileName::GetPathSeparator(wxPathFormat)’:
/usr/include/wx-3.0/wx/filename.h:473:43: error: ambiguous overload for ‘operator[]’ (operand types are ‘wxString’ and ‘unsigned int’)
         { return GetPathSeparators(format)[0u]; }
/usr/include/wx-3.0/wx/filename.h:473:43: note: candidate: operator[](const char*, long int)
/usr/include/wx-3.0/wx/filename.h:473:43: note: candidate: operator[](const wchar_t*, long int) 
In file included from /usr/include/wx-3.0/wx/memory.h:15:0,
                 from /usr/include/wx-3.0/wx/object.h:19,
                 from /usr/include/wx-3.0/wx/event.h:16,
                 from /usr/include/wx-3.0/wx/window.h:18,
                 from /usr/include/wx-3.0/wx/nonownedwnd.h:14,
                 from /usr/include/wx-3.0/wx/toplevel.h:20,
                 from /usr/include/wx-3.0/wx/dialog.h:14,
                 from /usr/include/wx-3.0/wx/msgdlg.h:18,
                 from msgbox.h:4,
                 from filezilla.h:6:
Overloading is a major problem and it normally means you are mixing data types. You will get the following error due to out of date code in putty.
uxshare.c: In function ‘platform_ssh_share’:
uxshare.c:301:9: warning: implicit declaration of function ‘flock’; did you mean ‘mlock’? [-Wimplicit-function-declaration]
     if (flock(lockfd, LOCK_EX) < 0) {
uxshare.c:301:23: error: ‘LOCK_EX’ undeclared (first use in this function); did you mean ‘LOCK_HELD’?
     if (flock(lockfd, LOCK_EX) < 0) {
uxshare.c:301:23: note: each undeclared identifier is reported only once for each function it appears in
Nearly there, but putty uses flock() instead of POSIX fcntl(). So a final fix:
# diff src/putty/unix/uxshare.c src/putty/unix/uxshare.orig  
 <   struct flock lock;  
 <   lock.l_type = F_WRLCK;  
 <   lock.l_whence = SEEK_SET;  
 <   lock.l_start = 0;  
 <   lock.l_len = 0;  
 < #ifdef __sun  
 <   if (fcntl(lockfd, F_SETLK, &lock) == -1) {  
 <     *logtext = dupprintf("%s: fcntl(F_SETLK): %s",  
 <               lockname, strerror(errno));  
 < #else  
 < #endif  

# gmake
# gmake install

# /usr/local/bin/filezilla -v
Reading locale option from /home/andrew/.config/filezilla/filezilla.xml
FileZilla 3.31.0, compiled on 2018-04-25

If you get an error "Failed to load module "canberra-gtk-module" then you are 
 missing the following package "desktop/xdg/libcanberra", which you can 
 install "pkg install desktop/xdg/libcanberra"

Final warning you may get a popup "assert "m_widget" failed in Show(): invalid frame" when running filezilla, but that is a know bug in wxWidgets but for some reason has not been included yet!

Anyway, it works.

No comments: