Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

templates must have C++ linkage #43

Closed
rainbowkenny opened this issue Dec 23, 2019 · 11 comments
Closed

templates must have C++ linkage #43

rainbowkenny opened this issue Dec 23, 2019 · 11 comments

Comments

@rainbowkenny
Copy link

Hi,
I followed your steps to build the blinky example. I'm using a Mac.
No matter what I try, I'm always seeing the following error: "/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:101:1: error: templates must have C++ linkage"
=============Full error message below==============

C02ZK0Q0LVDN:mbed-simulator shuhan01$ node cli.js -i demos/blinky -o out --launch
libmbed.bc does not exist. Building...
'mbed deploy' did not run before, running...
Failed to build libmbed (1)
cache:INFO: generating system asset: is_vanilla.txt... (this will be cached in "/Users/shuhan01/.emscripten_cache/is_vanilla.txt" for subsequent builds)
cache:INFO: - ok
shared:WARNING: Assuming object file output in the absence of -c, based on output filename. Please add with -c or -r to avoid this warning
/Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/mbed-os/features/lorawan/LoRaWANStack.cpp:911:18: warning: format specifies type 'unsigned long' but the argument has type 'uint32_t' (aka 'unsigned int') [-Wformat]
_lw_session.uplink_counter, _lw_session.downlink_counter);
^~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/simple-mbed-cloud-client/mbed-cloud-client/mbed-trace/mbed-trace/mbed_trace.h:127:79: note: expanded from macro 'tr_debug'
#define tr_debug(...) mbed_tracef(TRACE_LEVEL_DEBUG, TRACE_GROUP, VA_ARGS) //!< Print debug message
^~~~~~~~~~~
/Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/mbed-os/features/lorawan/LoRaWANStack.cpp:911:46: warning: format specifies type 'unsigned long' but the argument has type 'uint32_t' (aka 'unsigned int') [-Wformat]
_lw_session.uplink_counter, _lw_session.downlink_counter);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/simple-mbed-cloud-client/mbed-cloud-client/mbed-trace/mbed-trace/mbed_trace.h:127:79: note: expanded from macro 'tr_debug'
#define tr_debug(...) mbed_tracef(TRACE_LEVEL_DEBUG, TRACE_GROUP, VA_ARGS) //!< Print debug message
^~~~~~~~~~~
2 warnings generated.
/Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/mbed-os/features/lorawan/lorastack/mac/LoRaMac.cpp:910:43: warning: format specifies type 'unsigned long' but the argument has type 'uint32_t' (aka 'unsigned int') [-Wformat]
tr_debug("RX1 slot open, Freq = %lu", _params.rx_window1_config.frequency);
~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%u
/Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/simple-mbed-cloud-client/mbed-cloud-client/mbed-trace/mbed-trace/mbed_trace.h:127:79: note: expanded from macro 'tr_debug'
#define tr_debug(...) mbed_tracef(TRACE_LEVEL_DEBUG, TRACE_GROUP, VA_ARGS) //!< Print debug message
^~~~~~~~~~~
/Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/mbed-os/features/lorawan/lorastack/mac/LoRaMac.cpp:939:43: warning: format specifies type 'unsigned long' but the argument has type 'uint32_t' (aka 'unsigned int') [-Wformat]
tr_debug("RX2 slot open, Freq = %lu", _params.rx_window2_config.frequency);
~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%u
/Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/simple-mbed-cloud-client/mbed-cloud-client/mbed-trace/mbed-trace/mbed_trace.h:127:79: note: expanded from macro 'tr_debug'
#define tr_debug(...) mbed_tracef(TRACE_LEVEL_DEBUG, TRACE_GROUP, VA_ARGS) //!< Print debug message
^~~~~~~~~~~
/Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/mbed-os/features/lorawan/lorastack/mac/LoRaMac.cpp:1132:65: warning: format specifies type 'unsigned long' but the argument has type 'lorawan_time_t' (aka 'unsigned int') [-Wformat]
tr_debug("DC enforced: Transmitting in %lu ms", backoff_time);
~~~ ^~~~~~~~~~~~
%u
/Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/simple-mbed-cloud-client/mbed-cloud-client/mbed-trace/mbed-trace/mbed_trace.h:127:79: note: expanded from macro 'tr_debug'
#define tr_debug(...) mbed_tracef(TRACE_LEVEL_DEBUG, TRACE_GROUP, VA_ARGS) //!< Print debug message
^~~~~~~~~~~
3 warnings generated.
/Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/mbed-os/platform/mbed_mem_trace.cpp:110:80: warning: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
printf(MBED_MEM_DEFAULT_TRACER_PREFIX "m:%p;%p-%u\n", res, caller, temp_s1);
~~ ^~~~~~~
%zu
/Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/mbed-os/platform/mbed_mem_trace.cpp:116:93: warning: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
printf(MBED_MEM_DEFAULT_TRACER_PREFIX "r:%p;%p-%p;%u\n", res, caller, temp_ptr, temp_s1);
~~ ^~~~~~~
%zu
/Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/mbed-os/platform/mbed_mem_trace.cpp:122:83: warning: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
printf(MBED_MEM_DEFAULT_TRACER_PREFIX "c:%p;%p-%u;%u\n", res, caller, temp_s1, temp_s2);
~~ ^~~~~~~
%zu
/Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/mbed-os/platform/mbed_mem_trace.cpp:122:92: warning: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
printf(MBED_MEM_DEFAULT_TRACER_PREFIX "c:%p;%p-%u;%u\n", res, caller, temp_s1, temp_s2);
~~ ^~~~~~~
%zu
4 warnings generated.
In file included from /Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/pelion-dm/pal_plat_rtos.cpp:18:
In file included from /Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/simple-mbed-cloud-client/mbed-cloud-client/mbed-client-pal/Source/PAL-Impl/Services-API/pal.h:25:
In file included from /Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/simple-mbed-cloud-client/mbed-cloud-client/mbed-client-pal/Source/PAL-Impl/Services-API/pal_configuration.h:49:
In file included from /Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/simple-mbed-cloud-client/mbed-cloud-client/mbed-client-pal/Configs/pal_config/mbedOS/mbedOS_default.h:46:
In file included from /Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/mbed-os/targets/TARGET_SIMULATOR/device.h:33:
In file included from /Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/mbed-os/targets/TARGET_SIMULATOR/objects.h:22:
In file included from /Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/mbed-os/targets/TARGET_SIMULATOR/gpio_object.h:19:
In file included from /Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten.h:1:
In file included from /Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/emscripten.h:23:
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:101:1: error: templates must have C++ linkage
template<typename, typename = void> struct __em_asm_sig {};
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/simple-mbed-cloud-client/mbed-cloud-client/mbed-client-pal/Source/PAL-Impl/Services-API/pal.h:22:1: note: extern "C" language linkage specification begins here
extern "C" {
^
In file included from /Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/pelion-dm/pal_plat_rtos.cpp:18:
In file included from /Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/simple-mbed-cloud-client/mbed-cloud-client/mbed-client-pal/Source/PAL-Impl/Services-API/pal.h:25:
In file included from /Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/simple-mbed-cloud-client/mbed-cloud-client/mbed-client-pal/Source/PAL-Impl/Services-API/pal_configuration.h:49:
In file included from /Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/simple-mbed-cloud-client/mbed-cloud-client/mbed-client-pal/Configs/pal_config/mbedOS/mbedOS_default.h:46:
In file included from /Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/mbed-os/targets/TARGET_SIMULATOR/device.h:33:
In file included from /Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/mbed-os/targets/TARGET_SIMULATOR/objects.h:22:
In file included from /Users/shuhan01/git/mbed-simulator/mbed-simulator-hal/mbed-os/targets/TARGET_SIMULATOR/gpio_object.h:19:
In file included from /Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten.h:1:
In file included from /Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/emscripten.h:23:
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:102:19: error: explicit specialization of undeclared template struct '__em_asm_sig'
template<> struct __em_asm_sig { static const char value = 'd'; };
^ ~~~~~~~
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:103:19: error: explicit specialization of non-template struct '__em_asm_sig'
template<> struct __em_asm_sig { static const char value = 'd'; };
^ ~~~~~~~~
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:103:19: error: redefinition of '__em_asm_sig'
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:102:19: note: previous definition is here
template<> struct __em_asm_sig { static const char value = 'd'; };
^
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:104:19: error: explicit specialization of non-template struct '__em_asm_sig'
template<> struct __em_asm_sig { static const char value = 'i'; };
^ ~~~~~~
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:104:19: error: redefinition of '__em_asm_sig'
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:102:19: note: previous definition is here
template<> struct __em_asm_sig { static const char value = 'd'; };
^
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:105:19: error: explicit specialization of non-template struct '__em_asm_sig'
template<> struct __em_asm_sig { static const char value = 'i'; };
^ ~~~~~~~~~~~~~
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:105:19: error: redefinition of '__em_asm_sig'
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:102:19: note: previous definition is here
template<> struct __em_asm_sig { static const char value = 'd'; };
^
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:106:19: error: explicit specialization of non-template struct '__em_asm_sig'
template<> struct __em_asm_sig { static const char value = 'i'; };
^ ~~~~~~~~~~~~~~~
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:106:19: error: redefinition of '__em_asm_sig'
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:102:19: note: previous definition is here
template<> struct __em_asm_sig { static const char value = 'd'; };
^
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:107:19: error: explicit specialization of non-template struct '__em_asm_sig'
template<> struct __em_asm_sig { static const char value = 'i'; };
^ ~~~~~~~
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:107:19: error: redefinition of '__em_asm_sig'
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:102:19: note: previous definition is here
template<> struct __em_asm_sig { static const char value = 'd'; };
^
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:108:19: error: explicit specialization of non-template struct '__em_asm_sig'
template<> struct __em_asm_sig { static const char value = 'i'; };
^ ~~~~~~~~~~~~~~~~
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:108:19: error: redefinition of '__em_asm_sig'
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:102:19: note: previous definition is here
template<> struct __em_asm_sig { static const char value = 'd'; };
^
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:109:19: error: explicit specialization of non-template struct '__em_asm_sig'
template<> struct __em_asm_sig { static const char value = 'i'; };
^ ~~~~~
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:109:19: error: redefinition of '__em_asm_sig'
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:102:19: note: previous definition is here
template<> struct __em_asm_sig { static const char value = 'd'; };
^
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:110:19: error: explicit specialization of non-template struct '__em_asm_sig'
template<> struct __em_asm_sig { static const char value = 'i'; };
^ ~~~~~~~~~~~~~~
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:110:19: error: redefinition of '__em_asm_sig'
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:102:19: note: previous definition is here
template<> struct __em_asm_sig { static const char value = 'd'; };
^
/Users/shuhan01/emsdk/upstream/emscripten/system/include/emscripten/em_asm.h:111:19: error: explicit specialization of non-template struct '__em_asm_sig'
template<> struct __em_asm_sig { static const char value = 'i'; };
^ ~~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

@sudobrian
Copy link

I have the same problem and it is related to the emcc version.
The installation instruction in this github work until 1.38.28 but this version is no longer supported. So you cannot install it unless you already have downloaded (about 450 MB).

The oldest installable emcc version is 1.38.33, but this version has the same error you mention. I have tried with the latest version (1.39.5) without luck.

Is there anyone succeeds to install this Mbed-Simulator with the latest Emscripten version?

@rainbowkenny
Copy link
Author

Thanks Sudobrain, what OS did you use ? By the look of it, it seems to be a generic issue? Cheers!

@sudobrian
Copy link

I am using Ubuntu 16.04.
You also need to use a certain Gnu ARM Embedded Toolchain: gcc-arm-none-eabi-8-2018-q4-major-linux.tar.bz2.
I have tried a later version, but it did not work with the Mbed-Simulator code here.

@cg-laser
Copy link

I'm running into the same problem on macos. Is there any chance that this bug can be fixed?

@sudobrian
Copy link

The answer is in the /issues/44.
So, the best way is to find the Emscripten 1.38.28.

@cg-laser
Copy link

Thanks @sudobrian , I also found this issue ofter I wrote my comment, sorry for not looking earlier.

Did you find out how to get this old Emscripten version? I try to install the mbed simulator for the first time and don't have any old emscripten release lying around.

@sudobrian
Copy link

sudobrian commented Jan 16, 2020

I tried to find one online but no luck, but I do have the directory installed last year.
After compression, it is about 450 MB.

I can provide you but I need to check the licence regarding distribution.
The emscripten github license seems to be open.
I excerpted a part of it here.
But I hope someone can confirm if I can share my copy of emscripten with others under this license.
Do you know anyone who is familiar with this licence?

============
Emscripten is available under 2 licenses, the MIT license and the University of Illinois/NCSA Open Source License.
Both are permissive open source licenses, with little if any practical difference between them.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

@austin99
Copy link

I'm also having the same issue on Win10 x64 - clean install (on a VM)

emsdk\upstream\emscripten\system\include/emscripten/em_asm.h:101:1: error: templates must have C++ linkage
template<typename, typename = void> struct __em_asm_sig {};

@hellomoin
Copy link

Any suggestion to resolve this problem?

@janjongboom
Copy link
Owner

For anyone who reads this. I'm no longer working at Arm, and no-one within Arm has picked the project up, and it will no longer be maintained. I'd suggest to look at Fast Models (https://developer.arm.com/tools-and-software/simulation-models/fast-models) or other simulation techniques which are supported.

@janjongboom
Copy link
Owner

Updated instructions in the README now (tested on Ubuntu 18).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants