Re: [tcpdump-workers] build failures on Solaris

2021-08-08 Thread Guy Harris via tcpdump-workers
--- Begin Message ---
On Jul 31, 2021, at 3:37 AM, Denis Ovsienko via tcpdump-workers 
 wrote:

> # Solaris 11 with GCC #
> This is the opposite: the pre-compile libpcap feature test programs
> fail to link so all libpcap feature tests fail. However, libpcap is
> detected as available and the build process resorts to missing/ and
> produces a binary of tcpdump that is mostly functional:
> 
> $ /tmp/tcpdump_build_matrix.XX06MD.a/bin/tcpdump -D
> /tmp/tcpdump_build_matrix.XX06MD.a/bin/tcpdump: illegal option -- D
> 
> The problem seems to be that the feature test linking instead of using
> the flags returned by pcap-config points exactly to the 32-bit version
> of libpcap and fails:

I've checked in changes to:

check the bit-width of the build in autotools;

on Solaris, use the results of the bit-width checks for autotools and 
CMake to figure out which version of pcap-config to run.

See if that clears up the Solaris 11 with GCC build.
--- End Message ---
___
tcpdump-workers mailing list
tcpdump-workers@lists.tcpdump.org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers

Re: [tcpdump-workers] build failures on Solaris

2021-08-08 Thread Denis Ovsienko via tcpdump-workers
--- Begin Message ---
On Sun, 8 Aug 2021 01:22:09 -0700
Guy Harris  wrote:

[...]
> I've checked in changes to:
> 
>   check the bit-width of the build in autotools;
> 
>   on Solaris, use the results of the bit-width checks for
> autotools and CMake to figure out which version of pcap-config to run.
> 
> See if that clears up the Solaris 11 with GCC build.

GCC+CMake fails early now (see attached). GCC+Autoconf works, as before.

-- 
Denis Ovsienko
> MATRIX_CC=gcc MATRIX_CMAKE=yes ./build_matrix.sh
SunOS unstable11s 5.11 11.3 sun4u sparc SUNW,SPARC-Enterprise
OS identification: SunOS-5.11
Sunday, August  8, 2021 11:02:23 AM CEST
PREFIX set to '/tmp/tcpdump_build_matrix.XXoP3bDd'
Use system libpcap
make: Fatal error: Don't know how to make target `distclean'
(Ignoring the make error.)
= SETUP 1: BUILD_LIBPCAP=no REMOTE=? CC=gcc CMAKE=yes CRYPTO=no SMB=no =
$ ./build.sh
gcc (GCC) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Compiler identification: gcc-7.3.0
$ rm -rf build
$ mkdir build
$ cd build
$ cmake -DWITH_CRYPTO=no -DENABLE_SMB=no -DEXTRA_CFLAGS=-Werror 
-DCMAKE_INSTALL_PREFIX=/tmp/tcpdump_build_matrix.XXoP3bDd ..
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is SunPro 5.9.0
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/CC
-- Check for working CXX compiler: /usr/bin/CC -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:62 (message):
  Architecture flags must be set in both CFLAGS and CXXFLAGS


-- Configuring incomplete, errors occurred!
--- End Message ---
___
tcpdump-workers mailing list
tcpdump-workers@lists.tcpdump.org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers

Re: [tcpdump-workers] build failures on Solaris

2021-08-08 Thread Guy Harris via tcpdump-workers
--- Begin Message ---
On Aug 8, 2021, at 2:26 AM, Denis Ovsienko  wrote:

> GCC+CMake fails early now (see attached).

Good!  That reveals the *underlying* problem:

1) CMake, by default, checks for both a C *and* a C++ compiler;

2) if it's checking for both compilers, the way CMake determines 
CMAKE_SIZEOF_VOID_P is to:

check for a C compiler;

set CMAKE_C_SIZEOF_DATA_PTR to the size of data pointers in that C 
compiler with whatever C flags are being used;

set CMAKE_SIZEOF_VOID_P to CMAKE_C_SIZEOF_DATA_PTR;

check for a C++ compiler;

set CMAKE_CXX_SIZEOF_DATA_PTR to the size of data pointers in that C++ 
compiler with whatever C++ flags are being used;

set CMAKE_SIZEOF_VOID_P to CMAKE_CXX_SIZEOF_DATA_PTR;

3) Sun/Oracle's C and C++ compilers default to building *32-bit* code;

4) the version of GCC installed on the Solaris 11 builder appears to default to 
building 64-bit code;

5) there does not appear to be a version of G++ installed, so CMake finds 
"/usr/bin/CC", which is the Sun/Oracle C++ compiler;

6) as a result of the above, CMake ends up setting CMAKE_SIZEOF_VOID_P to 4, 
which can affect the process of finding libraries;

7) nevertheless, the C code (which is *all* the code - ain't no C++ in tcpdump) 
is compiled 64-bit;

8) hilarity ensues.

I've checked in a change to explicitly tell CMake "this is a C-only project, 
don't check for a C++ compiler", so it should now think it's building 64-bit 
when building with GCC.

See whether that fixes things.--- End Message ---
___
tcpdump-workers mailing list
tcpdump-workers@lists.tcpdump.org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers

Re: [tcpdump-workers] build failures on Solaris

2021-08-08 Thread Denis Ovsienko via tcpdump-workers
--- Begin Message ---
On Sun, 8 Aug 2021 12:02:53 -0700
Guy Harris  wrote:

[...]
> I've checked in a change to explicitly tell CMake "this is a C-only
> project, don't check for a C++ compiler", so it should now think it's
> building 64-bit when building with GCC.
> 
> See whether that fixes things.

Thank you for investigating this problem and making the changes. All
results below come from the unstable11s host (with OpenCSW packages).
I confirm this change has fixed GCC+CMake case when building tcpdump
with the system libpcap (4 builds), in that CMake starts to detect
libpcap features it did not before, for example:

-- Looking for pcap_findalldevs
-- Looking for pcap_findalldevs - found
("tcpdump -D" works, although does not print anything)

However, in the same context building tcpdump with local libpcap in
../libpcap (4 builds) no longer works, in that the resulting tcpdump
binary segfaults itself and makes ldd segfault:

ldd /tmp/tcpdump_build_matrix.XXYkrCSb/bin/tcpdump
ldd: /tmp/tcpdump_build_matrix.XXYkrCSb/bin/tcpdump: execution failed
due to signal 11 (core dumped)

file /tmp/tcpdump_build_matrix.XXYkrCSb/bin/tcpdump
/tmp/tcpdump_build_matrix.XXYkrCSb/bin/tcpdump: ELF 64-bit MSB
executable SPARCV9 Version 1, dynamically linked, not stripped, no
debugging information available

/tmp/tcpdump_build_matrix.XXYkrCSb/bin/tcpdump --version
Segmentation Fault (core dumped)

Autoconf build with GCC works with both the system and the local
libpcap (8 builds), as before.

Sun C works with both CMake and Autoconf, with both the system and the
local libpcap (16 builds), as before.

Let me know in case you need more testing/diagnostics.

-- 
Denis Ovsienko
--- End Message ---
___
tcpdump-workers mailing list
tcpdump-workers@lists.tcpdump.org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers