Skip to content

gcc 6/7/8 fails to compile c++ program, gcc49 works #238

Closed

Description

@zhiwenzheng

/opt/local/gcc6/bin/g++ /tmp/quick_exit.cc
In file included from /opt/local/gcc6/include/c++/ext/string_conversions.h:41:0,
from /opt/local/gcc6/include/c++/bits/basic_string.h:5429,
from /opt/local/gcc6/include/c++/string:52,
from /opt/local/gcc6/include/c++/bits/locale_classes.h:40,
from /opt/local/gcc6/include/c++/bits/ios_base.h:41,
from /opt/local/gcc6/include/c++/ios:42,
from /opt/local/gcc6/include/c++/ostream:38,
from /opt/local/gcc6/include/c++/iostream:39,
from /tmp/quick_exit.cc:1:
/opt/local/gcc6/include/c++/cstdlib:132:11: error: '::at_quick_exit' has not been declared
using ::at_quick_exit;
^~~~~~~~~~~~~
/opt/local/gcc6/include/c++/cstdlib:155:11: error: '::quick_exit' has not been declared
using ::quick_exit;
^~~~~~~~~~

/tmp/quick_exit.cc

#include <iostream>
#include <cstdlib>
using namespace std;
void quick_exit1()
{
	cout << "Exit Function 1" << endl;
}
void quick_exit2()
{
	cout << "Exit Function 2" << endl;
}
int main()
{
	/* registering function */
	at_quick_exit(quick_exit1);
	at_quick_exit(quick_exit2);
	quick_exit(0);
	return 0;
}

Activity

  1. zhiwenzheng commented on Dec 22, 2019

    @zhiwenzheng
    Author

    using the latest repo.

  2. added a commit that references this issue on Jan 3, 2020
  3. timfoster commented on Jan 20, 2020

    @timfoster

    I ran into this problem trying to build Node.js v8.16.1 on a SmartOS build built from

     { "repo": "illumos-joyent", "branch": "release-20170105", "rev": "39356c1d4443c2428f28abe318c71c6ebb2ed256", "commit_date": "1483531824", "url": "/root/data/jenkins/workspace/platform/MG/build/illumos-joyent" }
    

    The error I hit was:

    /opt/local/gcc7/bin/g++ '-DV8_GYP_BUILD' '-DV8_TARGET_ARCH_X64' '-D__C99FEATURES__=1' '-DENABLE_DISASSEMBLER' '-DV8_PROMISE_INTERNAL_FIELD_COUNT' '-Dv8_promise_internal_field_count' '-DV8_INTL_SUPPORT' -I../deps/v8 -I../deps/v8/include  -Wall -Wextra -Wno-unused-parameter -m64 -pthreads -fno-strict-aliasing -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++0x -MMD -MF /root/data/jenkins/workspace/sdcnode-minimal-x86_64-19.4.0-EXPERIMENTAL/build/nodes/v8.16.1-gz/src/out/Release/.deps//root/data/jenkins/workspace/sdcnode-minimal-x86_64-19.4.0-EXPERIMENTAL/build/nodes/v8.16.1-gz/src/out/Release/obj.target/v8_builtins_setup/deps/v8/src/setup-isolate-full.o.d.raw  -fno-aggressive-loop-optimizations -c -o /root/data/jenkins/workspace/sdcnode-minimal-x86_64-19.4.0-EXPERIMENTAL/build/nodes/v8.16.1-gz/src/out/Release/obj.target/v8_builtins_setup/deps/v8/src/setup-isolate-full.o ../deps/v8/src/setup-isolate-full.cc
      LD_LIBRARY_PATH=/root/data/jenkins/workspace/sdcnode-minimal-x86_64-19.4.0-EXPERIMENTAL/build/nodes/v8.16.1-gz/src/out/Release/lib.host:/root/data/jenkins/workspace/sdcnode-minimal-x86_64-19.4.0-EXPERIMENTAL/build/nodes/v8.16.1-gz/src/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../deps/v8/src; mkdir -p /root/data/jenkins/workspace/sdcnode-minimal-x86_64-19.4.0-EXPERIMENTAL/build/nodes/v8.16.1-gz/src/out/Release/obj/gen; python ../tools/js2c.py "/root/data/jenkins/workspace/sdcnode-minimal-x86_64-19.4.0-EXPERIMENTAL/build/nodes/v8.16.1-gz/src/out/Release/obj/gen/libraries.cc" CORE js/macros.py messages.h js/prologue.js js/max-min.js js/v8natives.js js/array.js js/string.js js/typedarray.js js/weak-collection.js js/messages.js js/templates.js js/spread.js js/proxy.js debug/mirrors.js debug/debug.js debug/liveedit.js js/intl.js
    In file included from /opt/local/gcc7/include/c++/ext/string_conversions.h:41:0,
                     from /opt/local/gcc7/include/c++/bits/basic_string.h:6361,
                     from /opt/local/gcc7/include/c++/string:52,
                     from /opt/local/gcc7/include/c++/bits/locale_classes.h:40,
                     from /opt/local/gcc7/include/c++/bits/ios_base.h:41,
                     from /opt/local/gcc7/include/c++/ios:42,
                     from /opt/local/gcc7/include/c++/istream:38,
                     from /opt/local/gcc7/include/c++/sstream:38,
                     from ../deps/v8/src/base/logging.h:9,
                     from ../deps/v8/src/setup-isolate-full.cc:7:
    /opt/local/gcc7/include/c++/cstdlib:137:11: error: '::at_quick_exit' has not been declared
       using ::at_quick_exit;
               ^~~~~~~~~~~~~
    /opt/local/gcc7/include/c++/cstdlib:160:11: error: '::quick_exit' has not been declared
       using ::quick_exit;
               ^~~~~~~~~~
    make[2]: *** [deps/v8/src/v8_builtins_setup.target.mk:94: /root/data/jenkins/workspace/sdcnode-minimal-x86_64-19.4.0-EXPERIMENTAL/build/nodes/v8.16.1-gz/src/out/Release/obj.target/v8_builtins_setup/deps/v8/src/setup-isolate-full.o] Error 1
    make[2]: *** Waiting for unfinished jobs....
    rm 5be8145455ecfa84b72c21d905ad85df6824320c.intermediate
    make[1]: *** [Makefile:88: node] Error 2
    make[1]: Leaving directory '/root/data/jenkins/workspace/sdcnode-minimal-x86_64-19.4.0-EXPERIMENTAL/build/nodes/v8.16.1-gz/src'
    gmake: *** [Makefile:47: nodes] Error 2
    Build step 'Execute shell' marked build as failure
    Finished: FAILURE
    

    Notably, the platform build I was compiling on included:

    commit fc2512cfb727d49529d8ed99164db871f4829b73
    Author: Robert Mustacchi <[email protected]>
    Date:   Mon Mar 28 19:43:25 2016 -0700
    
        6951 Initial c11 support
        6952 gets should not be visible in C11
        6953 add support for c11 threads api
        6954 Symbols test should support validating pre-processor symbols
        Reviewed by: Josef 'Jeff' Sipek <[email protected]>
        Reviewed by: Dan McDonald <[email protected]>
        Reviewed by: Garrett D'Amore <[email protected]>
        Approved by: Garrett D'Amore <[email protected]>
    

    but did not include the fix for

    commit 0df48811699b83d09c552548effcb1718d6ff1d0
    Author: Aurélien Larcher <[email protected]>
    Date:   Mon May 21 18:35:40 2018 +0200
    
        9545 Global visibility of C11 functions in C++11 and C++17 in stdlib.h
        Reviewed by: Igor Kozhukhov <[email protected]>
        Reviewed by: Andy Fiddaman <[email protected]>
        Reviewed by: Robert Mustacchi <[email protected]>
        Approved by: Gordon Ross <[email protected]>
    

    which I believe we need. Building on a newer SmartOS build (from 20200117T180335Z) which did include that fix did not hit the compilation problem.

  4. zhiwenzheng commented on Feb 17, 2020

    @zhiwenzheng
    Author

    I confirm applying " 9545 Global visibility of C11 functions in C++11 and C++17 in stdlib.h" solved the problem.

  5. added a commit that references this issue on May 10, 2020
  6. added a commit that references this issue on Jul 23, 2020
  7. added a commit that references this issue on Oct 9, 2020
  8. added a commit that references this issue on Oct 19, 2020
  9. added a commit that references this issue on Apr 22, 2021
  10. added a commit that references this issue on Jun 4, 2021
  11. added a commit that references this issue on Feb 21, 2022
  12. 85 remaining items

  13. added a commit that references this issue on May 14, 2026
  14. added a commit that references this issue on Jun 1, 2026
  15. added a commit that references this issue on Aug 2, 2026
  16. added a commit that references this issue on Aug 25, 2026
  17. added a commit that references this issue on Aug 30, 2026
  18. added a commit that references this issue on Nov 24, 2026
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