libwebsockets icon indicating copy to clipboard operation
libwebsockets copied to clipboard

uv/version.h not found

Open jnavarrom opened this issue 1 year ago • 4 comments

Hello

I compile libwebsockets with libuv (version 1.42.0).

When invoking cmake I use: -DLWS_WITH_LIBUV=1 -DLIBUV_INCLUDE_DIRS=/Users/jn/Developer/Libs/build/include -DLIBUV_LIBRARIES=/Users/jn/Developer/Libs/build/xcframework/libuv.xcframework/ios-arm64_x86_64-simulator/libuv.a

among others flags: -DLWS_IPV6=ON -DLWS_SSL_CLIENT_USE_OS_CA_CERTS=0 -DLWS_WITH_SHARED=OFF -DLWS_WITHOUT_TESTAPPS=ON -DLWS_WITHOUT_SERVER=ON -DLWS_WITH_HTTP2=0 -DLWS_WITH_BORINGSSL=1 -DIOS_BITCODE=0

But uv/version.h is not found:

libuv include dir: /Users/jn/Developer/Libs/build/include
libuv libraries: /Users/jn/Developer/Libs/build/xcframework/libuv.xcframework/ios-arm64_x86_64-simulator/libuv.a
-- Looking for uv-version.h
-- Looking for uv-version.h - not found
-- Looking for uv/version.h
-- Looking for uv/version.h - not found

Despite the file is in the directory:

ls -l /Users/jn/Developer/Libs/build/include/uv
total 328
-rw-r--r--  1 jn  staff   1615 Sep 12 17:04 aix.h
-rw-r--r--  1 jn  staff   1853 Sep 12 17:04 android-ifaddrs.h
-rw-r--r--  1 jn  staff   1641 Sep 12 17:04 bsd.h
-rw-r--r--  1 jn  staff   3213 Sep 12 17:04 darwin.h
-rw-r--r--  1 jn  staff  10643 Sep 12 17:04 errno.h
-rw-r--r--  1 jn  staff   1781 Sep 12 17:04 linux.h
-rw-r--r--  1 jn  staff   1553 Sep 12 17:04 os390.h
-rw-r--r--  1 jn  staff   1606 Sep 12 17:04 posix.h
-rw-r--r--  1 jn  staff   7728 Sep 12 17:04 stdint-msvc2008.h
-rw-r--r--  1 jn  staff   1985 Sep 12 17:04 sunos.h
-rw-r--r--  1 jn  staff   1497 Sep 12 17:04 threadpool.h
-rw-r--r--  1 jn  staff  52889 Sep 12 17:04 tree.h
-rw-r--r--  1 jn  staff  19536 Sep 12 17:04 unix.h
-rw-r--r--  1 jn  staff   1831 Sep 12 17:04 version.h
-rw-r--r--  1 jn  staff  32541 Sep 12 17:04 win.h

Any Idea why uv/version.h is not found?

jnavarrom avatar Sep 20 '22 14:09 jnavarrom

Dunno... have a look in CMakeFiles/CMakeError.log and see CMake's pov about why it feels that way.

lws-team avatar Sep 20 '22 14:09 lws-team

It is not clear to me the reason why uv/version.h is not found. I understand that uv-version.h is not found because the file doesn't exist in the libuv include dir: /Users/jn/Developer/Libs/build/include path (If I am not wrong uv-version.h is used for previous versions of libuv), but uv/version.h does exist in the path.

Determining if the include file uv-version.h exists failed with the following output:
Change Dir: /Users/jn/Developer/Libs/build/libwebsockets/CMakeFiles/CMakeTmp

Run Build Command(s):/Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile cmTC_b2e39/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make  -f CMakeFiles/cmTC_b2e39.dir/build.make CMakeFiles/cmTC_b2e39.dir/build
Building C object CMakeFiles/cmTC_b2e39.dir/CheckIncludeFile.c.o
/usr/bin/clang -DKEYWORD=__inline  -Wall -Wconversion -Wsign-compare -Wstrict-aliasing -fvisibility=hidden -Wundef  -Wuninitialized -Wtype-limits -Wignored-qualifiers   -Werror -Wno-deprecated-declarations -pthread -Wno-error=unused-command-line-argument  -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.0.sdk -MD -MT CMakeFiles/cmTC_b2e39.dir/CheckIncludeFile.c.o -MF CMakeFiles/cmTC_b2e39.dir/CheckIncludeFile.c.o.d -o CMakeFiles/cmTC_b2e39.dir/CheckIncludeFile.c.o -c /Users/jn/Developer/Libs/build/libwebsockets/CMakeFiles/CMakeTmp/CheckIncludeFile.c
/Users/jn/Developer/Libs/build/libwebsockets/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10: fatal error: 'uv-version.h' file not found
#include <uv-version.h>
         ^~~~~~~~~~~~~~
1 error generated.
make[1]: *** [CMakeFiles/cmTC_b2e39.dir/CheckIncludeFile.c.o] Error 1
make: *** [cmTC_b2e39/fast] Error 2



Determining if the include file uv/version.h exists failed with the following output:
Change Dir: /Users/jn/Developer/Libs/build/libwebsockets/CMakeFiles/CMakeTmp

Run Build Command(s):/Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile cmTC_27943/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make  -f CMakeFiles/cmTC_27943.dir/build.make CMakeFiles/cmTC_27943.dir/build
Building C object CMakeFiles/cmTC_27943.dir/CheckIncludeFile.c.o
/usr/bin/clang -DKEYWORD=__inline  -Wall -Wconversion -Wsign-compare -Wstrict-aliasing -fvisibility=hidden -Wundef  -Wuninitialized -Wtype-limits -Wignored-qualifiers   -Werror -Wno-deprecated-declarations -pthread -Wno-error=unused-command-line-argument  -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.0.sdk -MD -MT CMakeFiles/cmTC_27943.dir/CheckIncludeFile.c.o -MF CMakeFiles/cmTC_27943.dir/CheckIncludeFile.c.o.d -o CMakeFiles/cmTC_27943.dir/CheckIncludeFile.c.o -c /Users/jn/Developer/Libs/build/libwebsockets/CMakeFiles/CMakeTmp/CheckIncludeFile.c
/Users/jn/Developer/Libs/build/libwebsockets/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10: fatal error: 'uv/version.h' file not found
#include <uv/version.h>
         ^~~~~~~~~~~~~~
1 error generated.
make[1]: *** [CMakeFiles/cmTC_27943.dir/CheckIncludeFile.c.o] Error 1
make: *** [cmTC_27943/fast] Error 2

jnavarrom avatar Sep 20 '22 15:09 jnavarrom

Yes libuv itself has had different paths for version.h depending on the version.

This is exactly what cmake runs to try find it

/usr/bin/clang -DKEYWORD=__inline  -Wall -Wconversion -Wsign-compare -Wstrict-aliasing -fvisibility=hidden -Wundef  -Wuninitialized -Wtype-limits -Wignored-qualifiers   -Werror -Wno-deprecated-declarations -pthread -Wno-error=unused-command-line-argument  -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.0.sdk -MD -MT CMakeFiles/cmTC_27943.dir/CheckIncludeFile.c.o -MF CMakeFiles/cmTC_27943.dir/CheckIncludeFile.c.o.d -o CMakeFiles/cmTC_27943.dir/CheckIncludeFile.c.o -c /Users/jn/Developer/Libs/build/libwebsockets/CMakeFiles/CMakeTmp/CheckIncludeFile.c

If you put things in build machine /usr/include, and build non-cross, the tools know to look in there by default and you should expect it to be found even so.

But if it's in a random dir somewhere unless there's something like -I/Users/jn/Developer/Libs/build/include on the cmake test there's no reason it will look in there. If you build using the cross toolchain in there, you can try adding your cross-rootfs dir to CMAKE_FIND_ROOT_PATH in there. But it expects the cross-rootfs xxx to be laid out like xxx/usr/include xxx/usr/lib etc I am not sure how best to do it for iOS.

lws-team avatar Sep 20 '22 16:09 lws-team

I need cross build, I build the library for x86_64 and arm64 iPhoneSimulator and for arm64 iPhoneOS using a MacBook Pro with M1.

I moved uv headers to /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.0.sdk/usr/include and now it works, but I am not sure if this is a good solution

-- Looking for uv/version.h
-- Looking for uv/version.h - found

Thanks for helping

jnavarrom avatar Sep 21 '22 10:09 jnavarrom