Welcome to the Builder Academy

Question configure script uses implicit int for test app

More
28 Feb 2025 21:35 #10568 by thomas
yeah, I haven't tried building on a mac lately (even though I recently got access to one).

I'm tempted to go with cmake, since it apparently should work on all platforms, and I think the current solution is from before 2000. cmake.org/features/ looks very tempting.

Please Log in or Create an account to join the conversation.

More
05 Mar 2025 18:36 #10571 by Banlock
I did download a fresh zip of tbamud-master and ran configure on that and it failed with the same error message. So at least it wasn't any silly cruft I had left behind from an older version. Again my version of "gcc" is actually clang and is clang-1600.0.26.6. I'm probably an outlier - but if you start working on a different build system, I'd be happy to help test.

Please Log in or Create an account to join the conversation.

More
20 Apr 2025 23:32 #10669 by thomas
I've started looking into cmake - have a look at this branch: github.com/tbamud/tbamud/compare/feature/cmake?expand=1
Does it work for you?

Please Log in or Create an account to join the conversation.

More
21 Apr 2025 15:45 - 21 Apr 2025 16:46 #10670 by ironfist
Trying this in ubuntu, are you supposed to run from root dir or src?

EDIT: oops, meant to cmake --build build --target circle but same errors
EDIT: Nevermind on that question... I had an artifact build directory in root that it didn't like
Code:
ironfist@ironfist-aorus:~/projects/tbamud_cmake_test/tbamud$ cmake -B build -S . CMake Error: The source "/home/ironfist/projects/tbamud_cmake_test/tbamud/CMakeLists.txt" does not match the source "/home/ironfist/projects/tbamud_cmake_test/tbamud/src/CMakeLists.txt" used to generate cache.  Re-run cmake with a different source directory. ironfist@ironfist-aorus:~/projects/tbamud_cmake_test/tbamud$ cd src ironfist@ironfist-aorus:~/projects/tbamud_cmake_test/tbamud/src$ cmake -B build -S . -- The C compiler identification is GNU 14.2.0 -- The CXX compiler identification is GNU 14.2.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done (0.3s) -- Generating done (0.0s) -- Build files have been written to: /home/ironfist/projects/tbamud_cmake_test/tbamud/src/build ironfist@ironfist-aorus:~/projects/tbamud_cmake_test/tbamud/src$ cmake --build build [  1%] Building C object CMakeFiles/circle.dir/act.comm.c.o In file included from /home/ironfist/projects/tbamud_cmake_test/tbamud/src/act.comm.c:12: /home/ironfist/projects/tbamud_cmake_test/tbamud/src/sysdep.h:180:21: error: #if with no expression   180 | # if HAVE_SYS_TIME_H       |                     ^ In file included from /home/ironfist/projects/tbamud_cmake_test/tbamud/src/act.comm.c:15: /home/ironfist/projects/tbamud_cmake_test/tbamud/src/comm.h:55:9: error: unknown type name ‘RETSIGTYPE’    55 | typedef RETSIGTYPE sigfunc(int);       |         ^~~~~~~~~~ gmake[2]: *** [CMakeFiles/circle.dir/build.make:79: CMakeFiles/circle.dir/act.comm.c.o] Error 1 gmake[1]: *** [CMakeFiles/Makefile2:87: CMakeFiles/circle.dir/all] Error 2 gmake: *** [Makefile:91: all] Error 2 ironfist@ironfist-aorus:~/projects/tbamud_cmake_test/tbamud/src$ git status On branch feature/cmake Your branch is up to date with 'origin/feature/cmake'. Untracked files:   (use "git add <file>..." to include in what will be committed) build/ nothing added to commit but untracked files present (use "git add" to track)
Last edit: 21 Apr 2025 16:46 by ironfist.

Please Log in or Create an account to join the conversation.

More
21 Apr 2025 17:41 #10671 by thomas
Tanks for testing it out. Apparently the first step (cmake -B build -S .) does not run the CMakeLists.txt I created. There re quite a bit missing:
Code:
➜ tbamud git:(feature/cmake) ✗ rm -rf build ➜ tbamud git:(feature/cmake) ✗ cmake -B build -S . -- The C compiler identification is GNU 13.3.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Performing Test SUPPORTS_WALL -- Performing Test SUPPORTS_WALL - Success -- Performing Test SUPPORTS_WNO_CHAR_SUBSCRIPTS -- Performing Test SUPPORTS_WNO_CHAR_SUBSCRIPTS - Success -- Looking for fcntl.h -- Looking for fcntl.h - found -- Looking for errno.h -- Looking for errno.h - found -- Looking for string.h -- Looking for string.h - found -- Looking for strings.h -- Looking for strings.h - found -- Looking for limits.h -- Looking for limits.h - found -- Looking for sys/time.h -- Looking for sys/time.h - found -- Looking for sys/select.h -- Looking for sys/select.h - found -- Looking for sys/types.h -- Looking for sys/types.h - found -- Looking for unistd.h -- Looking for unistd.h - found -- Looking for memory.h -- Looking for memory.h - found -- Looking for assert.h -- Looking for assert.h - found -- Looking for arpa/telnet.h -- Looking for arpa/telnet.h - found -- Looking for arpa/inet.h -- Looking for arpa/inet.h - found -- Looking for sys/stat.h -- Looking for sys/stat.h - found -- Looking for sys/socket.h -- Looking for sys/socket.h - found -- Looking for sys/resource.h -- Looking for sys/resource.h - found -- Looking for netinet/in.h -- Looking for netinet/in.h - found -- Looking for netdb.h -- Looking for netdb.h - found -- Looking for signal.h -- Looking for signal.h - found -- Looking for sys/uio.h -- Looking for sys/uio.h - found -- Looking for mcheck.h -- Looking for mcheck.h - found -- Looking for gettimeofday -- Looking for gettimeofday - found -- Looking for select -- Looking for select - found -- Looking for snprintf -- Looking for snprintf - found -- Looking for strcasecmp -- Looking for strcasecmp - found -- Looking for strdup -- Looking for strdup - found -- Looking for strerror -- Looking for strerror - found -- Looking for stricmp -- Looking for stricmp - not found -- Looking for strlcpy -- Looking for strlcpy - found -- Looking for strncasecmp -- Looking for strncasecmp - found -- Looking for strnicmp -- Looking for strnicmp - not found -- Looking for strstr -- Looking for strstr - found -- Looking for vsnprintf -- Looking for vsnprintf - found -- Looking for inet_addr -- Looking for inet_addr - found -- Looking for inet_aton -- Looking for inet_aton - found -- Looking for stdint.h -- Looking for stdint.h - found -- Looking for stddef.h -- Looking for stddef.h - found -- Check size of pid_t -- Check size of pid_t - done -- Check size of size_t -- Check size of size_t - done -- Check size of ssize_t -- Check size of ssize_t - done -- Check size of socklen_t -- Check size of socklen_t - failed -- Performing Test HAVE_STRUCT_IN_ADDR -- Performing Test HAVE_STRUCT_IN_ADDR - Success -- Found libcrypt: /usr/lib/x86_64-linux-gnu/libcrypt.so -- Looking for gethostbyaddr -- Looking for gethostbyaddr - found -- Looking for socket -- Looking for socket - found -- Configuring done (8.2s) -- Generating done (0.0s) -- Build files have been written to: /home/thomas/code/tbamud/build

Please Log in or Create an account to join the conversation.

More
21 Apr 2025 18:00 #10672 by ironfist
I'm getting pretty much what you have now, was tinkering around with some complaints it had, though duno if these fixes in the patch below are legit or not, but the first set stopped it from complaining as much.

It looks like it has the conf.h generated in the build directory in addition to the one in the src? So it will complain on redefinitions if I add the second patch but if it is not there, it complains because time is not defined.

Code:
diff --git a/src/comm.h b/src/comm.h index 9837c86..7d1ff1d 100644 --- a/src/comm.h +++ b/src/comm.h @@ -52,7 +52,8 @@ int   write_to_descriptor(socket_t desc, const char *txt); size_t write_to_output(struct descriptor_data *d, const char *txt, ...) __attribute__ ((format (printf, 2, 3))); size_t vwrite_to_output(struct descriptor_data *d, const char *format, va_list args); -typedef RETSIGTYPE sigfunc(int); +//typedef RETSIGTYPE sigfunc(int); +#define RETSIGTYPE void; void echo_off(struct descriptor_data *d); void echo_on(struct descriptor_data *d); diff --git a/src/sysdep.h b/src/sysdep.h index 27b45db..4ff031e 100644 --- a/src/sysdep.h +++ b/src/sysdep.h @@ -173,17 +173,19 @@ extern void abort(), exit(); #endif #endif + #ifdef TIME_WITH_SYS_TIME # include <sys/time.h> # include <time.h> #else -# if HAVE_SYS_TIME_H +# ifdef HAVE_SYS_TIME_H #  include <sys/time.h> # else #  include <time.h> # endif #endif + #ifdef HAVE_ASSERT_H #include <assert.h> #else

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2f8670d..acaa2e1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -57,6 +57,15 @@ check_include_file("signal.h" HAVE_SIGNAL_H)
check_include_file("sys/uio.h" HAVE_SYS_UIO_H)
check_include_file("mcheck.h" HAVE_MCHECK_H)

+# Add the detected defines
+if(HAVE_SYS_TIME_H)
+  add_compile_definitions(HAVE_SYS_TIME_H)
+endif()
+
+if(HAVE_TIME_H)
+    add_compile_definitions(HAVE_TIME_H)
+endif()
+
# macro for checking for functions in libraries
macro(check_function_with_libx FUNCTION LIB VARIABLE)
    check_function_exists(${FUNCTION} ${VARIABLE})
diff --git a/src/comm.h b/src/comm.h
index 9837c86..7d1ff1d 100644

Please Log in or Create an account to join the conversation.

Time to create page: 0.221 seconds