Intel® Software Guard Extensions (Intel® SGX)
Discussion board focused on hardware-based isolation and memory encryption to provide extended code protection in solutions.
1481 Discussions

error code 307 in building RA sample under VS2019 & 2017 community and win10

SunnySun
Beginner
1,590 Views

Hi, Intel

When I build the RA sample code of sgx-ra-sample under VS2019 & 2017 community and win10,  there are two errors of MSB 307 and the code is 1 and 5. The screen shot as follows.

SunnySun_0-1629724123103.png

I suspect this error may due to insufficient permissions when building sp and mrsigner, but I still encounter these two problems when I open the RA project with administrator permissions. 

 

Can you tell me how to fix this problem. Thanks

 

 

 

0 Kudos
1 Solution
JesusG_Intel
Moderator
1,576 Views

Hello SunnySun,


The build events associated with the projects mrsigner and sp need to be modified.


In mrsigner, in the Post-Build Event, change $(IntDir) to $(OutDir).

Edit mrsigner -> Properties -> Build Events -> Post-Build Event -> Command Line: "$(TargetPath)" $(IntDir)enclave_sigstruct_raw > $(IntDir)enclave_mrsigner.txt -> "$(TargetPath)" $(OutDir)enclave_sigstruct_raw > $(OutDir)enclave_mrsigner.txt


In sp, in the Pre-Build Event, add ..\ to policy.in.

Edit sp -> Properties -> Build Events -> Pre-Build Event - Command Line:  powershell -command "$mrs=Get-Content -Path ..\mrsigner\$(IntDir)enclave_mrsigner.txt; ( ( Get-Content -Path ..\policy.in -Raw ) -replace '@MRSIGNER@',$mrs ) | Set-Content $(IntDir)policy.cmd"


Sincerely,

Jesus G.

Intel Customer Support


View solution in original post

0 Kudos
5 Replies
JesusG_Intel
Moderator
1,577 Views

Hello SunnySun,


The build events associated with the projects mrsigner and sp need to be modified.


In mrsigner, in the Post-Build Event, change $(IntDir) to $(OutDir).

Edit mrsigner -> Properties -> Build Events -> Post-Build Event -> Command Line: "$(TargetPath)" $(IntDir)enclave_sigstruct_raw > $(IntDir)enclave_mrsigner.txt -> "$(TargetPath)" $(OutDir)enclave_sigstruct_raw > $(OutDir)enclave_mrsigner.txt


In sp, in the Pre-Build Event, add ..\ to policy.in.

Edit sp -> Properties -> Build Events -> Pre-Build Event - Command Line:  powershell -command "$mrs=Get-Content -Path ..\mrsigner\$(IntDir)enclave_mrsigner.txt; ( ( Get-Content -Path ..\policy.in -Raw ) -replace '@MRSIGNER@',$mrs ) | Set-Content $(IntDir)policy.cmd"


Sincerely,

Jesus G.

Intel Customer Support


0 Kudos
SunnySun
Beginner
1,564 Views

Hi, Jesus G.

 

Thanks for your help. I have solved these two problems in VS 2017, and the problem in project mrsigner in VS 2019.

However, in the VS 2019, the problem still exists in the project sp. I don't know if it is related to the version of VS.

 

Sincerely,

SunnySun

0 Kudos
JesusG_Intel
Moderator
1,537 Views

Hello SunnySun,


The problem seems that the command is not able to find the policy.in file.


The default location of policy.in is under sgx-ra-sample/vs/policy.in.


During the pre-build event, the powershell command is executed from directory sgx-ra-sample/vs/service-provider. Hence we place ../ in front of policy.in in the powershell command line so that it can policy.in one level up.


So, knowing that the powershell command runs in sgx-ra-sample/vs/service-provider you have to tell the powershell command the correct relative path to policy.in.


This works on my VS 2019 environment.


Sincerely,

Jesus G.

Intel Customer Support




0 Kudos
JesusG_Intel
Moderator
1,503 Views

Hello SunnSun,


Do you still need help with this issue?


Sincerely,

Jesus G.

Intel Customer Support


0 Kudos
JesusG_Intel
Moderator
1,463 Views

Hello SunnySun,


I hope you have been able to resolve your issue. I have not heard back from you so I will close this inquiry now. If you need further assistance, please open a new thread.


Sincerely,

Jesus G.

Intel Customer Support


0 Kudos
Reply