Coder Social home page Coder Social logo

Comments (6)

rui314 avatar rui314 commented on July 18, 2024

Thank you for reporting! I don't have gcc-11, but I believe the above change fixes the issue.

from mold.

lancethepants avatar lancethepants commented on July 18, 2024

Thanks! Well since the issue is still open, I think these are all the remaining issues with GCC11. I did make -j50 and this is what remains. I do really have interest in compilers and linkers, but limited c/c++ knowledge. Looks like more semantic trivial gcc-isms from the looks of it.

g++  -g -IoneTBB/include -IxxHash -pthread -std=c++20 -Wno-deprecated-volatile -Wno-switch -DGIT_HASH=\"99e836208a5f45cd41b572e51a29fdddd48f8b98\" -O2  -c -o subprocess.o subprocess.cc
subprocess.cc: In function ‘std::function<void()> fork_child()’:
subprocess.cc:33:34: error: taking address of temporary array
   33 |     if (read(pipefd[0], (char[1]){}, 1) == 1)
      |                                  ^~
subprocess.cc: In lambda function:
subprocess.cc:48:44: error: taking address of temporary array
   48 |   return [=]() { write(pipefd[1], (char []){1}, 1); };
      |                                            ^~~
subprocess.cc: In instantiation of ‘void try_resume_daemon(Context<E>&, char**) [with E = X86_64]’:
subprocess.cc:267:1:   required from here
subprocess.cc:156:15: error: taking address of temporary array
  156 |   i64 r = read(conn, (char[1]){}, 1);
      |           ~~~~^~~~~~~~~~~~~~~~~~~~~~
subprocess.cc: In instantiation of ‘void daemonize(Context<E>&, char**, std::function<void()>*, std::function<void()>*) [with E = X86_64]’:
subprocess.cc:267:1:   required from here
subprocess.cc:222:31: error: taking address of temporary array
  222 |   *on_complete = [=]() { write(conn, (char []){1}, 1); };
      |                          ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
subprocess.cc: In instantiation of ‘void try_resume_daemon(Context<E>&, char**) [with E = I386]’:
subprocess.cc:268:1:   required from here
subprocess.cc:156:15: error: taking address of temporary array
  156 |   i64 r = read(conn, (char[1]){}, 1);
      |           ~~~~^~~~~~~~~~~~~~~~~~~~~~
subprocess.cc: In instantiation of ‘void daemonize(Context<E>&, char**, std::function<void()>*, std::function<void()>*) [with E = I386]’:
subprocess.cc:268:1:   required from here
subprocess.cc:222:31: error: taking address of temporary array
  222 |   *on_complete = [=]() { write(conn, (char []){1}, 1); };
      |                          ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
subprocess.cc: In function ‘void process_run_subcommand(Context<E>&, int, char**) [with E = X86_64]’:
subprocess.cc:258:1: warning: ‘noreturn’ function does return
  258 | }
      | ^
subprocess.cc: In function ‘void process_run_subcommand(Context<E>&, int, char**) [with E = I386]’:
subprocess.cc:258:1: warning: ‘noreturn’ function does return
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-deprecated-volatile’ may have been intended to silence earlier diagnostics
make: *** [<builtin>: subprocess.o] Error 1

from mold.

rui314 avatar rui314 commented on July 18, 2024

In an attempt to use GCC 11, I tried Ubuntu 21, but it looks like GCC 11 is not available via apt. Did you install GCC 11 from source?

from mold.

lancethepants avatar lancethepants commented on July 18, 2024

Yes, I am using a toolchain compiled from source, so I do have to compile zlib and openssl mold's other dependencies as well. I can go to gcc10 if it's known to be better supported. I had compiled llvm12 but I then realized that the system libstdc++ that it was trying to link against is too old (Debian 10), and I did not compile libc++. When you use clang, is it just linking against the system's libstdc++ library? Now that I have gcc11 I can tell llvm12 to use its libraries, I'll try that. Just kind of nice to use 1 toolchain you know. Have you every compiled using libc++?

from mold.

rui314 avatar rui314 commented on July 18, 2024

My mold binary is linked against libstdc++ which I believe installed as a part of libstdc++6 package. I didn't build libstdc++ nor clang++ myself.

$ ldd mold
        linux-vdso.so.1 (0x00007fffedbb6000)
        libcrypto.so.1.1 => /lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007fe124a7c000)
        libtbb.so.2 => /home/ruiu/mold/oneTBB/build/linux_intel64_gcc_cc9.3.0_libc2.31_kernel5.10.0_release/libtbb.so.2 (0x00007fe124a34000)
        libmimalloc.so.1.7 => /home/ruiu/mold/mimalloc/out/release/libmimalloc.so.1.7 (0x00007fe1249fc000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fe1249e0000)
        libxxhash.so.0 => /home/ruiu/mold/xxHash/libxxhash.so.0 (0x00007fe1249d0000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fe1249c8000)
        libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fe1247e7000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fe124698000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fe12467d000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fe12465a000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe124468000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fe124d73000)

If you just want to use mold on your machine, you can build mold as a statically-linked executable. All you need to do is to build mold as make STATIC=1 on a Ubuntu 20 machine (in a docker environment or something).

from mold.

rui314 avatar rui314 commented on July 18, 2024

I made a few changes to make it compile with GCC 11.

from mold.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.