8000 fix wasm cmake problems by pca006132 · Pull Request #591 · elalish/manifold · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix wasm cmake problems #591

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

Merged
merged 2 commits into from
Nov 7, 2023
Merged

fix wasm cmake problems #591

merged 2 commits into from
Nov 7, 2023

Conversation

pca006132
Copy link
Collaborator

We don't use thrust's CMake script as it can cause some weird problems on some machines, so just use FetchContent_Populate instead of FetchContent_MakeAvailable. This also fix some issues about letter case, as the documentation states that <lowercaseName>_SOURCE_DIR the name is in lowercase...

Also adds emsdk version requirement. I found that the latest emsdk (3.1.48) has some issue and 3.1.45 works fine.

Copy link
codecov bot commented Nov 6, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (bb6acf1) 91.41% compared to head (0645c2c) 91.41%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #591   +/-   ##
=======================================
  Coverage   91.41%   91.41%           
=======================================
  Files          35       35           
  Lines        4496     4496           
=======================================
  Hits         4110     4110           
  Misses        386      386           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pca006132
Copy link
Collaborator Author

@t-paul @Loosetooth please let me know if this works for you. Will merge this after making sure it works on your machines.

@Loosetooth
Copy link
Contributor

Did you successfully try this fix yourself?
The thrust issue seems to be resolved, but I'm still having trouble to build on my local ubuntu-based machine. The build now fails with the following error:

[ 49%] Linking CXX executable manifold.js
cd /home/loosetooth/git/manifold/buildWASM/bindings/wasm && /usr/bin/cmake -E cmake_link_script CMakeFiles/manifoldjs.dir/link.txt --verbose=1
/home/loosetooth/git/emsdk/upstream/emscripten/em++ -O3 -DNDEBUG  -sALLOW_MEMORY_GROWTH=1 -fexceptions -sDISABLE_EXCEPTION_CATCHING=0 --pre-js /home/loosetooth/git/manifold/bindings/wasm/bindings.js --bind -sALLOW_TABLE_GROWTH=1 -sEXPORTED_RUNTIME_METHODS=addFunction,removeFunction -sMODULARIZE=1 -sEXPORT_ES6=1 @CMakeFiles/manifoldjs.dir/objects1.rsp -o manifold.js @CMakeFiles/manifoldjs.dir/linklibs.rsp
/home/loosetooth/git/emsdk/upstream/emscripten/tools/acorn-optimizer.js:25
    throw new Error(text);
    ^

Error: ObjectPattern
    at assert (/home/loosetooth/git/emsdk/upstream/emscripten/tools/acorn-optimizer.js:25:11)
    at /home/loosetooth/git/emsdk/upstream/emscripten/tools/acorn-optimizer.js:382:9
    at Array.forEach (<anonymous>)
    at handleFunction (/home/loosetooth/git/emsdk/upstream/emscripten/tools/acorn-optimizer.js:374:19)
    at Object.FunctionExpression (/home/loosetooth/git/emsdk/upstream/emscripten/tools/acorn-optimizer.js:453:9)
    at c (/home/loosetooth/git/emsdk/upstream/emscripten/tools/acorn-optimizer.js:85:20)
    at recursiveWalk (/home/loosetooth/git/emsdk/upstream/emscripten/tools/acorn-optimizer.js:87:5)
    at /home/loosetooth/git/emsdk/upstream/emscripten/tools/acorn-optimizer.js:83:38
    at maybeChild (/home/loosetooth/git/emsdk/upstream/emscripten/tools/acorn-optimizer.js:47:7)
    at visitChildren (/home/loosetooth/git/emsdk/upstream/emscripten/tools/acorn-optimizer.js:54:10)
em++: error: '/home/loosetooth/git/emsdk/node/16.20.0_64bit/bin/node /home/loosetooth/git/emsdk/upstream/emscripten/tools/acorn-optimizer.js /tmp/emscripten_temp_6y0yiggg/manifold.js AJSDCE minifyWhitespace --exportES6 -o /tmp/emscripten_temp_6y0yiggg/manifold.jso1.js' failed (returned 1)
make[2]: *** [bindings/wasm/CMakeFiles/manifoldjs.dir/build.make:111: bindings/wasm/manifold.js] Error 1
make[2]: Leaving directory '/home/loosetooth/git/manifold/buildWASM'
make[1]: *** [CMakeFiles/Makefile2:605: bindings/wasm/CMakeFiles/manifoldjs.dir/all] Error 2
make[1]: Leaving directory '/home/loosetooth/git/manifold/buildWASM'
make: *** [Makefile:139: all] Error 2
emmake: error: 'make' failed (returned 2)

@pca006132
Copy link
Collaborator Author

yes, did you check the emsdk version?

@Loosetooth
Copy link
Contributor

I (think) I'm using the 'latest' emsdk version as specified in the readme:

~/git/emsdk$ ./emsdk install latest
Resolving SDK alias 'latest' to '3.1.48'
Resolving SDK version '3.1.48' to 'sdk-releases-694434b6d47c5f6eff2c8fbd9eeb016c977ae9dc-64bit'
Installing SDK 'sdk-releases-694434b6d47c5f6eff2c8fbd9eeb016c977ae9dc-64bit'..
Skipped installing node-16.20.0-64bit, already installed.
Skipped installing releases-694434b6d47c5f6eff2c8fbd9eeb016c977ae9dc-64bit, already installed.
All SDK components already installed: 'sdk-releases-694434b6d47c5f6eff2c8fbd9eeb016c977ae9dc-64bit'.

I made sure to fetch the latest emsdk data and update. Is this version the same as yours?

@pca006132
Copy link
Collaborator Author

Also adds emsdk version requirement. I found that the latest emsdk (3.1.48) has some issue and 3.1.45 works fine.

@Loosetooth
Copy link
Contributor

Ah woops, sorry for reading over that. Thanks for pointing it out again.

I can confirm that the WASM build now works on my local machine.

Copy link
Owner
@elalish elalish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@elalish
Copy link
Owner
elalish commented Nov 6, 2023

Did you file a bug on emscripten?

@zalo
Copy link
Contributor
zalo commented Nov 7, 2023

For what it's worth, on Windows, I'm getting fatal error C1083: Cannot open include file: 'thrust/binary_search.h': No such file or directory errors on master and this branch that I don't get on this branch from a couple months ago #558

Did the thrust setup change since then? Is this PR meant to fix that on Windows too?

@pca006132
Copy link
Collaborator Author

Did you file a bug on emscripten?

No I haven't, I can look into this later.

For what it's worth, on Windows, I'm getting fatal error C1083: Cannot open include file: 'thrust/binary_search.h': No such file or directory errors on master and this branch that I don't get on this branch from a couple months ago #558

Did the thrust setup change since then? Is this PR meant to fix that on Windows too?

Yes the thrust setup changed, but the failure is weird because we do have CI tests on Windows... Maybe you can apply the following patch:

diff --git a/src/utilities/CMakeLists.txt b/src/utilities/CMakeLists.txt
index a67f6af..b192a36 100644
--- a/src/utilities/CMakeLists.txt
+++ b/src/utilities/CMakeLists.txt
@@ -87,11 +87,13 @@ endif()
 target_include_directories(${PROJECT_NAME} INTERFACE ${PROJECT_SOURCE_DIR}/include)
 target_link_libraries(${PROJECT_NAME} INTERFACE glm::glm)
 if(DEFINED thrust_SOURCE_DIR)
+message(thrust_SOURCE_DIR: ${thrust_SOURCE_DIR})
 target_include_directories(${PROJECT_NAME} INTERFACE
     ${thrust_SOURCE_DIR}
     ${thrust_SOURCE_DIR}/dependencies/libcudacxx/include
 )
 else()
+    message(thrust_ROOT: ${thrust_ROOT})
 target_include_directories(${PROJECT_NAME} INTERFACE
     ${THRUST_ROOT}
     ${THRUST_ROOT}/dependencies/libcudacxx/include

run cmake again and show me the output?

@pca006132 pca006132 changed the title fix cmake problems fix wasm cmake problems Nov 7, 2023
@pca006132
Copy link
Collaborator Author

@zalo I think I am just going to merge this for now, and you can open a separate issue to track the Windows build issue.

@pca006132 pca006132 merged commit 0ef5f70 into elalish:master Nov 7, 2023
@pca006132 pca006132 deleted the fix-cmake branch November 7, 2023 12:32
@elalish elalish mentioned this pull request Nov 17, 2023
cartesian-theatrics pushed a commit to cartesian-theatrics/manifold that referenced this pull request Mar 11, 2024
* fix cmake problems

* update emsdk version
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

Successfully merging this pull request may close these issues.

4 participants
0