Re: [gccsdk] Building libssh2 fails while building nettle with the autobuilder. Any clues?

2015-09-08 Thread Lee Noar

On 07/09/15 06:03, Alan Williams wrote:

Lee,
I have successfully built Nettle.  I had to make a number of tweaks to
various components to get that to all work.

For libgpg-error0:
Add : cp src/syscfg/lock-obj-pub.arm-unknown-linux-gnueabihf.h
src/syscfg/lock-obj-pub.riscos.h
To:  autobuilder/libraries/libgpg-error0/setvars

For ssh2:
Add: export LIBS='-ldl'
To: libraries/libssh2/setvars

Google says libgcryp11 has gone from Jessie so I built libgcryp20 instead.
cp -a ../autobuilder/libraries/libgcrypt11/
../autobuilder/libraries/libgcrypt20


# Edited
Sunfish#192.168.9.119::/home/alan.$.autobuilder.network.nettle.depends
made it libcrypt20 as shown below.
libssh2
libgcrypt20
libgpg-error0
zlib1g

# Nettle

Sunfish#192.168.9.119::/home/alan.$.build.nettle.nettle.GNUmakefile
Added -ldl to LIBS making it as follows:

LIBS = -lssh2 -lz -lgcrypt -lgpg-error -lcrypto -ldl


Thanks for those, I'll commit them soon.


I have started to look at the proposition of getting nettle to do
Public/private key auth and it looks ok.  My intention is to co-opt the
current 'Command' field/icon to hold two space separated file names for the
key files initially.  If that works I may extent the UI to better
accommodate the extra fields.

I do have one more question if I may.

The second thing I am interested in doing is to take Alex Waghs !SunFish nfs
client and replace the nfs specific components with sftp.  Essentially
making sshfs for RISC OS.  To do this I am going to need the module build of
libssh2.  I had a look at what autobuilder has made by default and that is
just the normal application version.  My question therefore is how do I get
the auto builder to make me the module linkable version as well?


Unfortunately, unless someone has already added the necessary changes,
there is no easy way of making a module version.
You can compile it as module code by adding -mmodule to CFLAGS/CXXFLAGS,
but you still need to add a module header and SWI interface.

Also, don't forget that its dependencies would also need a module
build.

Ideally, you would want to preserve the current build and create a
separate build for a module. With an autotools based build (such as 
libssh2), you can do this in setvars by creating two build

directories, say, 'build-normal' and 'build-module'. From each directory
call configure to create the makefiles, etc. At some point for
'build-module', you specify CFLAGS/CXXFLAGS as -mmodule (possibly when
calling configure, not sure if configure will work with -mmodule). You
may also have to suppress -fPIC because it's not compatible with
-mmodule.


Lee.


___
GCCSDK mailing list gcc@gccsdk.riscos.info
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK


[gccsdk] GCC 4.7.4 difficulties

2015-09-08 Thread Gavin Wraith
I am trying to compile Lua 5.31 with GCC 4.7.4. In the help
docs of GCC it says that both Unix and RISC OS filenaming can be
used. I rejoiced at this, as the shuffling about with
extenders is a bore. I added
MYCFLAGS= -mfpu=vfp
MYLDFLAGS= -mfpu=vfp
to the Makefile provided, set the current directory and
gave the command "make" at the *-prompt in a taskwindow.
The reply was
> gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -mfpu=vfp-c -o lapi.o 
> lapi.c
> cc1: fatal error: lapi.c: No such file or directory
> compilation terminated.
> make: *** [lapi.o] Error 1

Not so out of the box, then? So I did the old rigmarole of creating directories
c, o and a and renamed files appropriately. I made tools for this job years
ago. Now, giving the make command got considerably further. The o directory
filled up with object files nicely. But things started to fail when it came to 
the
command to collect them up into a library. The command
$(AR) $@ $(BASE_O)
produced a file liblua/a instead of a.liblua. Then the next step

ranlib liblua.a

produced
> gcc -std=gnu99 -o lua   lua.o liblua.a -lm
> gcc: error: liblua/a: No such file or directory
> make: *** [lua] Error 1

So, have I done something wrong, by omission or commission, or was the claim
about filenaming in the help docs premature? Should I have set some system
variables to tell GCC what filenaming system to use?

Sorry if I have not read the docs carefully enough, but I am just dipping my toe
in at this stage. All help and suggestions gratefully received.
--
Gavin Wraith (ga...@wra1th.plus.com)
Home page: http://www.wra1th.plus.com/

___
GCCSDK mailing list gcc@gccsdk.riscos.info
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK


Re: [gccsdk] Unable to get the pipe function to work

2015-09-08 Thread Ralph Corderoy
Hi Lee,

> I have yet to find any documentation on the web that defines the order
> of return.

The order of return after fork(2) is defined as being not determinable,
i.e. correct code has to cope with either order or even simultaneous
return since another CPU might be brought it to run one of them.

With Linux 2.2 and 2.4 the parent returned first, with 2.6 it's the
child up until 2.6.32 when it switched once again.  Other Unix operating
systems may not even be consistent within a version.

vfork(2)'s raison d'être meant the parent didn't run until the child was
finished or overwritten with execve(2).  Nowadays, that's not true and
can't be assumed.

Cheers, Ralph.

___
GCCSDK mailing list gcc@gccsdk.riscos.info
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK

Re: [gccsdk] Unable to get the pipe function to work

2015-09-08 Thread Lee Noar

On 07/07/15 12:46, alan buckley wrote:

The port I’m currently looking at uses pipe() and fork() to run a command
and communicates between the main program and an external program.
The main program itself fails with an invalid handle error from RISC OS, so
I thought I’d just check the pipe command and it doesn’t appear to be
working.
I’ve used the example from:
http://www.gnu.org/software/libc/manual/html_node/Creating-a-Pipe.html
and it gave no output instead of the text expected (and seen when I tried
the code on Ubuntu).
Should this be working on RISC OS?
If so is there something extra I should be doing?
If not, are there any suggestions on what to do instead?


Hi Alan, sorry it's taken me so long to get back to you on this.

I do believe that this is a problem in UnixLib.
The problem isn't with pipes, but with fork(). fork is somewhat
complicated because it is required to return twice, once for the
parent and once for the child. In your example, the order in
which the parent and child return is important; the parent should
return first so that the pipe is written to and then the child
returns and reads what the parent wrote.
In UnixLib, the child returns first and attempts to read from the
pipe before the parent has written anything, hence, the lack of
output.

I have yet to find any documentation on the web that defines the
order of return.

Looking at the cross compiler, I notice that it use vfork rather
than fork and it returns the child first, whereas your example
using fork (running in Linux) returns the parent first.

I naively attempted to fix it by swapping the return values in
(v)fork. This did in fact make your example work, but GCC was not
happy when I tested it, so I guess it's not as simple as that.

Maybe the process returned first is dependant on whether you're
using fork or vfork, but this is just guess work. I could do
with finding some documentation to verify my suspicions before
I make any changes.

Lee.


___
GCCSDK mailing list gcc@gccsdk.riscos.info
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK


Re: [gccsdk] Building libssh2 fails while building nettle with the autobuilder. Any clues?

2015-09-08 Thread Alan Williams


-Original Message-
From: Lee Noar [mailto:leen...@sky.com] 
Sent: Wednesday, 9 September 2015 6:19 AM
To: Alan Williams ; gcc@gccsdk.riscos.info
Subject: Re: [gccsdk] Building libssh2 fails while building nettle with the
autobuilder. Any clues?

On 07/09/15 06:03, Alan Williams wrote:
> Lee,
> I have successfully built Nettle.  I had to make a number of tweaks to 
> various components to get that to all work.
>
> For libgpg-error0:
> Add : cp src/syscfg/lock-obj-pub.arm-unknown-linux-gnueabihf.h
> src/syscfg/lock-obj-pub.riscos.h
> To:  autobuilder/libraries/libgpg-error0/setvars
>
> For ssh2:
> Add: export LIBS='-ldl'
> To: libraries/libssh2/setvars
>
> Google says libgcryp11 has gone from Jessie so I built libgcryp20 instead.
> cp -a ../autobuilder/libraries/libgcrypt11/
> ../autobuilder/libraries/libgcrypt20
>
>
> # Edited
> Sunfish#192.168.9.119::/home/alan.$.autobuilder.network.nettle.depends
> made it libcrypt20 as shown below.
> libssh2
> libgcrypt20
> libgpg-error0
> zlib1g
>
> # Nettle
>
> Sunfish#192.168.9.119::/home/alan.$.build.nettle.nettle.GNUmakefile
> Added -ldl to LIBS making it as follows:
>
> LIBS = -lssh2 -lz -lgcrypt -lgpg-error -lcrypto -ldl

Thanks for those, I'll commit them soon.

> I have started to look at the proposition of getting nettle to do 
> Public/private key auth and it looks ok.  My intention is to co-opt 
> the current 'Command' field/icon to hold two space separated file 
> names for the key files initially.  If that works I may extent the UI 
> to better accommodate the extra fields.
>
> I do have one more question if I may.
>
> The second thing I am interested in doing is to take Alex Waghs 
> !SunFish nfs client and replace the nfs specific components with sftp.  
> Essentially making sshfs for RISC OS.  To do this I am going to need 
> the module build of libssh2.  I had a look at what autobuilder has 
> made by default and that is just the normal application version.  My 
> question therefore is how do I get the auto builder to make me the module
linkable version as well?

Unfortunately, unless someone has already added the necessary changes, there
is no easy way of making a module version.
You can compile it as module code by adding -mmodule to CFLAGS/CXXFLAGS, but
you still need to add a module header and SWI interface.

Also, don't forget that its dependencies would also need a module build.

Ideally, you would want to preserve the current build and create a separate
build for a module. With an autotools based build (such as libssh2), you can
do this in setvars by creating two build directories, say, 'build-normal'
and 'build-module'. From each directory call configure to create the
makefiles, etc. At some point for 'build-module', you specify
CFLAGS/CXXFLAGS as -mmodule (possibly when calling configure, not sure if
configure will work with -mmodule). You may also have to suppress -fPIC
because it's not compatible with -mmodule.


Lee.

Ah, thank you for that. I will have a go.  My aim with libssh2 and its
dependencies is not to produces a RM but just to have it linkable into a RM.
Like the *zm files in say TCPLibs.o from Norcroft.   In this case  I want to
link it with Alex Wagh's SunFish filesystem code with the nfs parts replaced
with sshfs.

The Nettle update is preceding nicely.  I am still in half a mind as to
whether I should introduce two new writable icons into the GUI or just
continue co-opting the 'command'  field.  It strikes me as the command field
could actually be useful in SSH for its intended purpose though I don't
think it currently works.

At the moment I have shared key login working if you don't have a passphrase
on the key.  I was stumped last night as keygen would not let me put a
passphrase on my key because HostFS on virtual acorn reports all files as
public RW.I would rather not prompt for the passphrase if it's not
necessary for the key, but I am not sure yet how to tell that in advance.
There looks to be some call back system which can be used but that might
complicate things too much.  Anyway I will put a pass phrase on my key and
see what happens in the next few days.

I am also thinking of giving it an option to automatically place selections
on the clipboard as Putty does on windows.

Alan











___
GCCSDK mailing list gcc@gccsdk.riscos.info
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK


Re: [gccsdk] GCC 4.7.4 difficulties

2015-09-08 Thread Gavin Wraith
In message <6daeedff54.ga...@wra1th.plus.com>
  Gavin Wraith  wrote:


>ranlib liblua.a
>
>produced
>> gcc -std=gnu99 -o lua   lua.o liblua.a -lm
>> gcc: error: liblua/a: No such file or directory
>> make: *** [lua] Error 1
>
>So, have I done something wrong, by omission or commission, or was the claim
>about filenaming in the help docs premature?

Just seen in the help docs:
 Note we don't do suffix swapping for 'a' extensions.

That explains it. Sorry for the noise. Compilation now OK. I now need to
understand filepath conventions for shared libraries. Can I set things
up so that my application looks for its shared libraries in
MyApp:lib.so..
? Can I just compile the shared library as an ELF file and copy it there, or 
does the
SOManager have to be brought into the picture? The libraries are not
in fact going to be shared at all - it is the runtime linking aspect,
not the sharing, that will be relevant.

--
Gavin Wraith (ga...@wra1th.plus.com)
Home page: http://www.wra1th.plus.com/

___
GCCSDK mailing list gcc@gccsdk.riscos.info
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK