Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Compile errors with basic jsapi integration

38 views
Skip to first unread message

crdu...@gmail.com

unread,
Feb 25, 2018, 2:57:54 PM2/25/18
to
I'm trying to build a basic hello world style program with JSAPI. I've copied the "boilerplate code necessary for a minimal JSAPI application" from the JSAPI User Guide (https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/JSAPI_User_Guide) and I'm trying to build on OS X with the following command:

clang++ -std=c++11 -Iinclude -Llib ew-test.cpp -lmozjs-60a1 -lz -o ew-test

I'm getting a bunch of compile errors. The output up to the first error is:
In file included from ew-test.cpp:1:
In file included from include/jsapi.h:15:
In file included from include/mozilla/Range.h:12:
include/mozilla/Span.h:194:3: warning: 'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const' to avoid a change in behavior [-Wconstexpr-not-const]
operator=(const span_iterator<Span, IsConst>&) = default;
^
const
include/mozilla/Span.h:208:47: warning: 'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const' to avoid a change in behavior [-Wconstexpr-not-const]
MOZ_SPAN_NON_CONST_CONSTEXPR span_iterator& operator++()
^
const
include/mozilla/Span.h:215:27: warning: 'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const' to avoid a change in behavior [-Wconstexpr-not-const]
constexpr span_iterator operator++(int)
^
const
include/mozilla/Span.h:222:47: warning: 'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const' to avoid a change in behavior [-Wconstexpr-not-const]
MOZ_SPAN_NON_CONST_CONSTEXPR span_iterator& operator--()
^
const
include/mozilla/Span.h:229:27: warning: 'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const' to avoid a change in behavior [-Wconstexpr-not-const]
constexpr span_iterator operator--(int)
^
const
include/mozilla/Span.h:243:41: warning: 'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const' to avoid a change in behavior [-Wconstexpr-not-const]
MOZ_SPAN_GCC_CONSTEXPR span_iterator& operator+=(difference_type n)
^
const
include/mozilla/Span.h:258:28: warning: 'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const' to avoid a change in behavior [-Wconstexpr-not-const]
constexpr span_iterator& operator-=(difference_type n)
^
const
include/mozilla/Span.h:183:5: error: statement not allowed in constexpr constructor
MOZ_RELEASE_ASSERT(span == nullptr ||
^
include/mozilla/Assertions.h:453:5: note: expanded from macro 'MOZ_RELEASE_ASSERT'
MOZ_PASTE_PREFIX_AND_ARG_COUNT(MOZ_ASSERT_HELPER, __VA_ARGS__), \
^
include/mozilla/MacroArgs.h:76:5: note: expanded from macro 'MOZ_PASTE_PREFIX_AND_ARG_COUNT'
MOZ_CONCAT, (aPrefix, MOZ_ARG_COUNT(__VA_ARGS__)))
^

I can't figure out where I'm going wrong. Any help would be appreciated.

Kent Williams

unread,
Feb 26, 2018, 10:11:12 AM2/26/18
to dev-tech-...@lists.mozilla.org
What version of clang?  What version of SpiderMonkey? I've tried a CLang
compile on Centos7 -- the free Red Hat 7 -- and run into these problems
or something similar.

I would think there should be a way to compile with Clang, as that's the
system compiler on OS X now.
> _______________________________________________
> dev-tech-js-engine mailing list
> dev-tech-...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-tech-js-engine

Wes Garland

unread,
Feb 26, 2018, 11:19:50 AM2/26/18
to Kent Williams, dev-tech-...@lists.mozilla.org
How did you compile spidermonkey itself? That will yield important clues
about what compiler/flags/etc you need to use for your embedding.

Wes

On 26 February 2018 at 10:10, Kent Williams <kwil...@leepfrog.com> wrote:

> What version of clang? What version of SpiderMonkey? I've tried a CLang
> compile on Centos7 -- the free Red Hat 7 -- and run into these problems or
> something similar.
>
> I would think there should be a way to compile with Clang, as that's the
> system compiler on OS X now.
>
>
>
> On 02/25/2018 01:57 PM, crdu...@gmail.com wrote:
>
>> _______________________________________________
>> dev-tech-js-engine mailing list
>> dev-tech-...@lists.mozilla.org
>> https://lists.mozilla.org/listinfo/dev-tech-js-engine
>>
>
> _______________________________________________
> dev-tech-js-engine mailing list
> dev-tech-...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-tech-js-engine
>



--
Wesley W. Garland
Director, Product Development
PageMail, Inc.
+1 613 542 2787 x 102

philip....@gmail.com

unread,
May 15, 2018, 10:10:19 PM5/15/18
to
On Sunday, February 25, 2018 at 2:57:54 PM UTC-5, crdu...@gmail.com wrote:
> I'm trying to build a basic hello world style program with JSAPI. I've copied the "boilerplate code necessary for a minimal JSAPI application" from the JSAPI User Guide (https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/JSAPI_User_Guide) and I'm trying to build on OS X with the following command:
>
> clang++ -std=c++11 -Iinclude -Llib ew-test.cpp -lmozjs-60a1 -lz -o ew-test

I've found that since mozjs-60 you need to use C++14. That cleared up these errors for me. I was using "Apple LLVM version 9.1.0 (clang-902.0.39.1)" according to "clang --version".
Regards,
0 new messages