vishapoberon / vipack

vishap package manager
GNU General Public License v3.0
18 stars 6 forks source link

While building vipack during building dependency http the compilation of netSockets.Mod failes with "errror: implicit declaration of function..." for socket, bind, listen, accept, accept4, and connect. #4

Open tkurtbond opened 1 month ago

tkurtbond commented 1 month ago

While building vipack during building dependency http the compilation of netSockets.Mod failes with "errror: implicit declaration of function..." for socket, bind, listen, accept, accept4, and connect.

Also, the build does not actually stop after the that error, continuing on until failing later due to missing http dependency.

This is Fedora Linux 40 x86_64 with gcc (GCC) 14.2.1 20240912 (Red Hat 14.2.1-3).

Here are the errors:

cd /usr/local/sw/src/lang/Oberon/voc/vipack/deps/github.com/norayr/mbedtls/deps/github.com/norayr/http/build && voc -s /usr/local/sw/src/lang/Oberon/voc/vipack/deps/github.com/norayr/mbedtls/deps/github.com/norayr/http/deps/github.com/norayr/Internet/src/netSockets.Mod
/usr/local/sw/src/lang/Oberon/voc/vipack/deps/github.com/norayr/mbedtls/deps/github.com/norayr/http/deps/github.com/norayr/Internet/src/netSockets.Mod  Compiling netSockets.  4361 chars.
netSockets.c: In function ‘netSockets_Socket’:
netSockets.c:55:62: error: implicit declaration of function ‘socket’ [-Wimplicit-function-declaration]
   55 | define netSockets_socket(domain, type, protocol)       (int)socket(domain, type, protocol)
      |                                                             ^~~~~~

netSockets.c:59:16: note: in expansion of macro ‘netSockets_socket’
   59 |         return netSockets_socket(domain, type, protocol);
      |                ^~~~~~~~~~~~~~~~~
netSockets.c: In function ‘netSockets_Bind’:
netSockets.c:48:70: error: implicit declaration of function ‘bind’ [-Wimplicit-function-declaration]
   48 | etSockets_bind(sockfd, addr, addr__typ, addrlen)       (int)bind(sockfd, addr, addrlen)
      |                                                             ^~~~

netSockets.c:64:16: note: in expansion of macro ‘netSockets_bind’
   64 |         return netSockets_bind(sockfd, &*addr, addr__typ, addrlen);
      |                ^~~~~~~~~~~~~~~
netSockets.c: In function ‘netSockets_Listen’:
netSockets.c:52:54: error: implicit declaration of function ‘listen’ [-Wimplicit-function-declaration]
   52 | #define netSockets_listen(sockfd, backlog)      (int)listen(sockfd, backlog)
      |                                                      ^~~~~~
netSockets.c:69:16: note: in expansion of macro ‘netSockets_listen’
   69 |         return netSockets_listen(sockfd, backlog);
      |                ^~~~~~~~~~~~~~~~~
netSockets.c: In function ‘netSockets_Accept’:
netSockets.c:46:70: error: implicit declaration of function ‘accept’ [-Wimplicit-function-declaration]
   46 | etSockets_accept(sockfd, addr, addr__typ, addrlen)     (int)accept(sockfd, addr, addrlen)
      |                                                             ^~~~~~

netSockets.c:74:16: note: in expansion of macro ‘netSockets_accept’
   74 |         return netSockets_accept(sockfd, &*addr, addr__typ, &*addrlen);
      |                ^~~~~~~~~~~~~~~~~
netSockets.c: In function ‘netSockets_AcceptNB’:
netSockets.c:47:70: error: implicit declaration of function ‘accept4’ [-Wimplicit-function-declaration]
   47 | etSockets_acceptnb(sockfd, addr, addr__typ, addrlen)   (int)accept4(sockfd, addr, addrlen, O_NONBLOCK)
      |                                                             ^~~~~~~

netSockets.c:79:16: note: in expansion of macro ‘netSockets_acceptnb’
   79 |         return netSockets_acceptnb(sockfd, &*addr, addr__typ, &*addrlen);
      |                ^~~~~~~~~~~~~~~~~~~
netSockets.c: In function ‘netSockets_Connect’:
netSockets.c:49:67: error: implicit declaration of function ‘connect’ [-Wimplicit-function-declaration]
   49 | e netSockets_connect(sockfd, addr, addrlen)       (INTEGER)(connect(sockfd, addr, addrlen))
      |                                                             ^~~~~~~

netSockets.c:84:16: note: in expansion of macro ‘netSockets_connect’
   84 |         return netSockets_connect(sockfd, sockaddr, addrlen);
      |                ^~~~~~~~~~~~~~~~~~
C compile: gcc -fPIC -g -I "/usr/local/sw/versions/voc/git/2/include"   -c netSockets.c
-- failed: status 0, exitcode 1.
Terminated by Halt(1). 
make[3]: *** [/usr/local/sw/src/lang/Oberon/voc/vipack/deps/github.com/norayr/mbedtls/deps/github.com/norayr/http/deps/github.com/norayr/Internet/GNUmakefile:29: buildThis] Error 1
make[3]: Leaving directory '/usr/local/sw/src/lang/Oberon/voc/vipack/deps/github.com/norayr/mbedtls/deps/github.com/norayr/http/build'
make[2]: *** [/usr/local/sw/src/lang/Oberon/voc/vipack/deps/github.com/norayr/mbedtls/deps/github.com/norayr/http/GNUmakefile:37: build_deps] Error 2
make[2]: Leaving directory '/usr/local/sw/src/lang/Oberon/voc/vipack/deps/github.com/norayr/mbedtls/build'
make[1]: *** [/usr/local/sw/src/lang/Oberon/voc/vipack/deps/github.com/norayr/mbedtls/GNUmakefile:51: build_deps] Error 2
make[1]: Leaving directory '/usr/local/sw/src/lang/Oberon/voc/vipack/build'
shekspir55 commented 1 month ago

@tkurtbond have you run using gmake -f makefile_freebsd it seems to have all the dependencies.

tkurtbond commented 1 month ago

I don't see any makefile_freebsd in the repository anywhere.

norayr commented 1 month ago

sorry to hear this.

i will see tomorrow if i can repeat this.

at the time of the last commit it was building on my gentoo fine. before i was also periodically testing on debian. i think this is something trivial, but need to understand what is happening.

norayr commented 1 month ago

interesting, i cannot repeat this.

for me it builds fine, these are the last lines:

cd "build" && voc -s /tmp/vipack/src/vpkResolver.Mod
/tmp/vipack/src/vpkResolver.Mod  Compiling vpkResolver.  New symbol file.  4014 chars.
cd "build" && voc -s /tmp/vipack/src/vpkJsonDepRetriever.Mod
/tmp/vipack/src/vpkJsonDepRetriever.Mod  Compiling vpkJsonDepRetriever.  New symbol file.  19223 chars.
cd "build" && voc -s /tmp/vipack/src/vpkInstaller.Mod
/tmp/vipack/src/vpkInstaller.Mod  Compiling vpkInstaller.  New symbol file.  6988 chars.
cd "build" && voc /tmp/vipack/src/vipack.Mod -cm
/tmp/vipack/src/vipack.Mod  Compiling vipack.  Main program.  5180 chars.
cd "build" && rm testHttps.o
cd "build" && gcc -o vipack *.o -static -L/opt/voc/lib -lvoc-O2 /opt/voc/lib/libvoc-O2.a -L. -lmbedtls -lmbedcrypto -lmbedx509 libmbedcrypto.a libmbedtls.a libmbedx509.a
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: Internet.o: in function `Internet_Connect':
/tmp/vipack/build/Internet.c:120: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
________________________________________

what comes to my mind is that maybe your system doesn't have some development libraries.

but you were able to build voc so i guess it has glibc-devel.

do you have /usr/include/sys/socket.h or /usr/include/netinet/in.h ?

tkurtbond commented 1 month ago

Yes, my system has both /usr/include/sys/socket.h and /usr/include/netinet/in.h. Puzzling. What system are you building on?

norayr commented 1 month ago

i build on my gentoo x86_64 but i also tested on arm debian - both armv7 or aarch64. hmmm. i'll think about it.

norayr commented 1 month ago

i tried to create myself a centos9 chroot to repeat your issue, and so far i am even unable to build voc in it.

not sure if that's my chroot or that's something with modern redhat systems. will figure out and let you know.

norayr commented 1 month ago

so most likely the issue arises because your c compiler is stricter (maybe it requires c11 by default) and it does not tolerate implicit declarations.

i am fixing the code of Internet module (https://gihub.com/norayr/Internet) to get rid of warnings, and then it should compile for you.

norayr commented 1 month ago

i have eliminated all the warnings that appear when building Internet git repository/package, one of deps.

i also tested it by using make tests and then running build/testServer and build/testClient and it seems it works correctly.

can you try to build vipack now? i am afraid there will be other warnings from other modules so it won't build again.

also it depends currently on mbedtls, to be able to download files from https and links to it. current makefile does ugly thing, it downloads my prebuilt version of mbedtls, but we need a good solution in the future. i am saying that you may want to build your version of mbdetls and change the makefile, to have full control over the build.

or does fedora have mbedtls packaged? i just checked, it is packaged for debian. so i guess i need to describe how to install mbedtls and i need to change the makefile in a way it searches mbedtls in default paths.

still, perhap's you'll still have other problems.

can you try to build vipack again? it should update Internet module from git repo and build again. this time there should be no warnings from that dependency.