19589, "stonea", "Poor error message is using Socket module without libevent being installed (or compiling with llvm)", "2022-04-01T21:08:49Z"
Summary of Problem
I'm trying to do some "hello world" style programs to try out new features in the 1.26 release. If I try and do anything with the Socket library (whether on my mac or Desktop Linux machine) I get the following compile-time error:
<built-in>:4:10: fatal error: 'event2/event.h' file not found
#include "event2/event.h"
^~~~~~~~~~~~~~~~
1 error generated.
So I'm guessing there's some third party dependency I need to install. In fact looking at our tests it looks like we have a .skipif
file to skip tests for this module when libevent
is not installed or if the target compiler is LLVM: chapel/Socket.skipif at main · chapel-lang/chapel · GitHub
I'm guessing these are known limitations, but from a user's perspective my immediate issues are:
(1) The error message could be better, and
(2) I don't see anything in the doc letting me know this is the case (Socket — Chapel Documentation 1.26)
Steps to Reproduce
Source Code:
use Socket;
config const mode = 0;
writeln("Mode = ", mode);
if(mode == 0) {
// server
writeln("Starting server on port 1337");
const server = listen(ipAddr.create(port=1337));
const client = server.accept();
client.writer().writeln("hello world\n");
} else {
// client
writeln("Connect to port 1337 and print returned string");
const connectedClient = connect(ipAddr.create(port=1337));
var reader = connectedClient.reader();
writeln("Got from server: ", reader.readln());
}
Compile command:
chpl foo.chpl
Execution command:
Things fail before I get to execution, but my intent would be to run:
> foo --mode 0
> foo --mode 1
Configuration Information
$ chpl --version
chpl version 1.27.0 pre-release (a4373b47a9)
built with LLVM version 11.1.0
Copyright 2020-2022 Hewlett Packard Enterprise Development LP
Copyright 2004-2019 Cray Inc.
(See LICENSE file for more details)
$ $CHPL_HOME/util/printchplenv --anonymize
CHPL_TARGET_PLATFORM: darwin
CHPL_TARGET_COMPILER: llvm
CHPL_TARGET_ARCH: x86_64
CHPL_TARGET_CPU: native
CHPL_LOCALE_MODEL: flat
CHPL_COMM: none
CHPL_TASKS: qthreads
CHPL_LAUNCHER: none
CHPL_TIMERS: generic
CHPL_UNWIND: none
CHPL_MEM: jemalloc
CHPL_ATOMICS: cstdlib
CHPL_GMP: bundled
CHPL_HWLOC: bundled
CHPL_RE2: bundled
CHPL_LLVM: system
CHPL_AUX_FILESYS: none
$ clang --version
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin