Re: Compiling execline shared fails without --with-lib configure opt

2019-12-02 Thread J. Lewis Muir
On 12/03, Laurent Bercot wrote:
> > Since I'm not using static libraries, I would not expect to need the
> > "--with-lib" configure option.
> 
>  The --disable-static flag only tells the build system not to
> build the static execline library. By default, executables are still
> built against the static version of skalibs.
> 
>  If you want to link executables against the dynamic version of skalibs,
> you need to add the --disable-allstatic option to configure.
> 
>  IOW: to make a dynamic install, you need both --disable-static
> and --disable-allstatic.

OK, got it; that worked.  It compiled successfully, and so did s6, both
without any compile warnings!  Nice!

Lewis


Re: Compiling execline shared fails without --with-lib configure opt

2019-12-02 Thread Laurent Bercot

Since I'm not using static libraries, I would not expect to need the
"--with-lib" configure option.


 The --disable-static flag only tells the build system not to
build the static execline library. By default, executables are still
built against the static version of skalibs.

 If you want to link executables against the dynamic version of skalibs,
you need to add the --disable-allstatic option to configure.

 IOW: to make a dynamic install, you need both --disable-static
and --disable-allstatic.

--
 Laurent



Compiling execline shared fails without --with-lib configure opt

2019-12-02 Thread J. Lewis Muir
Hello!

On x86_64 RHEL 7.7 with GCC 4.8.5, configuring and compiling execline
2.5.3.0 against skalibs 2.9.1.0 (which has been compiled with the
"--disable-static" configure option) with


$ ./configure --prefix=/opt/local/encap/execline-2.5.3.0 --enable-shared 
--disable-static --with-sysdeps=/opt/local/lib/skalibs/sysdeps 
--with-include=/opt/local/include --with-dynlib=/opt/local/lib
$ make


fails as follows:


exec gcc -o background -pipe -Wall -std=c99 -fno-exceptions -fno-unwind-tables 
-fno-asynchronous-unwind-tables -Wa,--noexecstack -ffunction-sections 
-fdata-sections -O2 -fomit-frame-pointer -fno-stack-protector  
-Wl,--sort-section=alignment -Wl,--sort-common -Wl,--hash-style=both  
-Wl,--gc-sections src/execline/background.o libexecline.a.xyzzy -lskarnet
/usr/bin/ld: cannot find -lskarnet
collect2: error: ld returned 1 exit status
make: *** [background] Error 1


If I add the "--with-lib=/opt/local/lib" configure option, it succeeds.

This is unexpected because the "./configure --help" output says:


Dependencies:
  --with-sysdeps=DIRuse sysdeps in DIR [PREFIX/lib/skalibs/sysdeps]
  --with-include=DIRadd DIR to the list of searched directories for 
headers
  --with-lib=DIRadd DIR to the list of searched directories for 
static libraries
  --with-dynlib=DIR add DIR to the list of searched directories for 
shared libraries


Since I'm not using static libraries, I would not expect to need the
"--with-lib" configure option.

Thank you,

Lewis


Re: Two skalibs compiler warnings on RHEL 7

2019-12-02 Thread J. Lewis Muir
On 12/02, Laurent Bercot wrote:
> > src/libunixonacid/textclient_server_init_fromsocket.c:56:3: warning: 
> > dereferencing type-punned pointer will break strict-aliasing rules 
> > [-Wstrict-aliasing]
> >*(int *)CMSG_DATA(c) = fd[1] ;
> >^
> 
>  Yeah, some compilers actually print that warning.
>  It's annoying, because this is the official way, and really the only way,
> of using CMSG_DATA(). It breaks strict aliasing, but it's okay, because
> in the case of SCM_RIGHTS transmission, nothing ever uses CMSG_DATA(c) as
> an array of unsigned char; it's always written and read as an array of
> ints, and holds file descriptors.
>  Honestly, the spec of CMSG_DATA() is to blame: it should be void *, or
> at the very least, char *. Making it unsigned char * was really
> short-sighted, and the root cause for the strict aliasing violation.
> 
>  I don't want to "fix" this in my code, because the code as it is written
> is as clear as can be. A "fix" would imply a double cast through void *,
> which would decrease readability - not a good trade for two spurious
> compiler warnings.

OK, sounds good!  Thanks!

Lewis


Re: Two skalibs compiler warnings on RHEL 7

2019-12-02 Thread Laurent Bercot

src/libunixonacid/textclient_server_init_fromsocket.c:56:3: warning: 
dereferencing type-punned pointer will break strict-aliasing rules 
[-Wstrict-aliasing]
   *(int *)CMSG_DATA(c) = fd[1] ;
   ^


 Yeah, some compilers actually print that warning.
 It's annoying, because this is the official way, and really the only 
way,

of using CMSG_DATA(). It breaks strict aliasing, but it's okay, because
in the case of SCM_RIGHTS transmission, nothing ever uses CMSG_DATA(c) 
as

an array of unsigned char; it's always written and read as an array of
ints, and holds file descriptors.
 Honestly, the spec of CMSG_DATA() is to blame: it should be void *, or
at the very least, char *. Making it unsigned char * was really
short-sighted, and the root cause for the strict aliasing violation.

 I don't want to "fix" this in my code, because the code as it is 
written

is as clear as can be. A "fix" would imply a double cast through void *,
which would decrease readability - not a good trade for two spurious
compiler warnings.

--
 Laurent



Two skalibs compiler warnings on RHEL 7

2019-12-02 Thread J. Lewis Muir
Hello!

On x86_64 RHEL 7.7 with GCC 4.8.5, configuring and compiling skalibs
2.9.1.0 with


$ ./configure --disable-static
$ make


results in a clean compile except for the following two warnings:


exec gcc -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -Isrc/include -fPIC 
-Werror=implicit-function-declaration -Werror=implicit-int -Werror=pointer-sign 
-Werror=pointer-arith -Wno-unused-value -Wno-parentheses  -pipe -Wall -std=c99 
-fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables 
-Wa,--noexecstack -ffunction-sections -fdata-sections -O2 -fomit-frame-pointer 
-fno-stack-protector   -c -o 
src/libunixonacid/textclient_server_init_fromsocket.lo 
src/libunixonacid/textclient_server_init_fromsocket.c
src/libunixonacid/textclient_server_init_fromsocket.c: In function ‘sendit’:
src/libunixonacid/textclient_server_init_fromsocket.c:56:3: warning: 
dereferencing type-punned pointer will break strict-aliasing rules 
[-Wstrict-aliasing]
   *(int *)CMSG_DATA(c) = fd[1] ;
   ^
exec gcc -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -Isrc/include -fPIC 
-Werror=implicit-function-declaration -Werror=implicit-int -Werror=pointer-sign 
-Werror=pointer-arith -Wno-unused-value -Wno-parentheses  -pipe -Wall -std=c99 
-fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables 
-Wa,--noexecstack -ffunction-sections -fdata-sections -O2 -fomit-frame-pointer 
-fno-stack-protector   -c -o src/libunixonacid/textclient_start.lo 
src/libunixonacid/textclient_start.c
src/libunixonacid/textclient_start.c: In function ‘get’:
src/libunixonacid/textclient_start.c:77:3: warning: dereferencing type-punned 
pointer will break strict-aliasing rules [-Wstrict-aliasing]
   fd[1] = *(int *)CMSG_DATA(c) ;
   ^


On RHEL 7, according to the cmsg(3) man page, CMSG_DATA has a return
type of "unsigned char *".

Thank you,

Lewis