Author Topic: trying a first port  (Read 3543 times)

Erich Schulman

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 33
    • View Profile
trying a first port
« on: February 16, 2015, 06:48:34 am »
My primary language is Python, so I know I am at a disadvantage here. I picked something to start with I thought would be fairly easy: https://sourceforge.net/p/gnaw/wiki/Home/

I installed emx0.9d and gcc3, then compiled the included sieve.c and hello.cc.

I downloaded gnureadl and started to integrate it into the emx tree. I moved some files into emx\bin, emx\dll, and emx\lib, and the included readline.exe works.

There is no documentation stating which source files are needed to build readline itself and which are needed to compile something that uses readline. From the examples directory I am guessing I need history.h, posixstat.h, and readline.h in emx\include. There may be more to do. In the examples directory I see both
Code: [Select]
#include "readline.h" and
Code: [Select]
#include <readline/readline.h> . So do I put header files in emx\include or emx\include\readline?

The examples directory has a Makefile.in. Nice, but I don't have configure or bash to work with. It seems the .c's do not depend on each other in any way, so I think I can do single gcc commands and not need to use make. If I can get working .exe's from these, I think I will be ready to try my real project.

Dave Yeo

  • Hero Member
  • *****
  • Thank You
  • -Given: 11
  • -Receive: 149
  • Posts: 2156
    • View Profile
Re: trying a first port
« Reply #1 on: February 16, 2015, 07:50:47 am »
EMX is old and superseded by klibc, http://trac.netlabs.org/libc/wiki, more on that below.
We don't really have a good bash port, I've found the best shell to be pdksh, available on hobbes. Generally configure scripts will run with just setting exeext and even libtool can produce working dlls with minimal patching (does everything right then symlinks the import lib to the dll due to long and short names not matching, OS/2 has a 8.3 limit on dlls)
Currently most people are using yum/rpm to install a build environment as well as other software. Most software is close to up to date, eg GCC 4.9.2, Python 2.7.6. See http://trac.netlabs.org/rpm/wiki

Mentore

  • Jr. Member
  • **
  • Thank You
  • -Given: 15
  • -Receive: 1
  • Posts: 62
    • View Profile
Re: trying a first port
« Reply #2 on: February 16, 2015, 09:40:30 am »
EMX is old and superseded by klibc, http://trac.netlabs.org/libc/wiki, more on that below.
We don't really have a good bash port, I've found the best shell to be pdksh, available on hobbes. Generally configure scripts will run with just setting exeext and even libtool can produce working dlls with minimal patching (does everything right then symlinks the import lib to the dll due to long and short names not matching, OS/2 has a 8.3 limit on dlls)
Currently most people are using yum/rpm to install a build environment as well as other software. Most software is close to up to date, eg GCC 4.9.2, Python 2.7.6. See http://trac.netlabs.org/rpm/wiki

Hello Dave, could you please explain better "setting exeext"? I didn't know about that.

(Actually I'm not getting more than command line programs. Seems my SDL and Qt configuration is broken, so that Cmake and configure scripts cannot continue. Will solve it asap.)

Erich Schulman

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 33
    • View Profile
Re: trying a first port
« Reply #3 on: February 16, 2015, 02:28:39 pm »
I got ftp://ftp.netlabs.org/pub/gcc/GCC-3.3.5-csd6.zip and it looks like I can unzip it onto my \emx tree, but nothing says this is (not) the right thing to do. Does it need any environment variables or any other setup beyond what emx 0.9 did?

Dave Yeo

  • Hero Member
  • *****
  • Thank You
  • -Given: 11
  • -Receive: 149
  • Posts: 2156
    • View Profile
Re: trying a first port
« Reply #4 on: February 16, 2015, 04:46:31 pm »
Easiest is to have a config.site file. The config.site file will be automatically found if at $PREFIX/share/config.site or found by set CONFIG_SITE.
Also note that different shells work different and with the RPM/YUM environment and ash as the shell you're better off recreating the auto files.
Code: [Select]
export ac_executable_extensions=.exe
export ac_exeext=.exe
You can add other needed stuff if configure has a problem finding it
Code: [Select]
export INSTALL=f:/usr/bin/install.exe
export lt_cv_path_SED=sed.exe
export lt_ac_sed=sed.exe

Silvan Scherrer

  • Full Member
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 9
  • Posts: 169
    • View Profile
Re: trying a first port
« Reply #5 on: February 16, 2015, 07:48:39 pm »
Easiest is to have a config.site file. The config.site file will be automatically found if at $PREFIX/share/config.site or found by set CONFIG_SITE.
Also note that different shells work different and with the RPM/YUM environment and ash as the shell you're better off recreating the auto files.
Code: [Select]
export ac_executable_extensions=.exe
export ac_exeext=.exe
You can add other needed stuff if configure has a problem finding it
Code: [Select]
export INSTALL=f:/usr/bin/install.exe
export lt_cv_path_SED=sed.exe
export lt_ac_sed=sed.exe
with all latest rpm/yum dev packages like autoconf, libtool, automake ... you can bootstrap everything nicely. No need to fiddle with a config.site file.
kind regards
Silvan
CTO bww bitwise works GmbH

Please help us with donations, so we can further work on OS/2 based projects. Our Shop is at https://www.bitwiseworks.com/shop/index.php

Erich Schulman

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 33
    • View Profile
Re: trying a first port
« Reply #6 on: February 17, 2015, 06:08:22 am »
Currently most people are using yum/rpm to install a build environment as well as other software. Most software is close to up to date, eg GCC 4.9.2, Python 2.7.6. See http://trac.netlabs.org/rpm/wiki

I downloaded ftp://ftp.netlabs.org/pub/gcc/GCC-3.3.5-csd6.zip but did not find documentation on configuration (environment variables, etc.). Would this conflict with emx or can it actually replace emx?

Dave Yeo

  • Hero Member
  • *****
  • Thank You
  • -Given: 11
  • -Receive: 149
  • Posts: 2156
    • View Profile
Re: trying a first port
« Reply #7 on: February 17, 2015, 07:05:09 am »
On Warp v4 I had both installed with EMX set up in config.sys and installed in \emx and klibc installed in \usr.
Opening a cmd prompt and running \usr\bin\gccenv.cmd will set everything up for klibc and gcc 3.3.5.  IIRC with the right parameters it'll set things up for other locations as well.
I then put other stuff in \usr\local and had a simple batch file, localenv.cmd to set that up. Parts are particular to my environment.
Code: [Select]
echo off
SET PATH=foo;g:\mzfntcfgft\bin;g:\usr\local\bin;%PATH%
set BEGINLIBPATH=g:\usr\local\lib;%BEGINLIBPATH%
SET C_INCLUDE_PATH=g:/mzfntcfgft/include;g:/usr/local/include;%C_INCLUDE_PATH%
SET CPLUS_INCLUDE_PATH=g:/mzfntcfgft/include;g:/usr/local/include;%CPLUS_INCLUDE_PATH%
SET LIBRARY_PATH=g:/mzfntcfgft/lib;g:/usr/local/lib;%LIBRARY_PATH%
SET PKG_CONFIG_PATH=g:/mzfntcfgft/lib/pkgconfig;g:/usr/local/lib/pkgconfig;%PKG_CONFIG_PATH%
SET MANPATH=g:/usr/local/share/man;g:/usr/local/man;%MANPATH%
set PATH=g:\perl5\bin;%PATH%
set BEGINLIBPATH=g:\perl5\bin;%BEGINLIBPATH%
set PERLDIR=g:\perl5
set PERL_LIBPATH=g:/perl5/lib;g:/git/
set PERLLIB_PREFIX=u:/perl5/lib;g:/perl5/lib
set PERL_SH_DIR=/bin
set USE_PERL_FLOCK=0
set MAKESHELL=f:/bin/sh.exe
set CONFIG_SITE=g:/usr/local/share/config.site

Now I set up various things much the same way.
You can get rid of EMX if you want though keep the dlls as much depends on them. The documentation also kind of applies as klibc is sorta a rewrite of EMX and uses many of the same tools, functions and flags
You also should install a better linker, ld works but is so old that it is GPL v1 and original author is RMS. You can use link386 that was an optional install item on your Warp V4 CD or download wl (patched OpenWatcom Wlink) from the same place you found GCC 3.3.5, run emxomfld.exe without parameters to find the environment variables to set it up. Use LDFLAGS=-Zomf to use. OMF is the native object format, GCC compiles to aout and then it can be converted during the build and/or linking phase.
Also check out http://os2ports.smedley.info/
« Last Edit: February 17, 2015, 07:08:01 am by Dave Yeo »

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 398
  • -Receive: 79
  • Posts: 2385
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: trying a first port
« Reply #8 on: February 23, 2015, 02:22:50 pm »
Hi Erich.

I really hope you are doing fine with your first port.

If you want to share something about your results, the binaries, or if you want to post an article about your fist steps on EDM/2 wiki, please let me know.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.