Menu

Tree [f34512] master /
 History

HTTPS access


File Date Author Commit
 AdminConsole 2016-11-23 Juri Skuratovski Juri Skuratovski [3c7ab7] RMV wasted
 Database 2016-07-11 Jacob Jacob [912b3b] ADD script to add Kostentraeger for all Studien...
 Documentation 2016-11-23 Juri Skuratovski Juri Skuratovski [3c7ab7] RMV wasted
 HBS-Interface 2016-09-27 Juri SKuratovski Juri SKuratovski [fa042f] CHG sync with main developer branch
 LBS-Client 2016-11-25 Juri Skuratovski Juri Skuratovski [8168c5] ADD missing files
 LBS-Server 2016-11-25 Juri Skuratovski Juri Skuratovski [f34512] FIX conflicts
 SOAP 2016-11-22 Juri Skuratovski Juri Skuratovski [0fc3c7] CHG support for several connection string (para...
 Statistik 2016-08-08 Jacob Jacob [290d0a] CHG remove two DAT too much in PsqlStatements f...
 doc 2016-10-19 Juri Skuratovski Juri Skuratovski [69d990] CHG AdminConsole - several changes in the postb...
 .gitignore 2016-07-07 Jacob Skuratovski Jacob Skuratovski [25b0a4] CHG work on documentation
 README.md 2016-11-25 Juri Skuratovski Juri Skuratovski [f34512] FIX conflicts
 ServerUbuntu16Minimal.md 2016-07-04 Juri Skuratovski Juri Skuratovski [e21bca] CHG database jutification (datestyle & column r...
 env.cmd 2016-04-28 Juri Skuratovski Juri Skuratovski [4cbff7] CHG new gSoap (2.8.28-1, compatible with Ubuntu...
 readme-linux.txt 2016-04-28 Juri Skuratovski Juri Skuratovski [fae0c3] CHG linux-related installation

Read Me

README

Open HBS

What is this repository for?

How do I get set up?

  • Summary of set up
  • Development environment

  • orwell dev-c++ version 5.10 with gc 4.8.1

  • wxWidgets 2.8.12/3.0.2 (yeah, it works now with 3.0.2 as well!)

  • compilation wxWidgets:

before compilation (probably!) makefile.gcc must be adapted as follow:
set shell variable (if cygwin or similar used)
makefile.gcc

#!makefile

    #SHELL := $(COMSPEC)
    SHELL := cmd

add RCFLAGS to the resource compiler:

#!bash

sed  -i 's/--define/$(RCFLAGS) --define/g'   makefile.gcc

then compiler could be started..

#!bash
mingw32-make.exe -j4 -f makefile.gcc UNICODE=0 SHARED=1 BUILD=debug CXXFLAGS+="-D__MINGW64__ -fpermissive -fno-keep-inline-dllexport -Wno-unused-local-typedefs" CPPFLAGS=-m32 LDFLAGS=-m32 RCFLAGS=-Fpe-i386

probably this command has to be started twice - first runs generates strange error, the second run works fine.

build release without asserts:

mingw32-make.exe -j4 -f makefile.gcc UNICODE=0 SHARED=1 BUILD=release CXXFLAGS+="-DNDEBUG=1 -D__MINGW64__ -fpermissive -fno-keep-inline-dllexport -Wno-unused-local-typedefs" CPPFLAGS=-m32 LDFLAGS=-m32 RCFLAGS=-Fpe-i386

  • Configuration
  • Dependencies

dev-c++ packages

  1. zlib

  2. openssl (v.0.98/0.98a, but not 1.x, because x509v3.h probably conflicts with wincrypt.h)

(it works even with 1.x, but some lines in the x509v_3.h must be out commented)

after installing zlib package zlib directory missing.
it must be created manually in "...\Dev-Cpp\include" and both zconf.h and zlib.h files have to be moved into.

  • Database configuration

running from the pgsql command promt:
(connect to the default database first)

#!SQL
start psql:
psql.exe -U postgres

create user "lbs-admin" password 'lbsadm';
create database "HBS" owner = "lbs-admin" lc_ctype='C' lc_collate='C' encoding 'LATIN1' template template0;

...reconnect to the database HBS

#!SQL

pgsql -d HBS -U "lbs-admin"

create schema "LBS" AUTHORIZATION "lbs-admin";

\i create_khs_weissensee.sql;
  • How to run tests
  • Deployment instructions

Building the Client

Build with Code::Block with MinGW TDM-GCC 4.8.1

  1. download Code::Block with MinGW here: http://www.codeblocks.org/downloads/binaries#windows
  2. add compiler path to the system path
  3. Settings->Compiler->tool chain -> auto detect compiler settings
  4. download and build zlib (zlib must be placed in the directory zlib, or zlib-<version> must be linkes to zlib)</version>
  5. download binary openssl 1.02d developer release: https://slproweb.com/download/Win32OpenSSL-1_0_2d.exe
  6. easylogging (v.8.91) will be used for logging (https://github.com/easylogging/easyloggingpp). in the .h file one change is mandatory:
    in the line 74: _ELPP_GCC_VERSION >= 40801
    the number 40801 must be replaced with (any) bigger number, otherwise compiler forced to use c++11.
    6a. lines starting with 152 : #include <winsock2.h> is needed
    // Windows
    #if defined(_WIN32) || defined(_WIN64)
    # define _ELPP_OS_WINDOWS 1
    #include <winsock2.h>
    #else
    # define _ELPP_OS_WINDOWS 0
    #endif // defined(_WIN32) || defined(_WIN64)</winsock2.h></winsock2.h>

  7. Ini file reader/parser inih (https://github.com/benhoyt/inih)

  8. gSoap 2.8.16 (not newer due to gSoaps change over to newer compiler standard not supported by MinGW 4.8.1)
  9. download postgres redistributable and create .a files from libpq.dll

  10. generate .def file from dll: http://purefractalsolutions.com/show.php?a=utils/expdef

  11. generate .a file from .def file:http://www.mingw.org/wiki/createimportlibraries (must not be downloaded extra, is a part of MinGW)

  12. setup include/lib paths in the Code:Block

  13. ups! compile wxWidgets as explained above
  14. to be used with MS VC++ compiler in the file include\wx\msw\wx.rc reference to wx.manifest near end of file must
    out commented
  15. for DEBUG build use: make ... DEBUG=1, for release build: make ... DEBUG=2
  16. Enjoy!

** note **
* directory structure:

<drive>
*\hksb
\3rdParty
\</drive>

  • all components (except of Code::Block and wxWidget) must be placed in the folder 3rdParty
  • it is not allowed to use in any part paths with spaces due to restriction (known bug) in the windres resource compiler. #

Building the project on Windows with Eclipse and TDM2 4.8.1

Note: WXwxWidgets' official recommendation is using MinGW TDM-GCC. You can most likely go through this section using this compiler - we did not test this combination yet tho. It may also work with GCC, which we do not recommend as we had mixed results.

Note: In the following sections, you will find some paths which you have, for example, to add to environment variables. If you decide to install/copy/unzip some of the files or tools to other directories, you will have to adjust the paths.

Client

  1. Get the compiler of your choice:

    a) TDM2 4.8.1: http://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%20Installer/Previous/1.1309.0/ or

    b) MinGW TDM-GCC 4.8.1: http://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%20Old%20Releases/TDM-GCC%204.8%20series/

    Note: Do not forget to set the path to the compiler in the environment Path variable.

  2. Get the Eclipse IDE:

    a) You can either download the Eclipse IDE for C/C++ Developers directly here: http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/keplersr2 or

    b) Download the CDT extention here: https://eclipse.org/cdt/downloads.php

    Note: If you want to make sure the project will be built, use Eclipse Mars.1 as this is the release we tested.

  3. Set up the directory structure and get the source code

    In any drive (or directory you linked to be a drive), you have to create the directory HKSB in which you have to create another directory called 3rdparty. As the name suggests, the 3rdparty directory will contain (at least most of) the 3rd-party software we have to use and which you will find in the upcoming sections.

    You now can create another directory for the project, let's call it HBS. Into this directory you have to clone the project, resulting in you having the following directories:

    <drive>\HKSB\3rdparty

    <drive>\HKSB\HBS\ with the directories LBS-Client, LBS-Server, HBS-Interface Database and SOAP in it.

    If you decide to replace some of the files in the SOAP directory (which you can, for example if you want to use another version of gSoap), you have to add the following lines into the file soapLBS_SoapProxy.h right below the call soap = soap_new(); in the constructor:

    if (soap_ssl_client_context(soap,SOAP_SSL_NO_AUTHENTICATION,NULL,NULL,NULL,NULL,NULL))
    { 
        soap_print_fault(soap,stderr);
    }
    endpoint =  Prog->URL_SOAP.c_str();
    

    If you are unsure about where to place those lines, take a look into the existing file before replacing it.

    Note: If you change the directory structure, you may have to adjust the makefile and the environment variables in Eclipse and in your Windows Path variable.

  4. Build wxWidgets

    1. Download the wxMSW ZIP here: https://github.com/wxWidgets/wxWidgets/releases/download/v2.8.12/wxMSW-2.8.12.zip and unzip it.
    2. Open wxMSW-2.8.12\build\msw\makefile.gcc and make the following changes:
      1. Replace SHELL := $(COMSPEC) with SHELL := cmd
      2. Replace all occurrences of windres --use-temp-file -i$< -o$@ --define __WXMSW__ with windres --use-temp-file -i$< -o$@ $(RCFLAGS) --define __WXMSW__
    3. You can now build wxWidgets using the following command: mingw32-make.exe -j4 -f makefile.gcc UNICODE=0 SHARED=1 BUILD=debug CXXFLAGS+="-D__MINGW64__ -fpermissive -fno-keep-inline-dllexport -Wno-unused-local-typedefs" CPPFLAGS=-m32 LDFLAGS=-m32 RCFLAGS=-Fpe-i386

      Important: You may have to start this command a couple of times - just repeat it. The first few times you may get error messages, but it will start to compile after a few times.

    4. When the build finishes, move the file Setup.h from include\wx\univ to include\wx (one directory up).

    Note: Whichever compiler you chose to use - make sure you compile wxWidgets with the same one as you will compile the project. If you happen to change your mind after compiling wxWidgets, make sure to recompile it with the compiler.

  5. Get the other third-party software

    Download and unzip the following tools into the 3rdparty-directory:

    1. gSoap 2.8.16: http://sourceforge.net/projects/gsoap2/files/gSOAP/gsoap_2.8.16.zip/download

      1. After unzipping, copy the file gsoap-2.8\gsoap\stdsoap2.h into the <drive>\HKSB\HBS\SOAP-directory.

      2. Now run the following command from a shell in the <drive>\HBSK\HBS\SOAP directory:

        <drive>\HKSB\3rdparty\gsoap-2.8.16\gsoap\bin\win32\soapcpp2.exe -z2 -I<drive>\HKSB\3rdparty\gsoap-2.8.16\gsoap\import -x LBS_Soap.h</drive></drive>

        This should create new versions of most of the files already contained in the SOAP directory.

    2. OpenSSL 1.0.2d: https://www.openssl.org/source/

      After unzipping, you have to open HKSB\3rdparty\OpenSSL-Win32\include\openssl\x509v3.h and comment out lines 238 to 248 (they all start with #define CRL_...). They do conflict with wincrypt.h, that's why we have to get rid of them.

    3. Easylogging 8.9.1: https://github.com/easylogging/easyloggingpp

      In the unzipped directory you can will find a .h-file. In line 74 _ELPP_GCC_VERSION >= 40801, you have to replace the number 40801 with any bigger number (like 40802). Otherwise, when building the Client, the compiler would be forced to use C++11.

    4. zlib 1.2.8: http://sourceforge.net/projects/libpng/files/zlib/1.2.8/zlib-1.2.8.tar.gz/download?use_mirror=freefr&download=. After unzipping, remove the version from the directory name (so you get just zlib), otherwise you will have to change the path in the makefile.

  6. Set up the Eclipse Project

    1. Open the Eclipse IDE you downloaded in step 2. If you decided to use the CDT, install it first.
    2. Select New > C/C++ Project. In this window, enter a project name and remove the tick from the box Use default location. Then select the directory with the Client source code as the location, in our example that's <drive>\HKSB\HBS\LBS-Client.
    3. Select Makefile project > Empty Project in the left box and MinGW GCC as the Toolchain in the right box. Then click Finish.
    4. Add the following environment variables (approximately - make sure the paths fit to where you unzipped/installed the tools to) for the newly created project:
      • U_GSOAP: <drive>\hksb\3rdparty\gsoap-2.8.16\gsoap
      • U_MINGW: <drive>\CodeBlocks\MinGW (or whereever you decided to install the compiler - this is completly up to you as the makefile does not depend on it)
      • U_WX: <drive>\HKSB\3rdparty\wxMSW-2.8.12
  7. Build

    When using the TDM2 compiler (and maybe TDM-GCC), there is a discrepancy between the name of the make software provided and the one Eclipse expects. Therefore, you either have to change the expected name in Eclipse from make to mingw32-make, or create a copy of the file inside the the directory you installed the compiler into and rename it from mingw32-make to make.

    You can now build the project without any more actions.

  8. Run

    To run the resulting .exe, you have to:

    a) add the following directories to the Windows environment Path variable:

    1. <drive>\HKSB\3rdparty\wxMSW-2.8.12\lib\gcc_dll

    2. <drive>\HKSB\3rdparty\wxMSW-2.8.12

    3. <drive>\HKSB\3rdparty\OpenSSL-Win32\bin

      Also make sure that the path to the compiler you used to compile wxWidgets is still in the Windows environment Path.

    b) copy the files client.ini and LBS-Client.log.cfg from the Client source code directory (LBS-Client) into the containing exe directory (which is created when building the Client).

    You now can run the program. Please note that it may some time to launch from outside the IDE.

  9. Common errors

    a) Make sure to compile wxWidgets with the same compiler you are going to build the project.

    b) If, during the build, you get the error that some header-files can't be found, make sure that you:

    1. exactly followed the creation of the directory structure and unzipped the files accordingly.
    2. set the environment variables in the project properties in Eclipse right.
    3. use the right version of the third-party tools.

    c) If the .exe won't start, make sure that you added all neccessary paths to the Windows environment Path. There should be two for wxWidgets (see section 8), one for OpenSSL (see section 8) and one for your compiler (see section 1).

    d) Make sure you didn't forget to select the right toolchain when creating the Eclipse project.

Server

Important: In this section we assume that you built the Client already, as explained in the previous section Build Client on Windows with Eclipse and TDM2 4.8.1. All notes, e.g. about the compiler and the paths used, are also relevant in this section. If you, for some reason, only want to build the Server, you still have to set up everything explained in the sections 1-3, 5, 7 and 8 of the Client section.

  1. Get and setup additional third-party software

    Download and unzip the following tools into the 3rdparty-directory:

    1. inih: https://github.com/benhoyt/inih

      Please remove the -master ending of the unzipped directory.

    2. Tinyxml2: https://github.com/leethomason/tinyxml2

      Please remove the -master ending of the unzipped directory.

    3. PostgreSQL 9.2.14:

      1. Download the 32bit Windows installer: http://de.enterprisedb.com/products-services-training/pgdownload
      2. Install into <drive>\HKSB\3rdparty\pgsql (please remember the password you've set here. Other settings can be left at default values).
      3. Add the path to the bin directory of the freshly installed PostgreSQL to the Windows Path variable, i.e. <drive>\HKSB\3rdparty\pgsql\bin.
      4. Open a shell.

        1. Run psql.exe -U postgres to connect to the default database as the default superuser.
        2. Enter the password you've set during the installation.
        3. Run create user 'lbs-admin' password 'lbsadm;' (or choose your own credentials, but then remember to replace them whenever they occur in the course of this section). You should see the message CREATE ROLE.
        4. Run create database "HBS" owner = "lbs-admin" lc_ctype='C' lc_collate='C' encoding 'LATIN1' template template0; to create a new database. You should see the message CREATE DATABASE.
        5. Run \quit to disconnect from the default database.
        6. Run SET PGCLIENTENCODING=utf-8 to set the encoding used in PostgreSQL.
        7. Run chcp 65001 to change the code page.
        8. Run `psql -d HBS -U "lbs-admin" -f <drive>\HKSB</drive>
        9. \Database\HBS_DB.sql -L log.txt(as usual, replace<drive>` with the drive you use).</drive>
        10. Enter the password you set in step 3. You should see a list of CREATE VIEW and ALTER TABLE messages.

          %TODO%: Fix the create_db.cmd (or the conditions to make it work) to automatize these steps

      5. We now will have create an .a file out of the libpq.dll.

        1. Download expdef: http://purefractalsolutions.com/show.php?a=utils/expdef
        2. Place the expdef.exe into the same directory libpq.dll is (<drive>\HKSB\3rdparty\pgsql\bin).
        3. Open a shell in this directory and run "expdef.exe -p -o libpq.dll > libpq.def.
        4. Run dlltool -d libpq.def -l libpq.a (dlltool is a MinGW tool which you should already have after building the Client).
  2. Set up the Eclipse project

    1. Open the Eclipse IDE.
    2. Select New > C/C++ Project. In this window, enter a project name and remove the tick from the box Use default location. Then select the directory with the Client source code as the location, in our example that's <drive>\HKSB\HBS\LBS-Server.
    3. Select Makefile project > Empty Project in the left box and MinGW GCC as the Toolchain in the right box. Then click Finish.
    4. Add the following environment variables (approximately - make sure the paths fit to where you unzipped/installed the tools to) for the newly created project:
      • U_GSOAP: <drive>\hksb\3rdparty\gsoap-2.8.16\gsoap
      • U_MINGW: <drive>\CodeBlocks\MinGW (or whereever you decided to install the compiler - this is completly up to you as the makefile does not depend on it)
      • U_LOGGING: <drive>\HKSB\3rdparty\logging\easylogging
      • U_OPENSSL: <drive>\HKSB\3rdparty\OpenSSL-Win32
      • U_PG: <drive>\HKSB\3rdparty\pgsql
      • U_ZLIB: <drive>\HKSB\3rdparty\zlib

        %TODO%: Adapt the makefile to the one of the Client for the sake of consistency

  3. Build

    You can now build the project without any more actions.

  4. Run

    1. Copy the files LBS-Server.ini and LBS-Server.log.cfg from the Server source code directory (LBS-Server) into the containing exe directory (which is created when building the Server).
    2. Open LBS-Server.ini and set the following values:
      • PGhost: The hostname or IP of the machine you run the database on. 127.0.0.1 if it's your local machine.
      • PGport: 5432 if you left the default value during installation of PostgreSQL, otherwise whichever port you've set.
      • DBName: HBS
      • DBUser: lbs-admin
      • DBPassword: lbsadm

    You now can run the program. Please note that it has no GUI. If you want to make sure it runs, check the log which is created in the same directory.

  5. Common errors

    1. Please refer to the previous' section Common errors.
    2. Make sure you add semicolons at the end of PostgreSQL command in the shell. Otherwise you won't get confirmation messages and nothing will be done.

Interface

Important: In this section we assume that you built the Client already, as explained in the previous section Build Client on Windows with Eclipse and TDM2 4.8.1. All notes, e.g. about the compiler and the paths used, are also relevant in this section. If you, for some reason, only want to build the Server, you still have to set up everything explained in the sections 1-3, 5, 7 and 8 of the Client section.

  1. Set up the Eclipse project

    1. Open the Eclipse IDE.
    2. Select New > C/C++ Project. In this window, enter a project name and remove the tick from the box Use default location. Then select the directory with the Client source code as the location, in our example that's <drive>\HKSB\HBS\HBS-Interface.
    3. Select Makefile project > Empty Project in the left box and MinGW GCC as the Toolchain in the right box. Then click Finish.
    4. Add the following environment variables (approximately - make sure the paths fit to where you unzipped/installed the tools to) for the newly created project:
      • U_GSOAP: <drive>\hksb\3rdparty\gsoap-2.8.16\gsoap
      • U_MINGW: <drive>\CodeBlocks\MinGW (or whereever you decided to install the compiler - this is completly up to you as the makefile does not depend on it)
      • U_WX: <drive>\HKSB\3rdparty\wxMSW-2.8.12
      • U_OPENSSL: <drive>\HKSB\3rdparty\OpenSSL-Win32
      • U_ZLIB: <drive>\HKSB\3rdparty\zlib

        %TODO%: Adapt the makefile to the one of the Client for the sake of consistency

  2. Build

    You can now build the project without any more actions.

  3. Run

    %TODO%: No .ini file available at the moment.

    Contribution guidelines

  4. Writing tests

  5. Code review
  6. Other guidelines

Who do I talk to?

  • Repo owner or admin
  • Other community or team contact
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.