Comments (11)
Are you trying to use val.h
under gcc? In general I would assume that emscripten headers are only compatible with the version of clang that we support.
from emscripten.
This fails when using clang compiler as well.
Compiler:-
Apple clang version 15.0.0 (clang-1500.1.0.2.5)
Target: x86_64-apple-darwin23.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Error:-
/Users/xxxxx/tmp/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:239:20: error: assigning to 'void *' from 'const char *' discards qualifiers
239 | cursor->w[0].p = wt;
| ^~
from emscripten.
Hmm.. I wonder why we don't see that in emscripten.. since we use clang. Perhaps because its a system header and the rules are more lax?
Did you run into this while trying to use val.h
outside of the context of emscripten?
from emscripten.
Can you share the exact command line you used to get that error using clang? I can't seem to reproduce it.
from emscripten.
Build Script:-
#!/bin/sh
# Set the local build directory
build=".wasm"
# Make the directory; generate the makefiles; make & install
mkdir -p $build && cd $build && \
emcmake cmake .. > /dev/null 2>&1
# If the cmake failed, try once more with a clean build directory clean
if [ $? != 0 ]; then
cd .. && rm -rf $build && \
mkdir -p $build && cd $build && \
emcmake cmake ..
fi
# Now make
emmake make -j4 all
CMakeLists.txt:-
cmake_minimum_required(VERSION 3.20)
project(XXXXX-WASM CXX)
set (CMAKE_CXX_STANDARD 17)
set(SOURCES
xxxxx.cpp
....
yyyyy.cpp
)
set(LIBNAME xxxxx)
add_compile_options(-O3 -fPIC)
add_executable(${LIBNAME} ${SOURCES})
set_target_properties(${LIBNAME} PROPERTIES LINK_FLAGS "-Os -s DEMANGLE_SUPPORT=1 -s ALLOW_MEMORY_GROWTH=1 --bind")
from emscripten.
So does the warning show up when using emcc
? i.e. when you do emmake make
?
from emscripten.
Oh I see, I probably have to instantiate the writeGenericWireType
template in some way. Perhaps that is what I'm missing? How do you using embind in order to get the warning to trigger?
from emscripten.
yes - it fails at the 'emmake make -j4 all' stage
from emscripten.
@brendandahl do you think you know how to write a repro for this one?
from emscripten.
Here's the full error context:-
/Users/xxxxx/tmp/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:239:20: error: assigning to 'void *' from 'const char *' discards qualifiers
239 | cursor->w[0].p = wt;
| ^~
/Users/xxxxx/tmp/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:261:3: note: in instantiation of function template specialization 'emscripten::internal::writeGenericWireType<const char>' requested here
261 | writeGenericWireType(cursor, BindingType<First>::toWireType(std::forward<First>(first)));
| ^
/Users/xxxxx/tmp/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:269:5: note: in instantiation of function template specialization 'emscripten::internal::writeGenericWireTypes<const char *&>' requested here
269 | writeGenericWireTypes(cursor, std::forward<Args>(args)...);
| ^
/Users/xxxxx/tmp/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:640:27: note: in instantiation of member function 'emscripten::internal::WireTypePack<const char *&>::WireTypePack' requested here
640 | WireTypePack<Args...> argv(std::forward<Args>(args)...);
| ^
/Users/xxxxx/tmp/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:517:12: note: in instantiation of function template specialization 'emscripten::val::internalCall<emscripten::internal::EM_METHOD_CALLER_KIND::FUNCTION, bool, (lambda at /Users/xxxxx/tmp/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:518:7), const char *&>' requested here
517 | return internalCall<EM_METHOD_CALLER_KIND::FUNCTION, ReturnValue>(
| ^
/Users/xxxxx/tmp/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/bind.h:1246:24: note: in instantiation of function template specialization 'emscripten::val::call<bool, const char *&>' requested here
1246 | return wrapped.call<ReturnType>(name, std::forward<Args>(args)...);
| ^
/Users/xxxxx/yyyyy/zzzzz.cpp:19:59: note: in instantiation of function template specialization 'emscripten::wrapper<xxx:YYYYYY>::call<bool, const char *&>' requested here
19 | virtual bool WantXXXXX(const char* name) { return call<bool>("wantXXXXX", name); }
from emscripten.
val.call
doesn't accept const char* as arguments. Use either val("some str")
or std::string
.
from emscripten.
Related Issues (20)
- No transitive dependency with emscripten ports HOT 6
- Template Instantiation Error in system/lib/libcxx/include/__memory/pointer_traits.h HOT 1
- File-related syscalls, like readdir, can not handle empty directories properly HOT 2
- C++ exceptions caught in JavaScript leak stack memory even when documented instructions are followed HOT 4
- WASM_WORKERS=2 documentation HOT 14
- typedef redefinition with different types HOT 6
- [embind] Using `EMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0` fails with polymorphic types HOT 4
- memset consumes a large amount of time during startup for applications that use mmap HOT 25
- Weird --embind-emit-tsd output HOT 1
- how to generated only one file *.js if i use pthread HOT 2
- [embind] Automatic downcasting doesn't work for address over 2gb
- scorecards action seems broken. HOT 3
- --embind-emit-tsd may cause "ReferenceError: assert is not defined"
- embind d.ts defintion for std::string
- Any example to compile a project via emscripten and use it in wasmtime? HOT 10
- In `-sMODULARIZE` mode the `moduleArg` should not be modified in place
- Bind error of getting a pointer property in class
- Make mimalloc headers accessible HOT 2
- lto2.test_embind_i64_val is failing
- evaluation of std::sin in C++ is slower than in JS directly HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from emscripten.