These are chat archives for Snaipe/Criterion

17th
May 2018
Franklin Mathieu
@Snaipe
May 17 2018 05:56
@acook Is ecc being picked up for the other dependencies and Criterion itself? I might have forgotten some tricky bit in the csptr's configuration
I think CMake wants you to use a toolchain file rather than just defining CC
Something like this maybe:
$ pwd
/path/to/criterion/build
$ cat ecc.cmake
set(CMAKE_SYSTEM_NAME Linux)

set(CMAKE_C_COMPILER ecc)
$ cmake -DCMAKE_TOOLCHAIN_FILE=ecc.cmake ..
(point is, I'm not sure CC propagates to dependencies)
Anthony M. Cook
@acook
May 17 2018 09:56
Hmm, I will give that a shot, thanks. It only stops on csptr so far, other deps seem to work fine.
Anthony M. Cook
@acook
May 17 2018 10:51
Okay, so it looks like all the deps were ignoring $CC, but only csptr was failing. With some additional research I got a Cmake toolchain file written, so all the Cmake deps are now using the correct toolchain (yay). On the downside, the ecc I'm using is based off a quite old clang and it isn't happy about the forward declaration of structs in nanomsg (boo).
For posterity, here is the ecc.cmake I ended up with:
set(CMAKE_SYSTEM_NAME Linux)
find_program(CMAKE_C_COMPILER ecc)
find_program(CMAKE_CXX_COMPILER ecc++)
find_program(CMAKE_LINKER ecc)
find_program(CMAKE_AR ecc-ar)
set(CMAKE_SYSTEM_PROCESSOR x86_64)
set(TRIPLE x86_64-pc-linux-gnu)
set(CMAKE_C_COMPILER_TARGET ${TRIPLE})
set(CMAKE_CXX_COMPILER_TARGET ${TRIPLE})
Anthony M. Cook
@acook
May 17 2018 11:04
Also, I'm not sure but it looks like Cmake is nondeterministic in the order it decides to build deps. It always(?) seems to build git2 first and then it will build nanomsg, boxfort, or csptr but it seems random which it chooses.
Anthony M. Cook
@acook
May 17 2018 11:10
I'd been assuming it was getting farther in the process, but it wasn't. Anyway, here's the csptr error:
'linker' input unused
Franklin Mathieu
@Snaipe
May 17 2018 11:21
What errors are you getting on the nanomsg side? I'm quite familiar with their implementation and I've been in touch with the maintainer, I can probably send him a patch
Also it looks like there's a -Werror somewhere that really shouldn't be here. Let me have a look
Anthony M. Cook
@acook
May 17 2018 11:26
Here is a capture of the nanomsg errors:
field has incomplete type 'struct gaicb'
The messages seem to imply that there's a missing #include.
Franklin Mathieu
@Snaipe
May 17 2018 11:30
Yes, I think that dns_getaddrinfo_a.inc isn't including the .h
which in turn includes netdb
actually the nanomsg I'm bundling here is a bit behind, let me check on the latest release
It looks like it hasn't been fixed
Anthony M. Cook
@acook
May 17 2018 11:33
Are other compilers able to guess? Or is it an order-of-operation thing?
Franklin Mathieu
@Snaipe
May 17 2018 11:35
I think your system might be missing a proper getaddrinfo_a implementation, or at least CMake can't find it if you do have one
so nanomsg falls back to their own broken implementation
oh, right, musl
so this hasn't been caught before because glibc provides the function, but musl might not be
Anthony M. Cook
@acook
May 17 2018 11:39
Interesting. I found a similar mention of getaddrinfo_a in an issue referring to Alpine Linux (which is a Musl-based distro): paritytech/parity#5794
Franklin Mathieu
@Snaipe
May 17 2018 11:46
There's something weird here; the include is actually there (it's included one layer above in dns.h), but I'm guessing it's missing some definitions. I'll try to compile that on alpine and see what happens
Franklin Mathieu
@Snaipe
May 17 2018 11:53
By the way, you can make Criterion convince nanomsg to not use getaddrinfo_a at all by adding -DNN_DISABLE_GETADDRINFO_A=ON in Criterion's CMakeLists.txt to the cr_add_subproject (nanomsg ... block.
This, at least, should get you along further
Anthony M. Cook
@acook
May 17 2018 11:55
I've been trying to see if Alpine has their own version of libanl since I've seen it mentioned in a couple of places, or at least patches which work around it, but so far I'm not turning up much. I also asked the Musl people if they planned to implement that glibc extension, but I'm not feeling lucky.
Franklin Mathieu
@Snaipe
May 17 2018 11:55
(alternatively define that in your toolchain file, so you won't have to edit the file)
Anthony M. Cook
@acook
May 17 2018 11:55
Yeah, your deps script would probably end up clobbering any changes I made to the file anyway
And if not yours then my own cleanup scripts
Franklin Mathieu
@Snaipe
May 17 2018 11:57
You can also define LINKER_HAS_EXCLUDE_LIBS=OFF in the toolchain file to get rid of the csptr error, I believe
oh nevermind that, I forgot that you wanted to use ecc, not clang
That's strange, I'm not able to reproduce the above errors on Alpine with clang or gcc. I'm guessing that an out-of-date netdb.h might be provided by ecc
Franklin Mathieu
@Snaipe
May 17 2018 12:02
(unless you're having the same issues with clang)
Anthony M. Cook
@acook
May 17 2018 12:03
Lemme see if it works with the system clang (which seems to be ancient for some reason?)
Franklin Mathieu
@Snaipe
May 17 2018 12:07
(also note that if you're using 2.3.0 or above, you might fork-bomb yourself if you run any tests, due to #247. A fix is in the work though)
Anthony M. Cook
@acook
May 17 2018 12:13
I'm doing some experiments with the different build chains now.
$ /usr/bin/clang --version # installed by apt
Debian clang version 3.5.0-10 (tags/RELEASE_350/final) (based on LLVM 3.5.0)
Target: x86_64-pc-linux-gnu
Thread model: posix

$ ecc --version
ecc version 2017-08-23 (http://ellcc.org) based on clang version 6.0.0 (trunk 311547)
Target: x86_64-ellcc-linux
Thread model: posix
InstalledDir: /home/xybre/Source/blacklight/ext/ellcc/bin
Franklin Mathieu
@Snaipe
May 17 2018 12:19
using CC=ecc from my alpine container works. I'm noticing you mentioned apt; assuming debian or ubuntu, you might just have an ancient libanl
Anthony M. Cook
@acook
May 17 2018 12:20
Interesting too is that ecc lies or is confused because Clang 6.0 wasn't released until a few days ago
Well, libanl is from glibc, so linking to it from a musl-based binary would probably be ill advised
So unless it ships with nanomsg, it wouldn't have access to it anyway
Franklin Mathieu
@Snaipe
May 17 2018 12:24
Uh, sorry, I meant the netdb header; libanl would of course be missing here
Anthony M. Cook
@acook
May 17 2018 12:26
I should probably spin up an Alpine container for development, I've just gotten into the habit of using BunsenLabs and its predecessor. This is a recent install, but there's definitely something fishy about my package versions. Maybe I hosed something during setup and didn't notice because I don't use apt very much.
There is definitely no mention of the gaicb struct in netdb.hor anywhere else in the ecc install directory
Franklin Mathieu
@Snaipe
May 17 2018 12:30
Ah, I think my short ecc test here wasn't picking up their netdb.h
Anthony M. Cook
@acook
May 17 2018 12:33
Just checked, BunsenLabs Helium (the current release) is based on Debian Jesse/oldstable, despite stretch having been released almost a year ago, hence the older packages.
Alpine may provide stubs/polyfills for common extensions to make building more apps easier with less patching