wiki:CreateW64Dev
close Warning:

Create an UltraScan III Development Environment on a 64-bit Windows Host

This document traces the setup of a development environment for a Windows 64-bit version of UltraScan3. The specific versions of components to install may change over time. Likewise, the samples listed reference the "demelerlab-10" host with a development user named "demelerlab"; these will vary on other Windows 64-bit hosts.

I. Overview

  • Commands issued use the two Unix-like environments of
    • Cygwin ( mostly for navigation and file management )
    • MSYS64/MinGW64 ( for makes and g++ compiles )
  • Supporting packages needed include
    • openssl (e.g., openssl_1.0.2d)
    • mysql (e.g., mysql-5.7.13-winx64)
    • tpage (Perl Template Toolkit for manual)
  • The version of Qt used is 5 (e.g., 5.6.0)
  • Immediately Qt-dependent packages include
    • Qwt (e.g., Qwt-6.1.2)
    • Qwtplot3d (e.g., 0.2.7)
  • The UltraScan built is 3.5.*

II. Base Unix-like environments

  • A 64-bit Cygwin installer can be found at:

https://www.cygwin.com/setup-x86_64.exe

  • After running this installer, a shortcut will exist that executes
    $ c:/cygwin64/bin/mintty.exe -i Cygwin-Terminal.ico
    
  • The Cygwin shortcut should always be opened by right-mouse-button context menu and release on "Run as administrator".
  • The 64-bit MSYS/MinGW environment should be downloaded and set up as documented at:

https://wiki.qt.io/MinGW-64-bit

  • The Option-B path (MSYS2) path should be taken.
  • The download and setup should lead to a shortcut that executes
    $ c:/msys64/msys2_shell.bat
    
  • The MSYS2 shortcut should always be opened by right-mouse-button context menu and release on "Run as administrator".
  • The .bashrc file in the home directories for both Cygwin and MSYS2 should have the following text appended:
    # Settings common to both Cygwin and MinGW
    BASHCOMM=`(cd ${USERPROFILE}/bin;pwd)`/bashrc_common
    
    if [ -f ${BASHCOMM} ]; then
      . ${BASHCOMM}
    fi
    
  • The file $USERPROFILE/bin/bashrc_common should be created with contents similar to the following:
    ME="bashrc_common"
    
    HOMEPATH=`(cd ${USERPROFILE};pwd)`
    if [ `uname -s|grep -ci "cyg"` -ne 0 ]; then
      CDRIVE=/cygdrive/c
    else
      CDRIVE=/c
      alias vi='vim'
    fi
    
    HOMEBIN=${HOMEPATH}/bin
    US3=${HOMEPATH}/ultrascan3
    SOMOBIN=${HOMEPATH}/us3_somo
    HSRC=${HOMEPATH}/src
    QTDIR=${CDRIVE}/Qt/5.6.0
    QWTDIR=${CDRIVE}/Qwt/6.1.2
    Q3DDIR=${US3}/qwtplot3d
    US3BIN=${US3}/bin
    US3LIB=${US3}/lib
    QTBIN=${QTDIR}/bin
    QTLIB=${QTDIR}/lib
    QWTLIB=$QWTDIR/lib
    us3=${US3}
    CYGBIN=${CDRIVE}/cygwin64/bin
    
    OPATH=`echo $PATH|sed -e 's@^.*/usr/local@/usr/local@'`
    ABINS="${CDRIVE}/mysql-5.7.13-winx64/bin"
    ABINS="${ABINS}:${CDRIVE}/openssl_1.0.2d/bin"
    ABINS="${ABINS}:${CDRIVE}/icu/bin"
    
    PATH=${HOMEBIN}:${US3BIN}:${QTBIN}:${SOMOBIN}/bin:${ABINS}:${OPATH}
    
    export CDRIVE HOMEPATH HOMEBIN US3 HSRC QTDIR QWTDIR Q3DDIR
    export US3BIN US3LIB SOMOBIN QTBIN QTLIB QWTLIB us3 PATH
    
    alias rm='/bin/rm -i'
    alias lf='ls -F'
    alias ll='ls -lF'
    alias la='ls -a'
    alias lla='ls -laF'
    
    function llrt { ls -lrtF $@ | tail; }
    function cdus { cd $us3/$@; }
    function cdup { cd $us3/programs/us_$@; }
    function cdupp { cd $us3/programs/$@; }
    function cdsrc { cd ${HSRC}/$@; }
    function cdhp { cd ${HOMEPATH}/$@; }
    
    alias pathis='echo $PATH'
    alias mtar='tar -cvf'
    alias ltar='tar -vtf'
    alias xtar='tar -xvf'
    alias rebash='. ${HOMEPATH}/bin/${ME}'
    alias llsz='ls -laF|sort -nrk 5,5|less'
    alias svnstat='svn status|grep -v "^?"'
    
  • NOTE: In commands given below, for any makes or direct g++ compiles, an MSYS2 console should be used; otherwise, a Cygwin one should be used.

III. Supporting packages

  • Supporting packages needed include
    • openssl (e.g., openssl_1.0.2d)
    • mysql (e.g., mysql-5.7.13-winx64)
    • tpage (Perl Template Toolkit for manual)
  • The openssl package should be built from source
    • From a Cygwin windows, for example, extract to source
      cd src
      gzip -cd ../Downloads/openssl_1.0.2d.tar.gz | tar -xvf -
      
    • Then, configure, make and install
      cdsrc openssl-1.0.2d
      ./configure -prefix c:/openssl_1.0.2d
      make
      make install
      
  • The mysql package can be directly installed as binary
    cd c:/
    unzip $HOMEPATH/Downloads/mysql-5.7.13-winx64.zip
    
  • The Perl Template Toolkit (tpage for doc building) first involves installing the AppConfig prerequisite, then the main toolkit package.

IV. Qt build

  • The source archive download for Qt can be found, for example, at:
    https://download.qt.io/official_releases/qt/5.6/5.6.0/single/

  • The source archive file to download there is one like these examples:
    qt-everywhere-opensource-src-5.6.0.tar.gz
    qt-everywhere-opensource-src-5.6.0.zip

  • After download, extracting to a work directory involves commands like
    cd $HOMEPATH/src
    unzip ../Downloads/qt-everywhere-opensource-src-5.6.0.zip
    
  • From a MSYS2 window, the build proceeds in the normal way,.
    cd $HOMEPATH/src/qt-everywhere-opensource-src-5.6.0
    ./configure -prefix c:/Qt/5.6.0 -release -opensource -confirm-license -system-proxies \
    	-nomake tests -nomake examples -opengl desktop -qt-libpng -qt-libjpeg \
    	-openssl -Ic:/openssl_1.0.2d/include -Lc:/openssl_1.0.2d/lib \
    	-plugin-sql-mysql -IC:/mysql-5.7.13-winx64/include -Lc:/mysql-5.7.13-winx64/lib -llibmysql \
    	-plugin-sql-psql -IC:/psql_9.5.3/include -LC:/psql_9.5.3/lib -lpq \
    	-D QT_SHAREDMEMORY -D QT_SYSTEMSEMAPHORE "$@"
    make -j 8
    make -j 8 install
    
  • Note that paths in the above for specific components (e.g., "C:/openssl_1.0.2d...") are examples only. The user's choice of a path may differ.
    • The paths used should be consistent in both the Qt build and the build of the individual component.

V. Qt-dependent packages

  • Qwt (e.g., Qwt-6.1.2)
  • Qwtplot3d (e.g., 0.2.7)
    • ( is updated and built as part of the UltraScan build ).

VI. UltraScan build

An initial build for ultrascan3 involves checkout of the source and setting up of variables in local.pri. That is:

cd $HOMEPATH
co svn://bcf2.uthscsa.edu/ultrascan3/trunk ultrascan3
cd ultrascan3
cp local.pri.template local.pri
vi local.pri
./makeall.sh

In the "vi local.pri" command, appropriate values should be given in the "win32" section to variables. That section in local.pri should set something very like

win32 {
  CONFIG      += core

  # QWT3D is right for libraries, but gui apps need ../$$QWT3D
  # due to us3 directory structure

  QWT3D       = ../qwtplot3d
  QTPATH      = C:/Qt/5.6.0
  QWTPATH     = C:/Qwt/6.1.2
  MINGWDIR    = C:/msys64/mingw64/x86_64-w64-mingw32
  OPENSSL     = C:/openssl-1.0.2d
  MYSQLPATH   = C:/mysql-5.7.13-winx64
  QTMYSQLPATH = $$QTPATH/plugins/sqldrivers
  QMAKESPEC   = win32-g++
  SINGLEDIR   = $$QTPATH/addons/qtsingleapplication-2.6_1-opensource/src/
  INCLUDEPATH += $$QWTPATH/include
  
  contains( DEBUGORRELEASE, debug ) {
    QWTLIB      = $$QWTPATH/lib/libqwtd.a
    MYSQLLIB    = $$MYSQLPATH/lib/libmysqld.a
  } else {
    QWTLIB      = $$QWTPATH/lib/libqwt.a
    MYSQLLIB    = $$MYSQLPATH/lib/libmysql.lib
  }

  #  __LCC__ is needed on W32 to make mysql headers include the right W32 includes
  DEFINES    += __LCC__
  DEFINES    += QT_SHAREDMEMORY
  DEFINES    += QT_SYSTEMSEMAPHORE
}

V. Miscellaneous Notes

  • In commands above, the console window should be a Cygwin one if they involve
    • svn
    • gzip
    • zip
  • The window should be an MSYS2 one if commands involve
    • make
    • g++
    • configure
  • If unclear what commands suggest, try MSYS2 first.
  • The add-on QtSingleApplication class ( $QTDIR/addons/qtsingleapplication-2.6_1-opensource ) is not supported, nor needed, for Qt5.
Last modified 20 months ago Last modified on Dec 6, 2016 3:29:52 PM