DEV Community

loading...

Run libuv on Repl.it

tingwei628 profile image Tingwei ・1 min read

libuv

  1. upload necessary folders and files including: src/, test/, include/, CMakeLists.txt, configure.ac, libuv.pc.in to Repl.it

  2. execute these commands

open shell on Repl.it ( F1 -> open shell )

$ mkdir -p out/cmake ; cd out/cmake   # create build directory
$ cmake ../.. -DBUILD_TESTING=ON      # generate project with test
$ cmake --build .                     # build

it generated libuv.so

3.set lib path

$LD_LIBRARY_PATH=out/cmake
$export LD_LIBRARY_PATH

4.modify some source/header files to avoid compile errors

main.c

#include "include/uv.h" // changed <uv.h> to "include/uv.h"

uv/unix.h

#include "threadpool.h" // changed uv/threadpool.h to threadpool.h

#if defined(__linux__)
# include "linux.h"     // changed uv/linux.h to linux.h

5.compile

$clang -o m main.c out/cmake/libuv.so

6.run

$ ./m

More examples of libuv

Check it out on Repl.it

Discussion

pic
Editor guide