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

Broken on big-endian architectures #47

Open
hyperair opened this issue Feb 17, 2024 · 0 comments
Open

Broken on big-endian architectures #47

hyperair opened this issue Feb 17, 2024 · 0 comments

Comments

@hyperair
Copy link

hyperair commented Feb 17, 2024

The following tests fail in big-endian architectures:

The following tests FAILED:
	  1 - File transversal (Failed)
	  2 - Search for GCode blocks (Failed)
	  3 - Convert from binary to ascii (Failed)
	  4 - Convert from ascii to binary (Failed)

Downstream bug report in Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1062014

Some debugging reveals that this error happens due to mismatched endianness when reading data files.

diff --git a/src/LibBGCode/core/core.cpp b/src/LibBGCode/core/core.cpp
@@ -126,8 +127,10 @@ EResult FileHeader::read(FILE& file, const uint32_t* const max_version)
 {
     if (!read_from_file(file, &magic, sizeof(magic)))
         return EResult::ReadError;
+    printf("data=0x%08x MAGIC=0x%08x\n", magic, MAGICi32);
     if (magic != MAGICi32)
         return EResult::InvalidMagicNumber;

->

File:/build/libbgcode/tests/data/mini_cube_b.bgcode
data=0x47434445 MAGIC=0x45444347

It's likely that there are many more similar problems lurking in the source code.
If this issue can't be fixed, the package should probably be disabled on big endian architectures.

Sample build logs:

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

1 participant