webarkit / jsartoolkit5

Javascript ARToolKit v5.x
https://webarkit.github.io/jsartoolkit5/examples/
Other
12 stars 8 forks source link

error compiling jsartoolkit5 probably own environment (question) #14

Open albjeremias opened 3 years ago

albjeremias commented 3 years ago

So the issue is the following: using emscripten 1.39.5-fastcomp I get this error...

    ports.fetch_project('libjpeg', 'https://dl.bintray.com/homebrew/mirror/jpeg-9c.tar.gz', 'jpeg-9c', sha512hash=HASH)
urllib2.HTTPError: HTTP Error 403: Forbidden

which is described as problem with that domain was taken down... and u need to upgrade emscript?! here is the upstream issue https://github.com/emscripten-core/emscripten/issues/14760

using the latest emscripten... I get this error... wasm-ld: error: unknown file type: ~/devel/jsartoolkit5/build/libar.bc which can lead to the following issues: https://github.com/emscripten-core/emscripten/issues/13607#issue-823241733 https://github.com/emscripten-core/emscripten/issues/14531#issue-929158886 https://github.com/emscripten-core/emscripten/issues/15054

$ npm run build-local

> jsartoolkit@5.5.139 build-local ~/devel/jsartoolkit5
> node tools/makem.js; echo Built at `date`

Warning: EMSCRIPTEN environment variable not found.
If you get a "command not found" error,
do `source <path to emsdk>/emsdk_env.sh` and try again.

Running command: emcc -I~/devel/jsartoolkit5/emscripten/artoolkit5/include -I~/devel/jsartoolkit5/build/ -I~/devel/jsartoolkit5/emscripten/ -I~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/AR/arLabelingSub/*.c ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/AR/*.c ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/ARICP/*.c ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/ARMulti/*.c ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/Video/video.c ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/ARUtil/log.c ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/ARUtil/file_utils.c ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/AR2/handle.c ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/AR2/imageSet.c ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/AR2/jpeg.c ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/AR2/marker.c ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/AR2/featureMap.c ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/AR2/featureSet.c ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/AR2/selectTemplate.c ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/AR2/surface.c ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/AR2/tracking.c ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/AR2/tracking2d.c ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/AR2/matching.c ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/AR2/matching2.c ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/AR2/template.c ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/AR2/searchPoint.c ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/AR2/coord.c ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/AR2/util.c ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/kpmHandle.cpp ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/kpmRefDataSet.cpp ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/kpmMatching.cpp ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/kpmResult.cpp ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/kpmUtil.cpp ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/kpmFopen.c ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/detectors/DoG_scale_invariant_detector.cpp ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/detectors/gaussian_scale_space_pyramid.cpp ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/detectors/gradients.cpp ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/detectors/harris.cpp ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/detectors/orientation_assignment.cpp ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/detectors/pyramid.cpp ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/facade/visual_database_facade.cpp ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/matchers/hough_similarity_voting.cpp ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/matchers/freak.cpp ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/framework/date_time.cpp ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/framework/image.cpp ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/framework/logger.cpp ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/framework/timers.cpp -Oz  -Wno-warn-absolute-paths  -s TOTAL_MEMORY=268435456  -s USE_ZLIB=1 -s USE_LIBJPEG --memory-init-file 0  -s ALLOW_MEMORY_GROWTH=1 --bind    -D HAVE_NFT  -o ~/devel/jsartoolkit5/build/libar.bc 

stderr: ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/AR2/selectTemplate.c:279:41: warning: implicit conversion from 'int' to 'float' changes value from 2147483647 to 2147483648 [-Wimplicit-const-int-float-conversion]
        k = (int)((float )j * rand() / (RAND_MAX + 1.0F));
                                        ^~~~~~~~ ~
~/devel/emsdk/upstream/emscripten/cache/sysroot/include/stdlib.h:82:19: note: expanded from macro 'RAND_MAX'
#define RAND_MAX (0x7fffffff)
                  ^~~~~~~~~~
1 warning generated.
In file included from ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/detectors/pyramid.cpp:36:
~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/detectors/pyramid.h:99:14: warning: 'auto_ptr<unsigned short>' is deprecated [-Wdeprecated-declarations]
        std::auto_ptr<unsigned short> mTmp;
             ^
~/devel/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/memory:1155:28: note: 'auto_ptr<unsigned short>' has been explicitly marked deprecated here
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 auto_ptr
                           ^
~/devel/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/__config:990:39: note: expanded from macro '_LIBCPP_DEPRECATED_IN_CXX11'
#  define _LIBCPP_DEPRECATED_IN_CXX11 _LIBCPP_DEPRECATED
                                      ^
~/devel/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/__config:979:48: note: expanded from macro '_LIBCPP_DEPRECATED'
#    define _LIBCPP_DEPRECATED __attribute__ ((deprecated))
                                               ^
1 warning generated.
In file included from ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/facade/visual_database_facade.cpp:37:
In file included from ~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/matchers/visual_database-inline.h:44:
~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/matchers/visual_database.h:83:14: warning: dynamic exception specifications with types are currently ignored in wasm [-Wwasm-exception-spec]
        void addImage(const Image& image, id_t id) throw(Exception);
             ^                                     ~~~~~~~~~~~~~~~~
~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/matchers/visual_database.h:88:14: warning: dynamic exception specifications with types are currently ignored in wasm [-Wwasm-exception-spec]
        void addImage(const GaussianScaleSpacePyramid* pyramid, id_t id) throw(Exception);
             ^                                                           ~~~~~~~~~~~~~~~~
~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/matchers/visual_database.h:93:14: warning: dynamic exception specifications with types are currently ignored in wasm [-Wwasm-exception-spec]
        void addKeyframe(keyframe_ptr_t keyframe , id_t id) throw(Exception);
             ^                                              ~~~~~~~~~~~~~~~~
~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/matchers/visual_database.h:98:14: warning: dynamic exception specifications with types are currently ignored in wasm [-Wwasm-exception-spec]
        bool query(const Image& image) throw(Exception);
             ^                         ~~~~~~~~~~~~~~~~
~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/matchers/visual_database.h:103:14: warning: dynamic exception specifications with types are currently ignored in wasm [-Wwasm-exception-spec]
        bool query(const GaussianScaleSpacePyramid* pyramid) throw(Exception);
             ^                                               ~~~~~~~~~~~~~~~~
~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/matchers/visual_database.h:104:14: warning: dynamic exception specifications with types are currently ignored in wasm [-Wwasm-exception-spec]
        bool query(const keyframe_t* query_keyframe) throw(Exception);
             ^                                       ~~~~~~~~~~~~~~~~
6 warnings generated.
~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/framework/image.cpp:120:13: warning: dynamic exception specifications with types are currently ignored in wasm [-Wwasm-exception-spec]
void Image::alloc(ImageType type,
            ^
1 warning generated.
emcc: warning: generating an executable with an object extension (.bc).  If you meant to build an object file please use `-c, `-r`, or `-shared` [-Wemcc]

Running command: emcc -I~/devel/jsartoolkit5/emscripten/artoolkit5/include -I~/devel/jsartoolkit5/build/ -I~/devel/jsartoolkit5/emscripten/ -I~/devel/jsartoolkit5/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher  ~/devel/jsartoolkit5/build/libar.bc ~/devel/jsartoolkit5/emscripten/ARToolKitJS.cpp ~/devel/jsartoolkit5/emscripten/trackingMod.c ~/devel/jsartoolkit5/emscripten/trackingMod2d.c -Oz  -Wno-warn-absolute-paths  -s TOTAL_MEMORY=268435456  -s USE_ZLIB=1 -s USE_LIBJPEG --memory-init-file 0  -s ALLOW_MEMORY_GROWTH=1 --bind  -s WASM=0  -g  -s ASSERTIONS=1  --profiling  -s ALLOW_MEMORY_GROWTH=1  -s DEMANGLE_SUPPORT=1   -D HAVE_NFT  --pre-js ~/devel/jsartoolkit5/js/artoolkit.api.js  -o ~/devel/jsartoolkit5/build/artoolkit.debug.js 

stderr: ~/devel/jsartoolkit5/emscripten/ARToolKitJS.cpp:454:22: warning: 'addNFTMarkers' has C-linkage specified, but returns incomplete type 'std::vector<int>' which could be incompatible with C [-Wreturn-type-c-linkage]
    std::vector<int> addNFTMarkers(int id, std::vector<std::string> &datasetPathnames) {
                     ^
1 warning generated.
wasm-ld: error: unknown file type: ~/devel/jsartoolkit5/build/libar.bc
emcc: error: '~/devel/emsdk/upstream/bin/wasm-ld -o ~/devel/jsartoolkit5/build/artoolkit.debug.wasm ~/devel/jsartoolkit5/build/libar.bc /tmp/emscripten_temp_f6hfgj_f/ARToolKitJS_0.o /tmp/emscripten_temp_f6hfgj_f/trackingMod_1.o /tmp/emscripten_temp_f6hfgj_f/trackingMod2d_2.o -L~/devel/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten ~/devel/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libz.a ~/devel/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libjpeg.a --whole-archive -lembind-rtti --no-whole-archive -lGL -lal -lhtml5 -lstubs-debug -lc -lcompiler_rt -lc++-noexcept -lc++abi-noexcept -ldlmalloc -lc_rt_wasm-optz -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --import-undefined --import-memory --export-if-defined=main --export-if-defined=emscripten_stack_get_end --export-if-defined=emscripten_stack_get_free --export-if-defined=emscripten_stack_init --export-if-defined=__cxa_demangle --export-if-defined=stackSave --export-if-defined=stackRestore --export-if-defined=stackAlloc --export-if-defined=__wasm_call_ctors --export-if-defined=fflush --export-if-defined=__errno_location --export-if-defined=malloc --export-if-defined=free --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-table -z stack-size=5242880 --initial-memory=268435456 --no-entry --max-memory=2147483648 --global-base=1024' failed (returned 1)

exec error: 1

docker is still downloading... i have slow internet here... will edit this if an error comes up

on docker:

$ docker exec emscripten npm run build-local

> jsartoolkit@5.5.139 build-local /src
> node tools/makem.js; echo Built at `date`

Running command: /emsdk_portable/emscripten/sdk/emcc -I/src/emscripten/artoolkit5/include -I/src/build/ -I/src/emscripten/ -I/src/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher /src/emscripten/artoolkit5/lib/SRC/AR/arLabelingSub/*.c /src/emscripten/artoolkit5/lib/SRC/AR/*.c /src/emscripten/artoolkit5/lib/SRC/ARICP/*.c /src/emscripten/artoolkit5/lib/SRC/ARMulti/*.c /src/emscripten/artoolkit5/lib/SRC/Video/video.c /src/emscripten/artoolkit5/lib/SRC/ARUtil/log.c /src/emscripten/artoolkit5/lib/SRC/ARUtil/file_utils.c /src/emscripten/artoolkit5/lib/SRC/AR2/handle.c /src/emscripten/artoolkit5/lib/SRC/AR2/imageSet.c /src/emscripten/artoolkit5/lib/SRC/AR2/jpeg.c /src/emscripten/artoolkit5/lib/SRC/AR2/marker.c /src/emscripten/artoolkit5/lib/SRC/AR2/featureMap.c /src/emscripten/artoolkit5/lib/SRC/AR2/featureSet.c /src/emscripten/artoolkit5/lib/SRC/AR2/selectTemplate.c /src/emscripten/artoolkit5/lib/SRC/AR2/surface.c /src/emscripten/artoolkit5/lib/SRC/AR2/tracking.c /src/emscripten/artoolkit5/lib/SRC/AR2/tracking2d.c /src/emscripten/artoolkit5/lib/SRC/AR2/matching.c /src/emscripten/artoolkit5/lib/SRC/AR2/matching2.c /src/emscripten/artoolkit5/lib/SRC/AR2/template.c /src/emscripten/artoolkit5/lib/SRC/AR2/searchPoint.c /src/emscripten/artoolkit5/lib/SRC/AR2/coord.c /src/emscripten/artoolkit5/lib/SRC/AR2/util.c /src/emscripten/artoolkit5/lib/SRC/KPM/kpmHandle.cpp /src/emscripten/artoolkit5/lib/SRC/KPM/kpmRefDataSet.cpp /src/emscripten/artoolkit5/lib/SRC/KPM/kpmMatching.cpp /src/emscripten/artoolkit5/lib/SRC/KPM/kpmResult.cpp /src/emscripten/artoolkit5/lib/SRC/KPM/kpmUtil.cpp /src/emscripten/artoolkit5/lib/SRC/KPM/kpmFopen.c /src/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/detectors/DoG_scale_invariant_detector.cpp /src/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/detectors/gaussian_scale_space_pyramid.cpp /src/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/detectors/gradients.cpp /src/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/detectors/harris.cpp /src/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/detectors/orientation_assignment.cpp /src/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/detectors/pyramid.cpp /src/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/facade/visual_database_facade.cpp /src/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/matchers/hough_similarity_voting.cpp /src/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/matchers/freak.cpp /src/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/framework/date_time.cpp /src/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/framework/image.cpp /src/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/framework/logger.cpp /src/emscripten/artoolkit5/lib/SRC/KPM/FreakMatcher/framework/timers.cpp -Oz  -Wno-warn-absolute-paths  -s TOTAL_MEMORY=268435456  -s USE_ZLIB=1 -s USE_LIBJPEG --memory-init-file 0  -s ALLOW_MEMORY_GROWTH=1 --bind    -D HAVE_NFT  -o /src/build/libar.bc 

stderr: 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
system_libs:INFO: retrieving port: libjpeg from https://dl.bintray.com/homebrew/mirror/jpeg-9c.tar.gz
Traceback (most recent call last):
  File "/emsdk_portable/emscripten/tag-1.39.4/emcc.py", line 3704, in <module>
    sys.exit(run(sys.argv))
  File "/emsdk_portable/emscripten/tag-1.39.4/emcc.py", line 1960, in run
    compile_source_file(i, input_file)
  File "/emsdk_portable/emscripten/tag-1.39.4/emcc.py", line 1942, in compile_source_file
    cmd = get_clang_command([input_file]) + ['-c', '-o', output_file]
  File "/emsdk_portable/emscripten/tag-1.39.4/emcc.py", line 1913, in get_clang_command
    args = system_libs.process_args(args, shared.Settings)
  File "/emsdk_portable/emscripten/tag-1.39.4/tools/system_libs.py", line 1762, in process_args
    args = port.process_args(Ports, args, settings, shared)
  File "/emsdk_portable/emscripten/tag-1.39.4/tools/ports/libjpeg.py", line 53, in process_args
    get(ports, settings, shared)
  File "/emsdk_portable/emscripten/tag-1.39.4/tools/ports/libjpeg.py", line 18, in get
    ports.fetch_project('libjpeg', 'https://dl.bintray.com/homebrew/mirror/jpeg-9c.tar.gz', 'jpeg-9c', sha512hash=HASH)
  File "/emsdk_portable/emscripten/tag-1.39.4/tools/system_libs.py", line 1681, in fetch_project
    retrieve()
  File "/emsdk_portable/emscripten/tag-1.39.4/tools/system_libs.py", line 1629, in retrieve
    f = urlopen(url)
  File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 435, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 548, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 473, in error
    return self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 556, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 403: Forbidden

exec error: 1
Built at Fri Oct 29 22:18:21 UTC 2021
kalwalt commented 3 years ago

Hi @albjeremias probably you get that error because the emscripten version you are using require another syntax. I build JsartoolkitNFT with latest emscripten with a local env and with docker; see https://github.com/webarkit/jsartoolkitNFT/blob/07b2ea609e47e02e59e7b62214001621cbe1c16a/.github/workflows/main.yml#L39-L40 Anyawy it's required to modify the makem.js script, but i think you have already did in the PR https://github.com/webarkit/jsartoolkit5/pull/15.