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

Coreclr build fails with error : __declspec attribute 'selectany' is not supported #9325

Closed
sam0302 opened this issue Nov 23, 2017 · 7 comments
Labels
area-Infrastructure-coreclr bug help wanted [up-for-grabs] Good issue for external contributors os-unsupported OS which is not officially supported
Milestone

Comments

@sam0302
Copy link

sam0302 commented Nov 23, 2017

I am trying to build coreclr using yocto for Raspberry pi platform. I am using the bitbake layer from https://github.com/Tragetaschen/meta-aspnet.
I am getting compilation issue as below:

/coreclr/2.0.0-r0/git/src/inc/cor.h:2210:1: error: __declspec attribute 'selectany' is not supported [-Werror,-Wignored-attributes]
SELECTANY const mdToken g_tkCorEncodeToken[4] ={mdtTypeDef, mdtTypeRef, mdtTypeSpec, mdtBaseType};
^
/build/tmp/work/xxx-linux-gnueabi/coreclr/2.0.0-r0/git/src/inc/cor.h:2207:41: note: expanded from macro 'SELECTANY'
#define SELECTANY extern __declspec(selectany)

also below error
2.

/build/tmp/work/xxx-linux-gnueabi/coreclr/2.0.0-r0/git/src/pal/src/loader/module.cpp:1176:5: error: lambda capture '__param' is not used [-Werror,-Wunused-lambda-capture]
PAL_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
^
/build/tmp/work/xxx-linux-gnueabi/coreclr/2.0.0-r0/git/src/pal/inc/pal.h:6091:44: note: expanded from macro 'PAL_EXCEPT'
auto exceptionFilter = [&disposition, &__param](PAL_SEHException& ex) \

Please suggest what could be the issue

@jkotas
Copy link
Member

jkotas commented Nov 23, 2017

cc @janvorli

@janvorli
Copy link
Member

@sam0302 it is a bug in the clang 5.0 compiler, it seems that they are going to fix it for 5.1 release.

@sam0302
Copy link
Author

sam0302 commented Nov 24, 2017

Thanks jan, I got a patch fix for 1st error : SELECTANY issue here: https://reviews.llvm.org/D33852
Is there any patch fix for 2nd error, where we get error for unused variable in lambda capture.
I want to apply the patch locally so that i can build coreclr successfully.

@janvorli
Copy link
Member

You silent the 2nd error by adding

(void)__param;

right before the following line src/pal/src/loader/module.cpp:1178

WARN("Call to DllMain (%p) got an unhandled exception; ignoring.\n", module->pDllMain);

@jkotas
Copy link
Member

jkotas commented Nov 24, 2017

If this fixes the error for you, it would be great if you can submit CoreCLR PR with the fix.

@sam0302
Copy link
Author

sam0302 commented Nov 24, 2017

I tried the above changes of adding (void)__param; However this does not fix the issue...
I am getting this error from 3 different files and everywhere i made same changes but the issue persists

/src/pal/src/loader/module.cpp:1176:5: error: lambda capture '__param' is not used [-Werror,-Wunused-lambda-capture]
PAL_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
/src/vm/stubmgr.cpp:475:5: error: lambda capture '__param' is not used [-Werror,-Wunused-lambda-capture]
PAL_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
/src/vm/util.cpp:3256:5: error: lambda capture '__param' is not used [-Werror,-Wunused-lambda-capture]
PAL_EXCEPT(EXCEPTION_EXECUTE_HANDLER)

@janvorli
Copy link
Member

@sam0302 I am sorry for misleading you. This is not a correct fix. The right way to do that is to modify the PAL_EXCEPT macro. Can you please add the

(void)__param;

to the PAL_EXCEPT macro definition right before the line https://github.com/dotnet/coreclr/blob/master/src/pal/inc/pal.h#L5924?

The thing is that the __param can be used by the dispositionExpression, but in many cases the dispositionExpression is just a constant and so it is unused.

@msftgits msftgits transferred this issue from dotnet/coreclr Jan 31, 2020
@msftgits msftgits added this to the Future milestone Jan 31, 2020
@msftbot msftbot bot locked as resolved and limited conversation to collaborators Dec 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Infrastructure-coreclr bug help wanted [up-for-grabs] Good issue for external contributors os-unsupported OS which is not officially supported
Projects
None yet
Development

No branches or pull requests

6 participants
@sam0302 @jkotas @msftgits @janvorli @sandreenko and others