Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Simple Packet test code returning errno = 30  (Read 3181 times)

0 Members and 1 Guest are viewing this topic.

BananaBro_Chaos

  • Newbie
  • *
  • Posts: 10
    • View Profile
Simple Packet test code returning errno = 30
« on: September 15, 2024, 06:09:33 pm »
Basically, I wanted to test out Packets, so I copied and pasted some code on the tutorial into a test file. However, every time I ran the code, the error "ld: open() failed, errno=30 for 'test'" always appeared (test is the name of the file.)

I put the relevant code below:
#include <iostream>
#include "SFML/Network.hpp"
using namespace std;
using namespace sf;

int main(){
    UdpSocket socket;
       
    Uint16 x = 10;
    string s = "hello";
    double d = 0.6;
   
    Packet packet;
    packet << x << s << d;
   
    IpAddress recipientAddress = "192.168.0.5";
    unsigned short recipientPort = 10293;
   
    socket.send(packet, recipientAddress, recipientPort);
}
 

At the moment, I don't have code running to receive the file, but I expected that to be the error instead of what I have right now. After some researching, I found that errno = 30 means that it is a "Read-only file system", but that can't be the case since it worked when I tested the exact same file with only the Graphics library.

As for additional information, I am running the code on Xcode and using homebrew for SFML. My computer is a Mac with a Silicon M1 chip, and I run the code through terminal.

Please inform me if I need to add any more information/making rookie mistakes. I did already try restarting the computer, but it did nothing.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Simple Packet test code returning errno = 30
« Reply #1 on: September 15, 2024, 09:02:52 pm »
Given that it mentions ld, which is the linker, it also sounds like you've passed the source file as a library file instead of as source file, so it's not trying to compile it, but to link against it?

It might then fail to open it, because it's not a library file or because your editor/IDE is somehow locking it or the linker doesn't have enough permission to read from it.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

BananaBro_Chaos

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Simple Packet test code returning errno = 30
« Reply #2 on: September 16, 2024, 03:03:16 pm »
I don't think that is the case. The file itself works if I remove the Network module, and I've done testing on it with the Graphics module. If the Network module is simply included, the code fails with the error. The Network module is implemented in the same way as the Graphics module, so I'm confused why simply including it causes the error, even if I didn't include anything related to the module.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Simple Packet test code returning errno = 30
« Reply #3 on: September 16, 2024, 04:05:23 pm »
What's your full build command?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

BananaBro_Chaos

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Simple Packet test code returning errno = 30
« Reply #4 on: September 16, 2024, 05:26:26 pm »
What I input:
c++ ./users/<NAME>/Desktop/testytesty/testytesty/main.cpp -I/opt/homebrew/Cellar/sfml/2.6.1/include -o test -L/opt/homebrew/Cellar/sfml/2.6.1/lib -lsfml-graphics -lsfml-window -lsfml-system -lsfml-network

Output:
ld: open() failed, errno=30 for 'test'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Please tell me if this is not what you are looking for. Yes, I do have my test file in Desktop, that makes it easier to access in my opinion.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Simple Packet test code returning errno = 30
« Reply #5 on: September 16, 2024, 06:43:52 pm »
Ah so it fails when the linker tries to write the output executable, i.e. test.

Seems like the linker doesn't have access to wherever you're running this from.
Given that you specify ./users you seem to be in the root, which the linker very unlikely has access to.
Try to specifying a different output path.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

BananaBro_Chaos

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Simple Packet test code returning errno = 30
« Reply #6 on: September 17, 2024, 01:21:47 pm »
Yeah it worked, I ran it from my user and the problem is gone. Thanks!