Skip to content

bus error on ARM CPUs (i.MX6) with GCC 12.3.0 #1159

Closed

Description

@ChHapp

I have experienced a 'bus-error' with Yocto-Mickledore (gcc 12.3.0)
I am using the brotli lib with nodejs and when I run a simple compress/decompress example I get this 'bus-error'.

This is a generated example:

const zlib = require('zlib');
const inputString = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
const buffer = Buffer.from(inputString, 'utf-8');

// Compress the buffer using Brotli
zlib.brotliCompress(buffer, (err, compressedBuffer) => {
  if (err) {
    console.error('Error compressing data:', err);
    return;
  }
  
  // Convert compressed buffer to string
  const compressedString = compressedBuffer.toString('base64');  
  console.log('Compressed string:', compressedString);  
  // Decompress the compressed buffer to verify
  zlib.brotliDecompress(compressedBuffer, (err, decompressedBuffer) => {
    if (err) {
      console.error('Error decompressing data:', err);
      return;
    }    
    // Convert decompressed buffer back to string
    const decompressedString = decompressedBuffer.toString('utf-8');    
    console.log('Decompressed string:', decompressedString);
  });
});

I have figured out that if I add a bbappend with CFLAGS += " -Og" the 'libbrotlienc.so.1.0.9' works like a charm again.
Alternatively if I compile it with the GCC 11.2.0 (Yocto-Honister) it also works as expected.

I have also tried newer TAGs and the Git HEAD too, with no luck to getting it to work by using '-O2' as a C flag.

Are there any recommended C flags for this project? Yocto is uses '-O2' by default.
Is this a already known?

Activity

  1. jhofstee commented on Mar 29, 2025

    @jhofstee

    I think I encountered the same issue. Openembedded version is Scarthgap (gcc 13.3), brottli 1.1.0 on ARM. It is https://github.com/google/brotli/blob/v1.1.0/c/enc/histogram_inc.h#L47 causing the bus error. Adding -fno-strict-aliasing to the CFLAGS solves it.

  2. added a commit that references this issue on Apr 4, 2025
  3. added a commit that references this issue on Apr 9, 2025
  4. jhofstee commented on Apr 9, 2025

    @jhofstee

    @eustas or @ChHapp this should be fixed by nodejs/node#57727, so this issue can be closed.

  5. 8 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions