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

socket2 doesn't compile on ubuntu #527

Open
Merrick17 opened this issue Aug 29, 2024 · 7 comments
Open

socket2 doesn't compile on ubuntu #527

Merrick17 opened this issue Aug 29, 2024 · 7 comments

Comments

@Merrick17
Copy link

when I try to compile I get this error
error[E0425]: cannot find function set_msghdr_controlin modulesys--> src/lib.rs:714:14 | 714 | sys::set_msghdr_control(&mut self.inner, buf.as_mut_ptr().cast(), buf.len()); | ^^^^^^^^^^^^^^^^^^ not found insys`

error[E0425]: cannot find function msghdr_flags in module sys
--> src/lib.rs:720:14
|
720 | sys::msghdr_flags(&self.inner)
| ^^^^^^^^^^^^ not found in sys

error[E0425]: cannot find function msghdr_control_len in module sys
--> src/lib.rs:729:14
|
729 | sys::msghdr_control_len(&self.inner)
| ^^^^^^^^^^^^^^^^^^ not found in `sys``

@Thomasdezeeuw
Copy link
Collaborator

Can you share the command you're using to build socket2?

Because the functions are very much defined:

socket2/src/sys/unix.rs

Lines 741 to 760 in 3a93893

#[cfg(not(target_os = "redox"))]
pub(crate) fn set_msghdr_control(msg: &mut msghdr, ptr: *mut libc::c_void, len: usize) {
msg.msg_control = ptr;
msg.msg_controllen = len as _;
}
#[cfg(not(target_os = "redox"))]
pub(crate) fn set_msghdr_flags(msg: &mut msghdr, flags: libc::c_int) {
msg.msg_flags = flags;
}
#[cfg(not(target_os = "redox"))]
pub(crate) fn msghdr_flags(msg: &msghdr) -> RecvFlags {
RecvFlags(msg.msg_flags)
}
#[cfg(not(target_os = "redox"))]
pub(crate) fn msghdr_control_len(msg: &msghdr) -> usize {
msg.msg_controllen as _
}
.

@Merrick17
Copy link
Author

sorry I guess I didn't make my self clear , okayb first issue I'm using orao vrf which has socket2 as a depencies, if I follow the correct error stack it starts from here
Compiling ring v0.17.8 Compiling socket2 v0.5.7 Compiling crunchy v0.2.2 Compiling digest v0.9.0 error[E0583]: file not found for modulesys--> src/lib.rs:179:1 | 179 | mod sys; | ^^^^^^^^ | = help: to create the modulesys, create file "/home/safouane/.cargo/registry/src/index.crates.io-6f17d22bba15001f/socket2-0.5.7/src/sys.rs" or "/home/safouane/.cargo/registry/src/index.crates.io-6f17d22bba15001f/socket2-0.5.7/src/sys/mod.rs" = note: if there is a mod syselsewhere in the crate already, import it withuse crate::...` instead

error: Socket2 doesn't support the compile target
--> src/lib.rs:182:1
|
182 | compile_error!("Socket2 doesn't support the compile target");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0432]: unresolved imports crate::sys::c_int, crate::sys::sa_family_t, crate::sys::sockaddr, crate::sys::sockaddr_in, crate::sys::sockaddr_in6, crate::sys::sockaddr_storage, crate::sys::socklen_t, crate::sys::AF_INET, crate::sys::AF_INET6, crate::sys::AF_UNIX
--> src/sockaddr.rs:11:5
|
11 | c_int, sa_family_t, sockaddr, sockaddr_in, sockaddr_in6, sockaddr_storage, socklen_t, AF_IN...
| ^^^^^ ^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^ ^^^^^^^ no AF_INET in sys
| | | | | | | |
| | | | | | | no socklen_t in sys
| | | | | | no sockaddr_storage in sys
| | | | | no sockaddr_in6 in sys
| | | | no sockaddr_in in sys
| | | no sockaddr in sys
| | no sa_family_t in sys
| no c_int in sys
12 | AF_INET6, AF_UNIX,
| ^^^^^^^^ ^^^^^^^ no AF_UNIX in sys
| |
| no AF_INET6 in sys
|
= help: consider importing one of these items instead:
std::ffi::c_int
std::os::raw::c_int
core::ffi::c_int
= help: consider importing this module instead:
crate::sockaddr
`

@Thomasdezeeuw
Copy link
Collaborator

I still need the command you're running, e.g. cargo build etc. If you are using a different target for example this might cause issues. This fact that you're hitting compile_error!("Socket2 doesn't support the compile target"); indicates your not compiling for Linux.

P.S. Can you put the output in between "```" (three backticks) on a separate line, that would make it more readable on GitHub.

@Merrick17
Copy link
Author

okay sorry ,
so basically what I'm doing is creating a solana/anchor program , I've added https://github.com/orao-network/solana-vrf which as it seems uses the socket2 as a dependency .
I've runned "Anchor build" to build the program but it fails as shown

@Thomasdezeeuw
Copy link
Collaborator

I still don't know what OS you're targeting... can you enable some kind of debug/verbose logging? At some point anchor build should call cargo or rustc, I'll like to know what kind of flags are passed. Specifically --target.

@Merrick17
Copy link
Author

image image

hopefully this helps , can't find anything else that I can help even with Anchor commands , I've already opend same issue with VRF library

@Thomasdezeeuw
Copy link
Collaborator

Thomasdezeeuw commented Aug 30, 2024

I don't what anchor or solana are, so I don't know how they are using socket2. I think it would best if you open a ticket with the anchor project, maybe they can help you better.

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

No branches or pull requests

2 participants