Why is my g++ screwed up?

cracauer@

Developer
This is on 16-current. Happens of two machines.

Code:
~(gonzo-tmp)1387% g++13 -o l l.cc && ./l
ld-elf.so.1: /usr/local/lib/gcc10/libstdc++.so.6: version GLIBCXX_3.4.32 required by /gonzo-space/home/cracauer/l not found
~(gonzo-tmp)1388% g++14 -o l l.cc && ./l
ld-elf.so.1: /usr/local/lib/gcc10/libstdc++.so.6: version GLIBCXX_3.4.32 required by /gonzo-space/home/cracauer/l not found

Why are they looking in the gcc10 directory?

gcc10 is the oldest gcc installed.

g++12 works.
 
C:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <sys/stat.h>

#define BUFFER_SIZE 256

int main(void) {
    // 1. Standard C Library buffered stream output
    printf("--- FreeBSD libc Demonstration ---\n");

    // Path to examine (FreeBSD OS release text file)
    const char *filepath = "/etc/os-release";
    
    // 2. Interacting via POSIX system call wrappers in libc
    struct stat file_stat;
    
    // stat() retrieves information about the file attributes
    if (stat(filepath, &file_stat) == -1) {
        // fprintf and strerror use libc error handling configurations
        fprintf(stderr, "Error checking file '%s': %s\n", filepath, strerror(errno));
        return EXIT_FAILURE;
    }

    printf("File size of %s: %ld bytes\n\n", filepath, (long)file_stat.st_size);

    // 3. Open the file descriptor using open()
    int fd = open(filepath, O_RDONLY);
    if (fd == -1) {
        fprintf(stderr, "Failed to open '%s': %s\n", filepath, strerror(errno));
        return EXIT_FAILURE;
    }

    printf("--- Content of %s ---\n", filepath);

    // 4. Low-level read loop bypassing stdio buffering
    char buffer[BUFFER_SIZE];
    ssize_t bytes_read;

    while ((bytes_read = read(fd, buffer, sizeof(buffer) - 1)) > 0) {
        // Null-terminate buffer before printing safely
        buffer[bytes_read] = '\0';
        
        // write() prints directly to standard output descriptor (1)
        if (write(STDOUT_FILENO, buffer, bytes_read) == -1) {
            fprintf(stderr, "Write error: %s\n", strerror(errno));
            close(fd);
            return EXIT_FAILURE;
        }
    }

    if (bytes_read == -1) {
        fprintf(stderr, "Read error: %s\n", strerror(errno));
    }

    // 5. Explicitly release resource descriptor
    close(fd);
    
    return EXIT_SUCCESS;
}
 
Code:
x@myfreebsd:/SSD/home/x/C $ g++13 sys_info.c -o sys_info -Wl,-t; ./sys_info
/usr/lib/crt1.o
/usr/lib/crti.o
/usr/local/lib/gcc13/gcc/x86_64-portbld-freebsd15.0/13.3.0/crtbegin.o
/home/x/tmp/cctEZslK.o
/usr/local/lib/gcc13/gcc/x86_64-portbld-freebsd15.0/13.3.0/../../../libstdc++.so
/usr/lib/libm.so
/usr/local/lib/gcc13/gcc/x86_64-portbld-freebsd15.0/13.3.0/../../../libgcc_s.so
/usr/local/lib/gcc13/gcc/x86_64-portbld-freebsd15.0/13.3.0/libgcc.a
/usr/lib/libc.so
/lib/libc.so.7
/usr/lib/libc_nonshared.a
/usr/lib/libc_nonshared.a
/usr/local/lib/gcc13/gcc/x86_64-portbld-freebsd15.0/13.3.0/../../../libgcc_s.so
/usr/local/lib/gcc13/gcc/x86_64-portbld-freebsd15.0/13.3.0/libgcc.a
/usr/local/lib/gcc13/gcc/x86_64-portbld-freebsd15.0/13.3.0/crtend.o
/usr/lib/crtn.o

Code:
--- FreeBSD libc Demonstration ---
File size of /etc/os-release: 238 bytes
--- Content of /etc/os-release ---
NAME=FreeBSD
VERSION="15.1-RELEASE-p3"
VERSION_ID="15.1"
ID=freebsd
ANSI_COLOR="0;31"
PRETTY_NAME="FreeBSD 15.1-RELEASE-p3"
CPE_NAME="cpe:/o:freebsd:freebsd:15.1"
HOME_URL="https://FreeBSD.org/"
BUG_REPORT_URL="https://bugs.FreeBSD.org/"
 
cat /var/run/ld-elf.so.hints | strings
Code:
/lib:/usr/lib:/usr/lib/compat:/usr/local/lib:/usr/local/lib/compat/pkg:/usr/local/ffmpeg3/lib:/usr/local/ffmpeg4/lib:/usr/local/glib-bootstrap/lib:/usr/local/gnat12/lib:/usr/local/gnat13/lib:/usr/local/gnat14/lib:/usr/local/lib/alsa-lib:/usr/local/lib/compat:/usr/local/lib/darktable:/usr/local/lib/e2fsprogs:/usr/local/lib/gambit-c:/usr/local/lib/gcc12:/usr/local/lib/gcc13:/usr/local/lib/gcc14:/usr/local/lib/mysql:/usr/local/lib/ollama:/usr/local/lib/ollama/vulkan:/usr/local/lib/perl5/5.42/mach/CORE:/usr/local/lib/pgtcl:/usr/local/lib/python3.12/site-packages/torch/lib:/usr/local/lib/qt5:/usr/local/lib/qt6:/usr/local/lib/samba4:/usr/local/lib/tcl9.0:/usr/local/llvm19/lib:/usr/local/llvm19/lib/x86_64-portbld-freebsd15.1:/usr/local/llvm20/lib:/usr/local/llvm20/lib/x86_64-portbld-freebsd15.0:/usr/local/llvm21/lib:/usr/local/llvm21/lib/x86_64-portbld-freebsd15.0:/usr/local/mpi/openmpi/lib:/usr/local/openjdk11/lib/server:/usr/local/openjdk8/lib/amd64:/usr/local/share/chromium
 
Back
Top