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

Fixing Maximum Memory=-1 issue in emcc.py #12708

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DhairyaBahl
Copy link
Contributor

PR for the issue #12462 . Sorry I mistakenly force pushed the previous PR.

emcc.py Outdated
@@ -320,7 +320,11 @@ def expand_byte_size_suffixes(value):
value = value.strip()
match = re.match(r'^(\d+)\s*([kmgt]?b)?$', value, re.I)
if not match:
exit_with_error("invalid byte size `%s`. Valid suffixes are: kb, mb, gb, tb" % value)
if value == -1:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think value is a string so this won't work.

How about you just to if value == '-1': return -1 adter the stripand before the thers.match`.

Also we should probably add a test

Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually, better still can you at -? to the beginning of the regular expression and have all negative things "just work"?

Copy link
Collaborator

Choose a reason for hiding this comment

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

So it would start with r'^(-?\d+)\s...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sbc100 so after adding -? and making it r'^(-?\d+)\s... we shouldn't need the if condition right ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, it should just work. You should even be able to do stuff like "-2Kb" and get -2048 out :)

@DhairyaBahl
Copy link
Contributor Author

@sbc100 I did the changes to the emcc.py now working on the tests and how to add them and will be referring to the documentation.

Thanks :)

@DhairyaBahl
Copy link
Contributor Author

@sbc100 kindly tell me what should I do, I have tried re-installing emsdk tried runner.py on different clone but it is not working, everytime is gives popup error BINARYEN ROOT SET TO EMPTY VALUE. Kindly help and guide me further.
(I am on windows could it possibly be a problem).

Thanks :)

@sbc100
Copy link
Collaborator

sbc100 commented Nov 10, 2020

Is you emsdk active? i.e. did you run emsdk activate latest? and can you run emcc to build simple programs? What does emcc --version say? What does where emcc say?

@DhairyaBahl
Copy link
Contributor Author

@sbc100

emsdk activate latest sets the evironment variables.

emcc --version :

emcc (Emscripten gcc/clang-like replacement) 2.0.8 (a498ec339d0a01ab5443f8a2b459f589dbe83243)
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

and this is for where emcc

C:\Users\Dhairya Bahl\Desktop\emscripten\emcc
C:\Users\Dhairya Bahl\Desktop\emscripten\emcc.bat
C:\Users\Dhairya Bahl\Desktop\emsdk\upstream\emscripten\emcc
C:\Users\Dhairya Bahl\Desktop\emsdk\upstream\emscripten\emcc.bat

@sbc100
Copy link
Collaborator

sbc100 commented Nov 10, 2020

Can you build hello world emcc tests/hello_world.c?

@sbc100
Copy link
Collaborator

sbc100 commented Nov 10, 2020

Can you try removing .emscripten from C:\Users\Dhairya Bahl\Desktop\emscripten\

@DhairyaBahl
Copy link
Contributor Author

DhairyaBahl commented Nov 10, 2020

@sbc100

Can you build hello world emcc tests/hello_world.c?

emcc tests/hello_world.c
shared:INFO: (Emscripten: Running sanity checks)
Fatal: globalBase must be set
emcc: error: '"C:/Users/Dhairya Bahl/Desktop/emsdk/upstream\bin\wasm-emscripten-finalize" --detect-features --minimize-wasm-changes --dyncalls-i64 a.out.wasm -o a.out.wasm' failed (1)

and there is no .emscripten in desktop/emscripten

@sbc100
Copy link
Collaborator

sbc100 commented Nov 10, 2020

You need to update to the very latest emsdk. You can do this with emsdk update-tags && emsdk install tot

@DhairyaBahl
Copy link
Contributor Author

@sbc100 Thank You so Much , I guess no its working . hello world is working and it is giving some valid output for the tests/runnery.py.

 python3 tests/runner.py
runner:WARNING: use EMTEST_ALL_ENGINES=1 in the env to run against all JS engines, which is slower but provides more coverage
WARNING: no 'numpy' module, HyBi protocol will be slower
WARNING: no 'resource' module, daemonizing is disabled
Test suites:
[]

@DhairyaBahl
Copy link
Contributor Author

@sbc100 Sorry to bother you again about tests. Actually I am unable to get it that how can I add test ??

@sbc100
Copy link
Collaborator

sbc100 commented Nov 12, 2020

Edit test_other.py and add your test to the end.

You can then run it with ./tests/runner.py other.test_xxxx

@DhairyaBahl
Copy link
Contributor Author

@sbc100 I am not that much experienced in this i am unable to understand what's written in the test_other.py . Is there any documentation that i can refer except test-suite one.

@sbc100
Copy link
Collaborator

sbc100 commented Nov 13, 2020

Not really I'm afraid. The only want to understand the tests right now is basically to look at what they are doing.

Most of them will just run the emcc compiler with certain options on certain input files.

@DhairyaBahl
Copy link
Contributor Author

@sbc100 I will try y best to understand the tests and to push the changes in this PR.

Thanks :)

Base automatically changed from master to main March 8, 2021 23:49
@stale
Copy link

stale bot commented Apr 16, 2022

This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant.

@stale stale bot added the wontfix label Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants