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

Enclave SGX_DEBUG mode not working #375

Closed
haerdib opened this issue Aug 26, 2021 · 9 comments · Fixed by #419
Closed

Enclave SGX_DEBUG mode not working #375

haerdib opened this issue Aug 26, 2021 · 9 comments · Fixed by #419
Assignees
Labels
F2-bug Something isn't working

Comments

@haerdib
Copy link
Contributor

haerdib commented Aug 26, 2021

When compiling the worker code in debug mode and starting the worker the following error occurs:

./substratee-worker run
thread 'main' panicked at 'Argument short must be unique

        -s is already in use', /home/ubuntu/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/clap-2.33.3/src/app/parser.rs:193:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

teaclave do not distinguish between debug and non debug mode regarding the cargo build paths. Is there a reason why we do?

Teaclave:

ifeq ($(SGX_DEBUG), 1)
	SGX_COMMON_CFLAGS += -O0 -g
else

We

ifeq ($(SGX_DEBUG), 1)
	SGX_COMMON_CFLAGS += -O0 -g -ggdb
	OUTPUT_PATH := debug
	CARGO_TARGET :=

@haerdib haerdib added the F2-bug Something isn't working label Aug 26, 2021
@clangenb
Copy link
Contributor

clangenb commented Aug 26, 2021

Maybe they distinguish between cargo build mode and enclave build mode.

In our case, SGX_DEBUG implies cargo debug mode, which changes the output dir. Maybe this i why teaclave does not do that?

@haerdib
Copy link
Contributor Author

haerdib commented Aug 26, 2021

I've tried the following:

  • completely clean & remake
  • remove all clap s shortcut commands
  • make on a different machine

Nothing worked. I then replaced the cargo output path with release aswell as the build modus set to --release, also in SGX_DEBUG=1, and it worked.

Is there any reason against using the cargo release build mode in SGX_DEBUG mode?

@brenzi
Copy link
Collaborator

brenzi commented Aug 29, 2021

I don't think we need cargo --debug. SGX_DEBUG should refer to HW mode with debugging enabled (as opposed to HW in production mode

@haerdib
Copy link
Contributor Author

haerdib commented Aug 30, 2021

Then I suggest to use cargo release for both modi, just like teaclave is doing.

@clangenb
Copy link
Contributor

I agree, I think we only lack some debug-symbols when compiling for release, which I believe nobody of us is using at the moment.

Furthermore, release yields significantly smaller binaries.

@brenzi
Copy link
Collaborator

brenzi commented Sep 7, 2021

so what's the action to be taken now?

@clangenb
Copy link
Contributor

clangenb commented Sep 7, 2021

I think closing this issue as won't fix.

@clangenb
Copy link
Contributor

clangenb commented Sep 8, 2021

I have just seen that I actually gave the wrong advice. I think we should just cargo --release in any case

@haerdib
Copy link
Contributor Author

haerdib commented Sep 9, 2021

I think we need to update our makefile anyway to solve issue #373 and https://github.com/integritee-network/deployment/issues/6. As this process will include quite some adaptions to match the makefile of teaclave, this issue could easily be solved along the way.

murerfel pushed a commit that referenced this issue Sep 23, 2021
Use cargo --release also in case of SGX_DEBUG=1 and hence also the corresponding target/release folder. Closes #375
murerfel pushed a commit that referenced this issue Sep 23, 2021
Use cargo --release also in case of SGX_DEBUG=1 and hence also the corresponding target/release folder. Closes #375
murerfel pushed a commit that referenced this issue Sep 23, 2021
Use cargo --release also in case of SGX_DEBUG=1 and hence also the corresponding target/release folder. Closes #375
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F2-bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants