Hi Vojta,

> There is some magic involved when guessing the proper value that may not
> work under all circumstances. If you use absolute path when calling hsct.sh
> init ..., does the problem persist?
>
Using the absolute path the initalization works fine.

By the way, if you set HSCT_HOME to $PWD, it seems to me that you are
> building in the source tree of coastline. That may work (I probably never
> even tested that) but it is better to build in a different directory. That
> way, you can build more architectures in parallel etc.
>
Yes,  I'm building in the source tree. I started doing it in a separate
directory but I turned to the same directory when I had the first
issues with the script. I will separate directories again.

>
>
>> I made an attempt to write a HARBOUR for libpng, this is what the build
>> function looks like
>>
>> shipname=libpng
>> shipversion=1.6.10
>> shipsources="
>> ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng16/${shipname}-${shipversion}.tar.gz
>> "
>>
>> build() {
>>      run tar xzf "${shipname}-${shipversion}.tar.gz"
>>      cd "${shipname}-${shipversion}"
>>      run env \
>>          CC="$HSCT_CC" \
>>          CFLAGS="$HSCT_CFLAGS $HSCT_LDFLAGS_FOR_CC" \
>>          LD="$HSCT_LD" \
>>          LDFLAGS="-L/home/esteban/helenos/coastline/dist/zlib/lib"\
>>          ./configure
>>
>>      run make
>> }
>>
>
>> The configuration process ends correctly but the testing executable
>> 'testpng' isn't built for HelenOS but for my system.
>> I'm not quite sure why is this happening.
>>
> I tried this script on my system and the ./configure failed. I guess
> missing --host switch [1] is the culprit as I was compiling on x86_64 for
> ia32. This might also explain why it does not work on your system.
>
> Also, sometimes, it is necessary to forcefully tell the ./configure script
> that it is cross compiling [2].
>
> libpng probably requires working math functions so you might need to
> compile fdlibm as well. Also, there were some changes to libmath in HelenOS
> recently and I have not checked yet whether that affects some existing
> harbours.
>
> By the way, if you use $HSCT_LIB_DIR in LDFLAGS, the script would be more
> portable. See [3] and [4] for examples. (Of course, you first need to
> "install" the files there by calling hsct.sh package zlib).
>
I applied all those changes, this is how the build function looks now:

build() {
     run tar xzf "${shipname}-${shipversion}.tar.gz"
     cd "${shipname}-${shipversion}"
      #fixing cross-compilation guesses..."
     self_target=`../${shipname}-${shipversion}/config.guess`
     if [ "$self_target" = "$HSCT_GNU_TARGET" ]; then
     # Only works for building ia32 on i686
         self_target=`echo "$self_target" | sed 's/686/386/'`
     fi
     find -name configure | while read fname; do
         run sed 's/^cross_compiling=no/cross_compiling=yes/' -i "$fname"
     done


     ldflags_math="-Wl,--whole-archive -Wl,-L$HSCT_LIB_DIR -Wl,-lfdm,
-Wl,--no-whole-archive"


    run ./configure \
        --build="$self_target"\
        --host="$HSCT_GNU_TARGET" \
        --target="$HSCT_GNU_TARGET"\
        CC="$HSCT_CC" \
        CFLAGS="$HSCT_CFLAGS" \
        LD="$HSCT_LD" \
        LDFLAGS="$HSCT_LDFLAGS $ldflags_math"\

     run make
 }

 fdlibm as well as zlib are built and packaged before doing the build of
libpng. The configuration phase ends with error after preforming the
following checking:

configure:12509: checking for memset
configure:12509: /usr/local/cross/ia32/bin/i686-pc-linux-gnu-gcc -o
conftest  -O3 -imacros
/home/esteban/helenos/coastline/helenos/include/system_config.h
-fexec-charset=UTF-8 -fwide-exec-charset=UTF-32LE -finput-charset=UTF-8
-ffreestanding -fno-builtin -nostdlib -nostdinc -Wall -Wextra
-Wno-clobbered -Wno-unused-parameter -Wmissing-prototypes -std=gnu99
-Wwrite-strings -pipe -ggdb -D__LE__ -march=pentium -fno-omit-frame-pointer
-I/home/esteban/helenos/coastline/helenos/include/posix
-I/home/esteban/helenos/coastline/helenos/include/   conftest.c  >&5
/usr/local/cross/ia32/lib/gcc/i686-pc-linux-gnu/4.8.1/../../../../i686-pc-linux-gnu/bin/ld:
warning: cannot find entry symbol _start; defaulting to 080480a0
/tmp/ccd5m53O.o: In function `main':
/home/esteban/helenos/coastline/build/libpng/libpng-1.6.10/conftest.c:57:
undefined reference to `memset'
collect2: error: ld returned 1 exit status
configure:12509: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "libpng"
| #define PACKAGE_TARNAME "libpng"
| #define PACKAGE_VERSION "1.6.10"
| #define PACKAGE_STRING "libpng 1.6.10"
| #define PACKAGE_BUGREPORT "[email protected]"
| #define PACKAGE_URL ""
| #define PACKAGE "libpng"
| #define VERSION "1.6.10"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define LT_OBJDIR ".libs/"
| #define STDC_HEADERS 1
| #define restrict __restrict
| /* end confdefs.h.  */
| /* Define memset to an innocuous variant, in case <limits.h> declares
memset.
|    For example, HP-UX 11i <limits.h> declares gettimeofday.  */
| #define memset innocuous_memset
|
| /* System header to define __stub macros and hopefully few prototypes,
|     which can conflict with char memset (); below.
|     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|     <limits.h> exists even on freestanding compilers.  */
|
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
|
| #undef memset
|
| /* Override any GCC internal prototype to avoid an error.
|    Use char because int might match the return type of a GCC
|    builtin and then its argument prototype would still apply.  */
| #ifdef __cplusplus
| extern "C"
| #endif
| char memset ();
| /* The GNU C library defines this for functions which it implements
|     to always fail with ENOSYS.  Some functions are actually named
|     something starting with __ and the normal name is an alias.  */
| #if defined __stub_memset || defined __stub___memset
| choke me
| #endif
|
| int
| main ()
| {
| return memset ();
|   ;
|   return 0;
| }
configure:12509: result: no
configure:12516: error: memset not found in libc

Here is not including any library from the same package like the case for
example of libgmp in which you solved it by
patching it, I'm not quite I understand what is trying to do here, I mean
it seems to look for memset in libc but the prototype that declares
is intentionally different.



 Anyway, I think you are making a good progress. I am glad you were able to
> fix the problems with hsct.sh yourself and I believe that you are only few
> details away from porting libpng :-).
>

Thanks! I hope so!

Cheers,
Esteban

>
> Cheers,
> - Vojta
>
>
> [1] https://github.com/vhotspur/coastline/blob/master/libgmp/HARBOUR#L42
> [2] https://github.com/vhotspur/coastline/blob/master/gcc/HARBOUR#L90
> [3] https://github.com/vhotspur/coastline/blob/master/libmpfr/HARBOUR#L48
> [4] https://github.com/vhotspur/coastline/blob/master/zlib/HARBOUR#L57
> [5] http://helenos.alisma.cz/coastline/matrix/
> [6]
> http://trac.helenos.org/browser/mainline/uspace/dist/src/c/demos/hello/build.gcc
>
>
> _______________________________________________
> HelenOS-devel mailing list
> [email protected]
> http://lists.modry.cz/listinfo/helenos-devel
>
>
_______________________________________________
HelenOS-devel mailing list
[email protected]
http://lists.modry.cz/listinfo/helenos-devel

Reply via email to