Closed andypotato closed 4 years ago
The system has libstdc++ installed and memory is available at its default location at /usr/include/c++/7.5.0/memory
Emscripten is a cross-compiler, really - it can't use system headers. For example, wasm is a 32-bit architecture, but your system headers are likely for a 64-bit machine.
Emscripten ships with libc++ which includes memory
,
// a.cpp
#include <memory>
That compiles with em++ a.cpp
.
I think the problem here is that the compiler is running in C and not C++ mode
What command line are you using? Doesn't you file have a C++ file extension?
You can ensure C++ mode in one of 3 ways:
em++
-x c++
on the command line.What command line are you using? Doesn't you file have a C++ file extension?
The build command includes files with both .c
and .cpp
extensions. I guess you're right and the compiler runs in C mode only which fails to compile C++ files even they are properly named.
The weird thing is, this build used to run without issues in a previous 1.38.xx version of emscripten. I just recently changed to a new machine and had to create a fresh install.
Forcing C++ mode with em++
or the -x
flag will break the build due to treating 'c' input as 'c++' when in C++ mode
. But shouldn't it use the appropriate compiler based on file extension?
Full build command below:
emcc
-I/home/as/src/artoolkit5-js/lib/artoolkit5/include
-I/home/as/src/artoolkit5-js/src/artoolkit5/
-I/home/as/src/artoolkit5-js/lib/
-I/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/KPM/FreakMatcher
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/AR/arLabelingSub/*.c
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/AR/*.c
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/ARICP/*.c
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/ARMulti/*.c
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/Video/video.c
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/ARUtil/log.c
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/ARUtil/file_utils.c
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/AR2/handle.c
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/AR2/imageSet.c
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/AR2/jpeg.c
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/AR2/marker.c
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/AR2/featureMap.c
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/AR2/featureSet.c
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/AR2/selectTemplate.c
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/AR2/surface.c
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/AR2/tracking.c
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/AR2/tracking2d.c
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/AR2/matching.c
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/AR2/matching2.c
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/AR2/template.c
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/AR2/searchPoint.c
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/AR2/coord.c
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/AR2/util.c
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/KPM/kpmHandle.cpp
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/KPM/kpmRefDataSet.cpp
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/KPM/kpmMatching.cpp
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/KPM/kpmResult.cpp
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/KPM/kpmUtil.cpp
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/KPM/kpmFopen.c
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/KPM/FreakMatcher/detectors/DoG_scale_invariant_detector.cpp
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/KPM/FreakMatcher/detectors/gaussian_scale_space_pyramid.cpp
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/KPM/FreakMatcher/detectors/gradients.cpp
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/KPM/FreakMatcher/detectors/harris.cpp
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/KPM/FreakMatcher/detectors/orientation_assignment.cpp
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/KPM/FreakMatcher/detectors/pyramid.cpp
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/KPM/FreakMatcher/facade/visual_database_facade.cpp
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/KPM/FreakMatcher/matchers/hough_similarity_voting.cpp
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/KPM/FreakMatcher/matchers/freak.cpp
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/KPM/FreakMatcher/framework/date_time.cpp
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/KPM/FreakMatcher/framework/image.cpp
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/KPM/FreakMatcher/framework/logger.cpp
/home/as/src/artoolkit5-js/lib/artoolkit5/lib/SRC/KPM/FreakMatcher/framework/timers.cpp
-Oz
-Wno-warn-absolute-paths
-s TOTAL_MEMORY=268435456
-s USE_ZLIB=1
-s USE_LIBJPEG
-s "EXTRA_EXPORTED_RUNTIME_METHODS=['FS']"
--memory-init-file 0
--bind
-D HAVE_NFT
-o /home/as/src/artoolkit5-js/src/artoolkit5/libar.bc
Oh yes this does look like a bug. We should use the correct mode for each input file according to its extension.
However, I would advise changing your build system to build each source file in isolation and and link them together as a separate step. Is there some reason you are trying to build eveything and link it together in a single command?
Can you unpack a file from Winrar?
Error description
Using emscripten v1.39.16 on Ubuntu 18.04 trying to compile a c++ file with emcc results in the following error:
Additional output
Expected result
The system has
libstdc++
installed andmemory
is available at its default location at/usr/include/c++/7.5.0/memory
. As emscripten selected this gcc version, the compiler should be able to find the library.Debug output