Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate swipl.wasm and swipl.data #1163

Open
jeswr opened this issue Apr 14, 2023 · 3 comments
Open

Generate swipl.wasm and swipl.data #1163

jeswr opened this issue Apr 14, 2023 · 3 comments

Comments

@jeswr
Copy link
Contributor

jeswr commented Apr 14, 2023

Currently there is a PR open in npm-swipl-wasm to properly use swipl.js for node rather than copying swipl-web.js to swipl.js (see SWI-Prolog/npm-swipl-wasm#101).

As can be seen in the CI; this is currently failing because there is no swipl.wasm or swipl.data available; and it would appear that they are not being generated by https://github.com/SWI-Prolog/swipl-devel/blob/master/cmake/EmscriptenTargets.cmake in the way that

# Create swipl-web.js, swipl-web.wasm, swipl-web.data
set(WASM_WEB_LINK_FLAGS
--preload-file ${WASM_PRELOAD_DIR}@swipl)
join_list(WASM_WEB_LINK_FLAGS_STRING " "
${WASM_WEB_LINK_FLAGS} ${WASM_SHARED_LINK_FLAGS})
add_executable(swipl-web ${SWIPL_SRC})
set_target_properties(swipl-web PROPERTIES
LINK_FLAGS "${WASM_WEB_LINK_FLAGS_STRING}")
target_link_libraries(swipl-web libswipl)
add_dependencies(swipl-web wasm_preload)
set_property(TARGET swipl-web PROPERTY LINK_DEPENDS
${POSTJS} ${PREJS})
is.

So my question is; are swipl.wasm and swipl.data going to be the same as the swipl-web.wasm and swipl-web.data; in which case we can just take a short term solution of duplicating those files; or patching the lookup paths in the generated .js files. Or do we need to generate distinct swipl.wasm and swipl.data from EmscriptenTargets.cmake - in which case I'd ask someone else with more expertise to take it on as I am going to be time poor for the next couple of months.

@JanWielemaker
Copy link
Member

I don't know that much about the WASM build. AFAIK though, we build swipl.js/wasm such that it uses the native filesystem, which you can see if you run node src/swipl.js in the build directory. We need such a version to perform the Prolog build steps, producing home/boot.prc and the various .qlf (Quick Load File) files.

@jeswr
Copy link
Contributor Author

jeswr commented Apr 14, 2023

So does this mean an update to the cmake file is required?

@JanWielemaker
Copy link
Member

I don't know what to think about swipl.js/wasm. I am inclined to consider it just an intermediate build product. We could also distribute it along with a the libraries as a file hierarchy, so you get something similar to the normal distributions that consist of the executable and the libraries. Wasn't it true that swipl-web.js and the bundles also run under Node? If that is true the only thing wrong seems the misleading "web" in the name?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants