Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

TypeError: Unable to resolve type 'uint8_t' #1066

Closed
goromlagche opened this issue Dec 13, 2023 · 2 comments · Fixed by #1067
Closed

TypeError: Unable to resolve type 'uint8_t' #1066

goromlagche opened this issue Dec 13, 2023 · 2 comments · Fixed by #1067

Comments

@goromlagche
Copy link

While trying to use ffi inside a docker image built from arm64v8/ruby:3.2.2 I am getting an issue TypeError: Unable to resolve type 'uint8_t' . The gem install works fine and passes.

I tried running rake types_conf from inside the container and this is the git diff I am getting.

--- a/lib/ffi/platform/aarch64-linux/types.conf
    b/lib/ffi/platform/aarch64-linux/types.conf
@@ -1,5  1,4 @@
 rbx.platform.typedef.*__caddr_t = char
-rbx.platform.typedef.*__qaddr_t = long
 rbx.platform.typedef.__blkcnt64_t = long
 rbx.platform.typedef.__blkcnt_t = long
 rbx.platform.typedef.__blksize_t = int
@@ -21,7  20,43 @@ rbx.platform.typedef.__int16_t = short
 rbx.platform.typedef.__int32_t = int
 rbx.platform.typedef.__int64_t = long
 rbx.platform.typedef.__int8_t = char
 rbx.platform.typedef.__int_least16_t = short
 rbx.platform.typedef.__int_least32_t = int
 rbx.platform.typedef.__int_least64_t = long
 rbx.platform.typedef.__int_least8_t = char
 rbx.platform.typedef.__intmax_t = long
 rbx.platform.typedef.__intptr_t = long
 rbx.platform.typedef.__kernel_caddr_t = string
 rbx.platform.typedef.__kernel_clock_t = long
 rbx.platform.typedef.__kernel_clockid_t = int
 rbx.platform.typedef.__kernel_daddr_t = int
 rbx.platform.typedef.__kernel_gid16_t = ushort
 rbx.platform.typedef.__kernel_gid32_t = uint
 rbx.platform.typedef.__kernel_gid_t = uint
 rbx.platform.typedef.__kernel_ino_t = ulong
 rbx.platform.typedef.__kernel_ipc_pid_t = int
 rbx.platform.typedef.__kernel_key_t = int
 rbx.platform.typedef.__kernel_loff_t = long_long
 rbx.platform.typedef.__kernel_long_t = long
 rbx.platform.typedef.__kernel_mode_t = uint
 rbx.platform.typedef.__kernel_mqd_t = int
 rbx.platform.typedef.__kernel_off_t = long
 rbx.platform.typedef.__kernel_old_dev_t = uint
 rbx.platform.typedef.__kernel_old_gid_t = ushort
 rbx.platform.typedef.__kernel_old_time_t = long
 rbx.platform.typedef.__kernel_old_uid_t = ushort
 rbx.platform.typedef.__kernel_pid_t = int
 rbx.platform.typedef.__kernel_ptrdiff_t = long
 rbx.platform.typedef.__kernel_size_t = ulong
 rbx.platform.typedef.__kernel_ssize_t = long
 rbx.platform.typedef.__kernel_suseconds_t = long
 rbx.platform.typedef.__kernel_time64_t = long_long
 rbx.platform.typedef.__kernel_time_t = long
 rbx.platform.typedef.__kernel_timer_t = int
 rbx.platform.typedef.__kernel_uid16_t = ushort
 rbx.platform.typedef.__kernel_uid32_t = uint
 rbx.platform.typedef.__kernel_uid_t = uint
 rbx.platform.typedef.__kernel_ulong_t = ulong
 rbx.platform.typedef.__key_t = int
 rbx.platform.typedef.__loff_t = long
 rbx.platform.typedef.__mode_t = uint
@@ -38,11  73,14 @@ rbx.platform.typedef.__rusage_who_t = int
 rbx.platform.typedef.__sig_atomic_t = int
 rbx.platform.typedef.__socklen_t = uint
 rbx.platform.typedef.__ssize_t = long
 rbx.platform.typedef.__suseconds64_t = long
 rbx.platform.typedef.__suseconds_t = long
 rbx.platform.typedef.__syscall_slong_t = long
 rbx.platform.typedef.__syscall_ulong_t = ulong
 rbx.platform.typedef.__thrd_t = ulong
 rbx.platform.typedef.__time_t = long
 rbx.platform.typedef.__timer_t = pointer
 rbx.platform.typedef.__tss_t = uint
 rbx.platform.typedef.__u_char = uchar
 rbx.platform.typedef.__u_int = uint
 rbx.platform.typedef.__u_long = ulong
@@ -53,6  91,11 @@ rbx.platform.typedef.__uint16_t = ushort
 rbx.platform.typedef.__uint32_t = uint
 rbx.platform.typedef.__uint64_t = ulong
 rbx.platform.typedef.__uint8_t = uchar
 rbx.platform.typedef.__uint_least16_t = ushort
 rbx.platform.typedef.__uint_least32_t = uint
 rbx.platform.typedef.__uint_least64_t = ulong
 rbx.platform.typedef.__uint_least8_t = uchar
 rbx.platform.typedef.__uintmax_t = ulong
 rbx.platform.typedef.__useconds_t = uint
 rbx.platform.typedef.blkcnt_t = long
 rbx.platform.typedef.blksize_t = int
@@ -65,11  108,23 @@ rbx.platform.typedef.fsblkcnt_t = ulong
 rbx.platform.typedef.fsfilcnt_t = ulong
 rbx.platform.typedef.gid_t = uint
 rbx.platform.typedef.id_t = uint
 rbx.platform.typedef.in_addr_t = uint
 rbx.platform.typedef.in_port_t = ushortin the machine
 rbx.platform.typedef.ino_t = ulong
 rbx.platform.typedef.int16_t = short
 rbx.platform.typedef.int32_t = int
-rbx.platform.typedef.int64_t = long_long
 rbx.platform.typedef.int64_t = long
 rbx.platform.typedef.int8_t = char
 rbx.platform.typedef.int_fast16_t = long
 rbx.platform.typedef.int_fast32_t = long
 rbx.platform.typedef.int_fast64_t = long
 rbx.platform.typedef.int_fast8_t = char
 rbx.platform.typedef.int_least16_t = short
 rbx.platform.typedef.int_least32_t = int
 rbx.platform.typedef.int_least64_t = long
 rbx.platform.typedef.int_least8_t = char
 rbx.platform.typedef.intmax_t = long
 rbx.platform.typedef.intptr_t = long
 rbx.platform.typedef.key_t = int
 rbx.platform.typedef.loff_t = long
 rbx.platform.typedef.mode_t = uint
@@ -79,6  134,7 @@ rbx.platform.typedef.pid_t = int
 rbx.platform.typedef.pthread_key_t = uint
 rbx.platform.typedef.pthread_once_t = int
 rbx.platform.typedef.pthread_t = ulong
 rbx.platform.typedef.ptrdiff_t = long
 rbx.platform.typedef.quad_t = long
 rbx.platform.typedef.register_t = long
 rbx.platform.typedef.rlim_t = ulong
@@ -93,12  149,27 @@ rbx.platform.typedef.u_char = uchar
 rbx.platform.typedef.u_int = uint
 rbx.platform.typedef.u_int16_t = ushort
 rbx.platform.typedef.u_int32_t = uint
-rbx.platform.typedef.u_int64_t = ulong_long
 rbx.platform.typedef.u_int64_t = ulong
 rbx.platform.typedef.u_int8_t = uchar
 rbx.platform.typedef.u_long = ulong
 rbx.platform.typedef.u_quad_t = ulong
 rbx.platform.typedef.u_short = ushort
 rbx.platform.typedef.uid_t = uint
 rbx.platform.typedef.uint = uint
 rbx.platform.typedef.uint16_t = ushort
 rbx.platform.typedef.uint32_t = uint
 rbx.platform.typedef.uint64_t = ulong
 rbx.platform.typedef.uint8_t = uchar
 rbx.platform.typedef.uint_fast16_t = ulong
 rbx.platform.typedef.uint_fast32_t = ulong
 rbx.platform.typedef.uint_fast64_t = ulong
 rbx.platform.typedef.uint_fast8_t = uchar
 rbx.platform.typedef.uint_least16_t = ushort
 rbx.platform.typedef.uint_least32_t = uint
 rbx.platform.typedef.uint_least64_t = ulong
 rbx.platform.typedef.uint_least8_t = uchar
 rbx.platform.typedef.uintmax_t = ulong
 rbx.platform.typedef.uintptr_t = ulong
 rbx.platform.typedef.ulong = ulong
 rbx.platform.typedef.ushort = ushort
 rbx.platform.typedef.wchar_t = uint

I ran the rake task on current master branch.

Any inputs on how to go about solving this?

@derickhoganpimenta
Copy link

derickhoganpimenta commented Dec 17, 2023

Same here, @goromlagche

@chulkilee
Copy link

chulkilee commented Dec 29, 2023

I'm using ruby:3.0.6-slim-bullseye image for arm64 and hitting this issue when running it, not installing gems

  • ffi: 1.16.3
  • karafka-rdkafka: 0.14.1

stacktrace

TypeError: unable to resolve type 'uint8_t'
/usr/local/bundle/gems/ffi-1.16.3/lib/ffi/types.rb:93:in `find_type'
/usr/local/bundle/gems/ffi-1.16.3/lib/ffi/library.rb:535:in `find_type'
/usr/local/bundle/gems/ffi-1.16.3/lib/ffi/struct.rb:278:in `find_type'
/usr/local/bundle/gems/ffi-1.16.3/lib/ffi/struct.rb:272:in `find_field_type'
/usr/local/bundle/gems/ffi-1.16.3/lib/ffi/struct.rb:312:in `array_layout'
/usr/local/bundle/gems/ffi-1.16.3/lib/ffi/struct.rb:218:in `layout'
/usr/local/bundle/gems/karafka-rdkafka-0.14.1/lib/rdkafka/bindings.rb:455:in `<class:NativeError>'
/usr/local/bundle/gems/karafka-rdkafka-0.14.1/lib/rdkafka/bindings.rb:454:in `<module:Bindings>'
/usr/local/bundle/gems/karafka-rdkafka-0.14.1/lib/rdkafka/bindings.rb:14:in `<module:Rdkafka>'
/usr/local/bundle/gems/karafka-rdkafka-0.14.1/lib/rdkafka/bindings.rb:3:in `<main>'

=> karafka/karafka-rdkafka#54 - so upgrading karafka-rdkafka worked for me.

larskanis added a commit to larskanis/ffi that referenced this issue Dec 30, 2023
larskanis added a commit that referenced this issue Jan 31, 2024
It was introduced by using the diff in #1066, but for some reason there was some garbage there.
This is newly generated by "rake types_conf" on Debian on aarch64/v8.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants