Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Failed to build on FreeBSD #264

Open
Curculigo opened this issue Aug 9, 2024 · 0 comments
Open

Failed to build on FreeBSD #264

Curculigo opened this issue Aug 9, 2024 · 0 comments

Comments

@Curculigo
Copy link

If use Makefile:

$ gmake
cd src && gmake all
gmake[1]: Entering directory '/work/zlog/src'
cc -std=c99 -pedantic -c -O2 -fPIC -pthread  -Wall -Werror -Wstrict-prototypes -fwrapv -g -ggdb buf.c
cc -std=c99 -pedantic -c -O2 -fPIC -pthread  -Wall -Werror -Wstrict-prototypes -fwrapv -g -ggdb category.c
cc -std=c99 -pedantic -c -O2 -fPIC -pthread  -Wall -Werror -Wstrict-prototypes -fwrapv -g -ggdb category_table.c
cc -std=c99 -pedantic -c -O2 -fPIC -pthread  -Wall -Werror -Wstrict-prototypes -fwrapv -g -ggdb conf.c
cc -std=c99 -pedantic -c -O2 -fPIC -pthread  -Wall -Werror -Wstrict-prototypes -fwrapv -g -ggdb event.c
event.c:101:65: error: cast to smaller integer type 'unsigned int' from 'pthread_t' (aka 'struct pthread *') [-Werror,-Wpointer-to-int-cast]
  101 |         a_event->tid_hex_str_len = sprintf(a_event->tid_hex_str, "%x", (unsigned int)a_event->tid);
      |                                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
gmake[1]: *** [Makefile:194: event.o] Error 1
gmake[1]: Leaving directory '/work/zlog/src'
gmake: *** [Makefile:6: all] Error 2

If use CMake:

$ cmake -S . -B build
CMake Deprecation Warning at CMakeLists.txt:17 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- path : 
-- The C compiler identification is Clang 18.1.5
-- The CXX compiler identification is Clang 18.1.5
-- 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
-- path : 
-- platform : FreeBSD-14.1-RELEASE-p2
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- thread lib : -lpthread
-- system process is amd64
-- system process is amd64
-- Configuring done (3.2s)
-- Generating done (0.0s)
-- Build files have been written to: /work/zlog/build
$ gmake -C build
gmake: Entering directory '/work/zlog/build'
[  2%] Building C object src/CMakeFiles/zlog.dir/buf.c.o
[  4%] Building C object src/CMakeFiles/zlog.dir/category.c.o
[  6%] Building C object src/CMakeFiles/zlog.dir/category_table.c.o
[  8%] Building C object src/CMakeFiles/zlog.dir/conf.c.o
[ 10%] Building C object src/CMakeFiles/zlog.dir/event.c.o
/work/zlog/src/event.c:101:65: warning: cast to smaller integer type 'unsigned int' from 'pthread_t' (aka 'struct pthread *') [-Wpointer-to-int-cast]
  101 |         a_event->tid_hex_str_len = sprintf(a_event->tid_hex_str, "%x", (unsigned int)a_event->tid);
      |                                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
[ 13%] Building C object src/CMakeFiles/zlog.dir/format.c.o
[ 15%] Building C object src/CMakeFiles/zlog.dir/level.c.o
[ 17%] Building C object src/CMakeFiles/zlog.dir/level_list.c.o
[ 19%] Building C object src/CMakeFiles/zlog.dir/lockfile.c.o
[ 21%] Building C object src/CMakeFiles/zlog.dir/mdc.c.o
[ 23%] Building C object src/CMakeFiles/zlog.dir/record.c.o
[ 26%] Building C object src/CMakeFiles/zlog.dir/record_table.c.o
[ 28%] Building C object src/CMakeFiles/zlog.dir/rotater.c.o
[ 30%] Building C object src/CMakeFiles/zlog.dir/rule.c.o
[ 32%] Building C object src/CMakeFiles/zlog.dir/spec.c.o
/work/zlog/src/spec.c:272:49: error: no member named 'ktid_str' in 'zlog_event_t'; did you mean 'tid_str'?
  272 |         return zlog_buf_append(a_buf, a_thread->event->ktid_str, a_thread->event->ktid_str_len);
      |                                                        ^~~~~~~~
      |                                                        tid_str
/work/zlog/src/event.h:71:7: note: 'tid_str' declared here
   71 |         char tid_str[30 + 1];
      |              ^
/work/zlog/src/spec.c:272:76: error: no member named 'ktid_str_len' in 'zlog_event_t'; did you mean 'tid_str_len'?
  272 |         return zlog_buf_append(a_buf, a_thread->event->ktid_str, a_thread->event->ktid_str_len);
      |                                                                                   ^~~~~~~~~~~~
      |                                                                                   tid_str_len
/work/zlog/src/event.h:72:9: note: 'tid_str_len' declared here
   72 |         size_t tid_str_len;
      |                ^
2 errors generated.
gmake[2]: *** [src/CMakeFiles/zlog.dir/build.make:272: src/CMakeFiles/zlog.dir/spec.c.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:135: src/CMakeFiles/zlog.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2
gmake: Leaving directory '/work/zlog/build'
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant