Closed AZXSH closed 5 years ago
What specific command did you run? For example, optimizations might change things. Or dead code removal might remove a function that looks unused. See this faq entry.
It shows the below error..
C:\Program Files\Emscripten\emscripten\1.35.0>emcc lea_ref.cpp -o lea.js -s EXPORTED_FUNCTIONS="['_LEA_Keyschedule', '_LEA_EncryptBlk', '_LEA_DecryptBlk']" In file included from lea_ref.cpp:27: ./lea_ref.h:69:6: error: variable has incomplete type 'void' void EMSCRIPTEN_KEEPALIVE LEA_Keyschedule(u32 pdRndKeys[LEA_NUM_RNDS][LEA_RNDKEY_WORD_LEN], ^ ./lea_ref.h:69:26: error: expected ';' after top level declarator void EMSCRIPTEN_KEEPALIVE LEA_Keyschedule(u32 pdRndKeys[LEA_NUM_RNDS][LEA_RNDKEY_WORD_LEN], ^ ; ./lea_ref.h:78:6: error: variable has incomplete type 'void' void EMSCRIPTEN_KEEPALIVE LEA_EncryptBlk(u8 pbDst[LEA_BLK_BYTE_LEN], ^ ./lea_ref.h:78:26: error: expected ';' after top level declarator void EMSCRIPTEN_KEEPALIVE LEA_EncryptBlk(u8 pbDst[LEA_BLK_BYTE_LEN], ^ ; ./lea_ref.h:88:6: error: variable has incomplete type 'void' void EMSCRIPTEN_KEEPALIVE LEA_DecryptBlk(u8 pbDst[LEA_BLK_BYTE_LEN], ^ ./lea_ref.h:88:26: error: expected ';' after top level declarator void EMSCRIPTEN_KEEPALIVE LEA_DecryptBlk(u8 pbDst[LEA_BLK_BYTE_LEN], ^ ; lea_ref.cpp:46:6: error: variable has incomplete type 'void' void EMSCRIPTEN_KEEPALIVE LEA_Keyschedule(u32 pdRndKeys[LEA_NUM_RNDS][LEA_RNDKEY_WORD_LEN], ^ lea_ref.cpp:46:26: error: expected ';' after top level declarator void EMSCRIPTEN_KEEPALIVE LEA_Keyschedule(u32 pdRndKeys[LEA_NUM_RNDS][LEA_RNDKEY_WORD_LEN], ^ ; 8 errors generated. ERROR:root:compiler frontend failed to generate LLVM bitcode, halting
C:\Program Files\Emscripten\emscripten\1.35.0>
On Mon, Oct 17, 2016 at 10:09 PM, Alon Zakai notifications@github.com wrote:
What specific command did you run? For example, optimizations might change things. Or dead code removal might remove a function that looks unused. See this faq entry http://kripken.github.io/emscripten-site/docs/getting_started/FAQ.html#why-do-functions-in-my-c-c-source-code-vanish-when-i-compile-to-javascript-and-or-i-get-no-functions-to-process .
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kripken/emscripten/issues/4629#issuecomment-254286618, or mute the thread https://github.com/notifications/unsubscribe-auth/AVzY5CvEZTuBHdbWzjiF5uRkOS2fRduOks5q07nSgaJpZM4KX2Vz .
That looks like it's missing the definition of EMSCRIPTEN_KEEPALIVE
? Try #include <emscripten/emscripten.h>
at the top of the file?
I added #include <emscripten/emscripten.h> at the top of the file but it still shows the below error ...
C:\Program Files\Emscripten\emscripten\1.35.0>emcc lea_ref.cpp -o lea.js -s EXPORTED_FUNCTIONS="['_LEA_Keyschedule', '_LEA_EncryptBlk', '_LEA_DecryptBlk']" WARNING:root:function requested to be exported, but not implemented: "_LEA_Keyschedule" WARNING:root:function requested to be exported, but not implemented: "_LEA_EncryptBlk" WARNING:root:function requested to be exported, but not implemented: "_LEA_DecryptBlk"
C:\Program Files\Emscripten\emscripten\1.35.0>
On Tue, Oct 18, 2016 at 1:25 PM, juj notifications@github.com wrote:
That looks like it's missing the definition of EMSCRIPTEN_KEEPALIVE? Try #include <emscripten/emscripten.h> at the top of the file?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kripken/emscripten/issues/4629#issuecomment-254454365, or mute the thread https://github.com/notifications/unsubscribe-auth/AVzY5IPsKbh07SoTSEHOKLsWydtW2OHeks5q1JCVgaJpZM4KX2Vz .
Perhaps those functions need to be wrapped in extern "C"
? You are exporting them using the C name, but they are in a C++ file.
Can also build the cpp to a .bc
file and run llvm-nm
on that, to see which symbols exist there.
I added the extern "C" to the .cpp code and it shows the following errors..
C:\Program Files\Emscripten\emscripten\1.35.0>emcc lea_ref.cpp -o lea.js -s EXPORTED_FUNCTIONS="['_LEA_Keyschedule', '_LEA_EncryptBlk', '_LEA_DecryptBlk']" lea_ref.cpp:48:27: error: declaration of 'LEA_Keyschedule' has a different language linkage void EMSCRIPTEN_KEEPALIVE LEA_Keyschedule(u32 pdRndKeys[LEA_NUM_RNDS][LEA_RNDKEY_WORD_LEN], ^ ./lea_ref.h:71:27: note: previous declaration is here void EMSCRIPTEN_KEEPALIVE LEA_Keyschedule(u32 pdRndKeys[LEA_NUM_RNDS][LEA_RNDKEY_WORD_LEN], ^ lea_ref.cpp:145:27: error: declaration of 'LEA_EncryptBlk' has a different language linkage void EMSCRIPTEN_KEEPALIVE LEA_EncryptBlk(u8 pbDst[LEA_BLK_BYTE_LEN], ^ ./lea_ref.h:80:27: note: previous declaration is here void EMSCRIPTEN_KEEPALIVE LEA_EncryptBlk(u8 pbDst[LEA_BLK_BYTE_LEN], ^ lea_ref.cpp:174:27: error: declaration of 'LEA_DecryptBlk' has a different language linkage void EMSCRIPTEN_KEEPALIVE LEA_DecryptBlk(u8 pbDst[LEA_BLK_BYTE_LEN], ^ ./lea_ref.h:90:27: note: previous declaration is here void EMSCRIPTEN_KEEPALIVE LEA_DecryptBlk(u8 pbDst[LEA_BLK_BYTE_LEN], ^ 3 errors generated. ERROR:root:compiler frontend failed to generate LLVM bitcode, halting
C:\Program Files\Emscripten\emscripten\1.35.0>
Is building .bc looks like this?
emcc lea_ref.cpp -o lea.bc -s EXPORTED_FUNCTIONS="['_LEA_Keyschedule', '_LEA_EncryptBlk', '_LEA_DecryptBlk']"
and how can I add the run llvm-nm to the previous commandline?
On Tue, Oct 18, 2016 at 9:35 PM, Alon Zakai notifications@github.com wrote:
Perhaps those functions need to be wrapped in extern "C"? You are exporting them using the C name, but they are in a C++ file.
Can also build the cpp to a .bc file and run llvm-nm on that, to see which symbols exist there.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kripken/emscripten/issues/4629#issuecomment-254581514, or mute the thread https://github.com/notifications/unsubscribe-auth/AVzY5AlnlGGJQrX6gBd2WuxGV6iH8yI6ks5q1QNMgaJpZM4KX2Vz .
You need to edit the header too, I am guessing - the compiler doesn't like a function declared as extern C++ but then implemented as extern C. But I'm not sure, never seen that error before.
This issue has been automatically marked as stale because there has been no activity in the past 2 years. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant.
I am very new to emscripten.. I have a .cpp code and I want to convert it to .js and it went well. However when I called the function directly using _sameName of the original .cpp file it shows that there is no function with such name.
I am using eclipse and node.js
please advise me...