Doesn't compile after updating to 3.1.31

34 views
Skip to first unread message

Tibor Kovács

unread,
Feb 9, 2023, 10:27:37 AM2/9/23
to emscripten-discuss
Hi all,

I have several problems with the 3.1.31 compiler. I made a CMake for a project and with the 3.1.13 it compiled properly. Now I updated to 3.1.31 and it doesn't work anymore. I try to compile it in Debug mode with the next DEBUG definitions (this is a static library):

set(DEBUG_DEFINITIONS
    _LIBCPP_DEBUG=1
    _DEBUG
    CMAKE_BUILD
)

and the DEBUG_DEFINITIONS are added like this:

target_compile_definitions(${LIBRARY_NAME}
    PRIVATE
        "$<$<CONFIG:DEBUG>:${DEBUG_DEFINITIONS}>"
)

Previously it worked but now I have this error message:

/mnt/c/Works/Dev/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/__debug:24:5: error: "Enabling the debug mode now requires having configured the library with support for the debug mode"
# error "Enabling the debug mode now requires having configured the library with support for the debug mode"
    ^
1 error generated.

It doesn't stop here. If I compile it in Release mode, I'll have this error messages: error: reference to 'unordered_map' is ambiguous. AFAIK this error message would be generated if the compiler doesn't know the C++ version. But I specified it like this:

target_compile_options(${LIBRARY_NAME}
    PRIVATE
        -std=c++2a
        -fwasm-exceptions
        -pthread
)

What could be the solution for these errors?
Thank you in advance the helps.

Tibor

Sam Clegg

unread,
Feb 9, 2023, 12:31:25 PM2/9/23
to emscripte...@googlegroups.com
On Thu, Feb 9, 2023 at 7:27 AM Tibor Kovács <tiberi...@gmail.com> wrote:
Hi all,

I have several problems with the 3.1.31 compiler. I made a CMake for a project and with the 3.1.13 it compiled properly. Now I updated to 3.1.31 and it doesn't work anymore. I try to compile it in Debug mode with the next DEBUG definitions (this is a static library):

set(DEBUG_DEFINITIONS
    _LIBCPP_DEBUG=1
    _DEBUG
    CMAKE_BUILD
)

and the DEBUG_DEFINITIONS are added like this:

target_compile_definitions(${LIBRARY_NAME}
    PRIVATE
        "$<$<CONFIG:DEBUG>:${DEBUG_DEFINITIONS}>"
)

Previously it worked but now I have this error message:

/mnt/c/Works/Dev/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/__debug:24:5: error: "Enabling the debug mode now requires having configured the library with support for the debug mode"
# error "Enabling the debug mode now requires having configured the library with support for the debug mode"
    ^
1 error generated.

That looks like libc++ is warning you that you are using a legacy macro:

 // Catch invalid uses of the legacy _LIBCPP_DEBUG toggle.                        
#if defined(_LIBCPP_DEBUG) && _LIBCPP_DEBUG != 0 && !defined(_LIBCPP_ENABLE_DEBUG_MODE)

#   error "Enabling the debug mode now requires having configured the library with support for the debug mode"
#endif  

It looks like you are expected to define _LIBCPP_ENABLE_DEBUG_MODE.   I'm not sure what either of those macros do, but they are not specific to emscripten, and apply to libc++ in general.
 


It doesn't stop here. If I compile it in Release mode, I'll have this error messages: error: reference to 'unordered_map' is ambiguous. AFAIK this error message would be generated if the compiler doesn't know the C++ version. But I specified it like this:

target_compile_options(${LIBRARY_NAME}
    PRIVATE
        -std=c++2a
        -fwasm-exceptions
        -pthread
)

What could be the solution for these errors?
Thank you in advance the helps.


Can you share the full error message?  And even better a piece of sample code that generates it?   I imagine this is another generic libc++ issue and not emscripten-specific.

cheers,
sam

Tibor Kovács

unread,
Feb 10, 2023, 3:13:45 AM2/10/23
to emscripte...@googlegroups.com
Hi Sam,

Thanks for your reply. The Debug error message disappeared, big thanks for this!

The ambiguous error message looks like this:
The code section:
Face *clone(const vertex_t *old_base, vertex_t *new_base, std::unordered_map<const edge_t *, edge_t *> &edge_map) const;
This is from Carve.
The full error message is this:

In file included from /mnt/c/Works/Dev/wasm/3rdParty/Carve/src/convex_hull.cpp:22:
In file included from /mnt/c/Works/Dev/wasm/3rdParty/Carve/include/carve/csg.hpp:28:
/mnt/c/Works/Dev/wasm/3rdParty/Carve/include/carve/mesh.hpp:412:70: error: reference to 'unordered_map' is ambiguous
      Face *clone(const vertex_t *old_base, vertex_t *new_base, std::unordered_map<const edge_t *, edge_t *> &edge_map) const;
                                                                     ^
/mnt/c/Works/Dev/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/unordered_map:1028:28: note: candidate found by name lookup is 'std::__2::unordered_map'
class _LIBCPP_TEMPLATE_VIS unordered_map
                           ^
/mnt/c/Works/Dev/wasm/3rdParty/Carve/include/carve/collection/unordered/fallback_impl.hpp:26:9: note: candidate found by name lookup is 'std::unordered_map'
  class unordered_map : public std::map<K, T> {
        ^


--
You received this message because you are subscribed to a topic in the Google Groups "emscripten-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/emscripten-discuss/JAjo2Y3N1UQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to emscripten-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAL_va29CMBO65yvAo_XZSyS4pNWv-x%2B%3DFFWdCfVB_Ryasg4iQA%40mail.gmail.com.

Sam Clegg

unread,
Feb 10, 2023, 11:18:13 AM2/10/23
to emscripte...@googlegroups.com
On Fri, Feb 10, 2023 at 12:13 AM Tibor Kovács <tiberi...@gmail.com> wrote:
Hi Sam,

Thanks for your reply. The Debug error message disappeared, big thanks for this!

The ambiguous error message looks like this:
The code section:
Face *clone(const vertex_t *old_base, vertex_t *new_base, std::unordered_map<const edge_t *, edge_t *> &edge_map) const;
This is from Carve.
The full error message is this:

In file included from /mnt/c/Works/Dev/wasm/3rdParty/Carve/src/convex_hull.cpp:22:
In file included from /mnt/c/Works/Dev/wasm/3rdParty/Carve/include/carve/csg.hpp:28:
/mnt/c/Works/Dev/wasm/3rdParty/Carve/include/carve/mesh.hpp:412:70: error: reference to 'unordered_map' is ambiguous
      Face *clone(const vertex_t *old_base, vertex_t *new_base, std::unordered_map<const edge_t *, edge_t *> &edge_map) const;
                                                                     ^
/mnt/c/Works/Dev/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/unordered_map:1028:28: note: candidate found by name lookup is 'std::__2::unordered_map'
class _LIBCPP_TEMPLATE_VIS unordered_map
                           ^
/mnt/c/Works/Dev/wasm/3rdParty/Carve/include/carve/collection/unordered/fallback_impl.hpp:26:9: note: candidate found by name lookup is 'std::unordered_map'
  class unordered_map : public std::map<K, T> {
 
        ^


Looks like some kind of configuration issue where you are including both C++'s `std::unordered_map` as well as some kind of pollyfil for it fallback_impl.hpp.  When they are both included they (unsurprisingly) colide with each other.

Is `fallback_impl.hpp` being included in my mistake?  Was it included in previous builds where this was working (try going back to your working configuration and adding a #error to `fallback_impl.hpp`)?

I imagine some kind of change to libc++ could have triggered this but there is probably some local change to your project that will fix it.


You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAJTUF4-jVKSnNXExYq8xW-pLSbRrufZWEMKnFV5T7yN%3DWRpQPg%40mail.gmail.com.

Tibor Kovács

unread,
Feb 13, 2023, 3:26:46 AM2/13/23
to emscripte...@googlegroups.com
Thanks for the answer.
This is a 3rd party library, called Carve. I was able to compile it in Visual Studio and with the em++ 3.1.13. I'm not sure that I need to change something in that code. In Visual Studio I have these options: -I"C:\Works\Dev\Carve-master\emscripten\\..\include" -g -D"_LIBCPP_DEBUG=1" -D"_DEBUG" -std=c++2a and it worked. Now I have to make a CMake for this and it worked with the mentioned compiler but the 3.1.31 it's not..

Tibor Kovács

unread,
Feb 20, 2023, 7:59:33 AM2/20/23
to emscripte...@googlegroups.com
I can send this lib. I still not found anything.
Carve.zip

Sam Clegg

unread,
Feb 22, 2023, 10:47:27 AM2/22/23
to emscripte...@googlegroups.com
Looking at the file `include/carve/collection/unordered.hpp` it looks like either `HAVE_STD_UNORDERED_COLLECTIONS` or maybe `HAVE_LIBSTDCPP_UNORDERED_COLLECTIONS` should be defined, and that you don't ever want to include the fallback (at least not with emscripten).

My advice would be to go back to your working version of emscripten and see which of those macros is getting defined, then try to figure out why its no longer being defined with the new version of emscripten.    I guess those macros get automatically defined by some kind of configure process or are then hardcoded?

Reply all
Reply to author
Forward
0 new messages