Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#53401 closed defect (fixed)

nodejs4 @4.7.2: error: no member named 'tr1' in namespace 'std'

Reported by: papachoco (Carlos Sanchez) Owned by: ci42
Priority: Normal Milestone:
Component: ports Version: 2.3.5
Keywords: Cc: breiter (Brian Reiter), tehcog (tehcog), lesinigo (Luca Lesinigo), gerritgriebel (Gerrit Griebel), detlevd (Detlev Droege), aldaris (Peter Major), rubendibattista (Ruben Di Battista), ajdalshov (Anders Johan Dalshov), dbl001 (dbl), craftey, dgaffuri, davidchambers (David Chambers), Superlokkus (Markus Klemm), mojca (Mojca Miklavec), Smoobly (Smoobly Renfrew), kpreid (Kevin Reid), ryandesign (Ryan Carsten Schmidt)
Port: nodejs4

Description (last modified by jmroot (Joshua Root))

I am getting the exception below while trying to upgrade to node4j .7.2

-I../deps/gtest/include -I../deps/v8/include -I../src -I/opt/local/include -I/opt/local/include/openssl  -Os -gdwarf-2 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -std=gnu++0x -fno-rtti -fno-exceptions -fno-threadsafe-statics -fno-strict-aliasing -MMD -MF /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_nodejs4/nodejs4/work/node-v4.7.2/out/Release/.deps//opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_nodejs4/nodejs4/work/node-v4.7.2/out/Release/obj.target/cctest/test/cctest/util.o.d.raw  -Os -c -o /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_nodejs4/nodejs4/work/node-v4.7.2/out/Release/obj.target/cctest/test/cctest/util.o ../test/cctest/util.cc
:info:build In file included from ../test/cctest/util.cc:1:
:info:build ../src/util.h:27:53: error: no member named 'tr1' in namespace 'std'
:info:build template <typename T> using remove_reference = std::tr1::remove_reference<T>;
:info:build                                                ~~~~~^
:info:build ../src/util.h:27:74: error: expected ';' after alias declaration
:info:build template <typename T> using remove_reference = std::tr1::remove_reference<T>;
:info:build                                                                          ^
:info:build                      

Attachments (1)

main.log (4.7 MB) - added by papachoco (Carlos Sanchez) 8 years ago.

Change History (27)

Changed 8 years ago by papachoco (Carlos Sanchez)

Attachment: main.log added

comment:1 Changed 8 years ago by jmroot (Joshua Root)

Cc: ci42 removed
Description: modified (diff)
Keywords: compile error removed
Owner: set to ci42
Status: newassigned

comment:2 Changed 8 years ago by breiter (Brian Reiter)

Cc: breiter added

comment:3 Changed 8 years ago by breiter (Brian Reiter)

node compiles and appears to work with the #ifdef __APPLE__ that references std::tr1:: removed.

//#ifdef __APPLE__
//template <typename T> using remove_reference = std::tr1::remove_reference<T>;
//#else
template <typename T> using remove_reference = std::remove_reference<T>;
//#endif

comment:4 Changed 8 years ago by tehcog (tehcog)

Cc: tehcog added

comment:5 Changed 8 years ago by lesinigo (Luca Lesinigo)

possible duplicate of #53418 ?

comment:6 Changed 8 years ago by lesinigo (Luca Lesinigo)

Cc: lesinigo added

comment:7 Changed 8 years ago by gerritgriebel (Gerrit Griebel)

Cc: gerritgriebel added

comment:8 Changed 8 years ago by detlevd (Detlev Droege)

Cc: detlevd added

comment:9 Changed 8 years ago by aldaris (Peter Major)

Cc: aldaris added

comment:10 Changed 8 years ago by maximumspatium (Maxim Poliakovski)

I'd like to confirm that the above mentioned fix (commenting out

#ifdef __APPLE__

and

std::tr1:: remove_reference<T>

does work for me too. Thank you very much!

Last edited 8 years ago by maximumspatium (Maxim Poliakovski) (previous) (diff)

comment:11 Changed 8 years ago by rubendibattista (Ruben Di Battista)

Cc: rubendibattista added

comment:12 Changed 8 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ajdalshov dbl001 added

Has duplicates #53418, #53454.

Commenting out the tr1 references would presumably cause the port fail to build with libstdc++ (i.e. OS X 10.8 and earlier) so that's not a suitable general-purpose fix.

comment:13 Changed 8 years ago by craftey

Cc: craftey added

comment:14 Changed 8 years ago by dgaffuri

Cc: dgaffuri added

comment:15 in reply to:  12 ; Changed 8 years ago by juliangilbey (Julian Gilbey)

Replying to ryandesign:

Has duplicates #53418, #53454.

Commenting out the tr1 references would presumably cause the port fail to build with libstdc++ (i.e. OS X 10.8 and earlier) so that's not a suitable general-purpose fix.

There is currently a partial patch for this issue already in the Portfile; it is only used on macOS Sierra and beyond:

if {${os.major} > 12} {
    patchfiles-append   patch-src-util.h.diff
}

So all that needs doing is for patch-src-util.h.diff to be extended to cover this additional part of the header file, and it will work on macOS Sierra, and not touch earlier OS X versions.

Last edited 8 years ago by juliangilbey (Julian Gilbey) (previous) (diff)

comment:16 Changed 8 years ago by davidchambers (David Chambers)

Cc: davidchambers added

comment:17 in reply to:  15 Changed 8 years ago by cypherpunk1

Replying to juliangilbey:

So all that needs doing is for patch-src-util.h.diff to be extended to cover this additional part of the header file, and it will work on macOS Sierra, and not touch earlier OS X versions.

Previous discussion of that patch here https://lists.macports.org/pipermail/macports-dev/2016-October/033949.html

I encountered this issue while compiling on OS X El Capitan (Darwin 15.6) and on macos Sierra (Darwin 16.4), so I hope the final correct patch will cover both versions.

As mentioned in comment 3 and 10, editing /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macps.org_release_tarballs_ports_devel_nodejs4/nodejs4/work/node-v4.7.2/src/util.h is a working hack on both OS versions.

Last edited 8 years ago by cypherpunk1 (previous) (diff)

comment:18 Changed 8 years ago by Superlokkus (Markus Klemm)

Cc: Superlokkus added

comment:19 Changed 8 years ago by mojca (Mojca Miklavec)

Cc: mojca added

comment:20 Changed 8 years ago by mojca (Mojca Miklavec)

Version 6 uses an "equally inappropriate" syntax:

// OSX 10.9 defaults to libc++ which provides a C++11 <type_traits> header.
#if defined(__APPLE__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1090
#define USE_TR1_TYPE_TRAITS
#endif

#ifdef USE_TR1_TYPE_TRAITS
#include <tr1/type_traits>  // NOLINT(build/c++tr1)
#else
#include <type_traits>  // std::remove_reference
#endif

comment:21 in reply to:  15 Changed 8 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: Smoobly kpreid added

Has duplicates #53448 and #53540.

Replying to juliangilbey:

There is currently a partial patch for this issue already in the Portfile; it is only used on macOS Sierra and beyond:

if {${os.major} > 12} {
    patchfiles-append   patch-src-util.h.diff
}

So all that needs doing is for patch-src-util.h.diff to be extended to cover this additional part of the header file, and it will work on macOS Sierra, and not touch earlier OS X versions.

Darwin 12 is Mountain Lion, so this patch currently applies on OS versions later than Mountain Lion -- which is to say, OS versions that default to libc++ (which doesn't have tr1 anymore) instead of libstdc++ (which still does). So in addition to whatever change is needed to resolve this ticket, this condition should presumably be changed to not rely on the OS version but on the value of the configure.cxx_stdlib variable.

comment:22 Changed 8 years ago by ryandesign (Ryan Carsten Schmidt)

Summary: Error building nodejs4 4.7.2nodejs4 @4.7.2: error: no member named 'tr1' in namespace 'std'

comment:23 Changed 8 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign added
Summary: nodejs4 @4.7.2: error: no member named 'tr1' in namespace 'std'nodejs4 @4.7.2: error: no member named 'tr1' in namespace 'std'

I'm testing a fix now.

comment:24 Changed 8 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: assignedclosed

In 5ea23e31/macports-ports:

nodejs4: Fix build with libc++

nodejs4 originally assumed all versions of macOS use tr1. This is not
true with libc++, which is the default on Mavericks and later.

The original patch was conditionally applied on Mavericks and later. It
removed the use of tr1 in one place, but not in another place, so the
build failed on Mavericks and later, and presumably on earlier systems
configured to use libc++.

nodejs6 contains preprocessor directives that avoids using tr1 on
Mavericks and later. This would presumably still fail on earlier systems
configured to use libc++.

This new patch avoids tr1 when libc++ is in use, regardless of macOS
version, and is unconditionally applied.

Closes: #53401

comment:25 Changed 8 years ago by mojca (Mojca Miklavec)

Ryan, we should submit something upstream, also for nodejs6. But I suspect this patch would cause problems if compiling with the latest gcc (or am I wrong?).

I tried to remember where I saw that code, I think it was wxWidgets, I'll check how they solved it.

comment:26 Changed 8 years ago by ryandesign (Ryan Carsten Schmidt)

I do think it would be a good idea to make equivalent changes to nodejs6, to support LibcxxOnOlderSystems. I don't have such a system set up to test on so I can't definitely verify that there is a problem or that my proposal fixes it, but I think there is and that it does.

I'm not sure that upstream cares about nodejs4 anymore. We could submit our patch for nodejs6 to upstream, but it won't be relevant for nodejs7 anymore since that requires libc++.

I don't care what happens when using FSF GCC to compile this, because that's not something we do in MacPorts.

Note: See TracTickets for help on using tickets.