ArgumentException on UWP component in ASP.NET, but not in console .NET - asp.net

I'm trying to consume an UWP component in an ASP.NET page. The minimal code goes:
public partial class _default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Try();
}
private void Try()
{
Debug.WriteLine("Before");
Windows.Foundation.Collections.StringMap sm = new Windows.Foundation.Collections.StringMap();
Debug.WriteLine("After");
}
}
In order to make this compile, you need to add the following line to the project file:
<TargetPlatformVersion>10.0</TargetPlatformVersion>
and add a reference to Windows.Foundation from the "Universal Windows" category. The yellow error screen goes:
The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
and it shows the last line of Try() as the error location, but that's misleading; the error is thrown in the JIT compiler when the framework tries to compile the method Try(). Same error with any other UWP class, I've tried several.
This fails both under IIS Express and IIS proper. The same code works as expected in a console .NET application.
What is the difference of execution environment under desktop/console and under ASP.NET? Not the current user; in IIS Express scenario, the current user is me. Not the apartment's threading model; I've tried it on an STA thread and on an MTA thread.
EDIT: it's a bug at VS Connect now. If you're affected, go over there and click "I can too".

The error has to do with ASP.NET's AppDomain assembly share policy, which roughly corresponds to the LoaderOptimization parameter of AppDomainSetup. If the UWP consuming code is executed in an AppDomain where LoaderOptimization is set to SingleDomain (default for desktop apps), it works. ASP.NET hard-codes this setting to MultiDomainHost. It's probably a CLR bug on some level.
I've found no good, legal way to change the setting for the ASP.NET's sandbox appdomains, but you can create a new appdomain, with all the same parameters as the sandbox except for the LoaderOptimization:
AppDomain CreateUnsharingDomain()
{
AppDomain cad = AppDomain.CurrentDomain;
AppDomainSetup cads = cad.SetupInformation;
return AppDomain.CreateDomain("Dummy", cad.Evidence,
new AppDomainSetup
{
ApplicationName = cads.ApplicationName,
ApplicationBase = cads.ApplicationBase,
DynamicBase = cads.DynamicBase,
CachePath = cads.CachePath,
PrivateBinPath = cads.PrivateBinPath,
ShadowCopyDirectories = cads.ShadowCopyDirectories,
ShadowCopyFiles = cads.ShadowCopyFiles,
ApplicationTrust = cads.ApplicationTrust,
LoaderOptimization = LoaderOptimization.SingleDomain
});
//Not sure which other properties to copy...
}
CreateUnsharingDomain().DoCallBack(() =>
{
Debug.WriteLine("Before");
Windows.Foundation.Collections.StringMap sm = new Windows.Foundation.Collections.StringMap();
Debug.WriteLine("After");
});
This works. I'm still not entirely satisfied with the answer. It's rather verbose, and passing calls and objects across AppDomain boundaries is a chore. I'm investigating whether you can set this in a config file.
EDIT: probably impossible. ASP.NET doesn't explicitly specify the LoaderOptimization on its AppDomains. Instead, when the domain level assembly sharing policy is queried, the framework falls back to the the per-process sharing policy, which is initialized on CLR process startup, based on the value of the LoaderOptimization attribute on the process' Main function. Since that one's deep within ASP.NET's code, there's no way to alter the global policy.
Sharing can be, in theory, disabled on per-assembly basis, but for WinRT ones, the assemblies in Windows.* namespace are all considered shareable, with no hook in sight to override that.
Speaking of illegal ways to change the LoaderOptimization on an AppDomain, there's private method SetupLoaderOptimization(LoaderOptimization policy) in the AppDomain class. You can call it via reflection, with all the usual caveats:
AppDomain ad = AppDomain.CurrentDomain;
MethodInfo mi = ad.GetType().GetMethod("SetupLoaderOptimization", BindingFlags.Instance | BindingFlags.NonPublic);
mi.Invoke(ad, new object[] { LoaderOptimization.SingleDomain });
//And for the win:
Windows.Foundation.Collections.StringMap sm = new Windows.Foundation.Collections.StringMap();
This worked for me, too. You decide which approach is less problematic. The latter has less lines, the former doesn't rely on undocumented private methods.
Hairy details below, proceed at your own risk.
Debugging IISExpress with the native debugger shows a C++ exception being thrown at the following stack:
KernelBase.dll!_RaiseException#16() Unknown
msvcr120_clr0400.dll!__CxxThrowException#8() Unknown
clr.dll!DomainFile::ExInfo::Throw(void) Unknown
clr.dll!DomainFile::EnsureLoadLevel(enum FileLoadLevel) Unknown
clr.dll!AppDomain::LoadDomainAssemblyInternal(class AssemblySpec *,class PEAssembly *,enum FileLoadLevel,struct AssemblyLoadSecurity *) Unknown
clr.dll!AppDomain::LoadDomainAssembly(class AssemblySpec *,class PEAssembly *,enum FileLoadLevel,struct AssemblyLoadSecurity *) Unknown
clr.dll!CLRPrivTypeCacheWinRT::ContainsType(struct ICLRPrivAssembly *,unsigned short const *) Unknown
clr.dll!CLRPrivBinderWinRT::BindWinRTAssemblyByName(struct IAssemblyName *,class CLRPrivAssemblyWinRT * *,int) Unknown
clr.dll!CLRPrivBinderWinRT::BindWinRTAssemblyByName(struct IAssemblyName *,struct ICLRPrivAssembly * *,int) Unknown
clr.dll!CLRPrivBinderWinRT::BindAssemblyByName(struct IAssemblyName *,struct ICLRPrivAssembly * *) Unknown
clr.dll!AppDomain::BindAssemblySpecForHostedBinder(class AssemblySpec *,struct IAssemblyName *,struct ICLRPrivBinder *,class PEAssembly * *) Unknown
clr.dll!AppDomain::BindAssemblySpec(class AssemblySpec *,int,int,enum StackCrawlMark *,struct AssemblyLoadSecurity *,int) Unknown
clr.dll!PEFile::LoadAssembly(unsigned int,struct IMDInternalImport *,char const *,char const *) Unknown
clr.dll!Module::LoadAssembly(class AppDomain *,unsigned int,char const *,char const *) Unknown
clr.dll!Assembly::FindModuleByTypeRef(class Module *,unsigned int,enum Loader::LoadFlag,int *) Unknown
clr.dll!ClassLoader::LoadTypeDefOrRefThrowing(class Module *,unsigned int,enum ClassLoader::NotFoundAction,enum ClassLoader::PermitUninstantiatedFlag,unsigned int,enum ClassLoadLevel) Unknown
clr.dll!MemberLoader::GetDescFromMemberRef(class Module *,unsigned int,class MethodDesc * *,class FieldDesc * *,class SigTypeContext const *,int,class TypeHandle *,int,unsigned char const * *,unsigned long *) Unknown
clr.dll!CEEInfo::resolveToken(struct CORINFO_RESOLVED_TOKEN *) Unknown
clrjit.dll!Compiler::impResolveToken(unsigned char const *,struct CORINFO_RESOLVED_TOKEN *,enum CorInfoTokenKind) Unknown
clrjit.dll!Compiler::impImportBlockCode(struct BasicBlock *) Unknown
clrjit.dll!Compiler::impImportBlock(struct BasicBlock *) Unknown
clrjit.dll!Compiler::impImport(struct BasicBlock *) Unknown
clrjit.dll!Compiler::compCompile(void * *,unsigned long *,unsigned int) Unknown
So there's a problem with loading the UWP library into the app domain as an assembly... Some difference in AppDomain settings? I've tried in a freshly created AppDomain, same result.
EDIT: I did enable logging, the message was rather inconclusive:
The operation was successful.
Bind result: hr = 0x1. Incorrect function.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Program Files (x86)\IIS Express\iisexpress.exe
--- A detailed error log follows.
BEGIN : Native image bind.
END : Incorrect function. (Exception from HRESULT: 0x00000001 (S_FALSE))
Probably related: Why am I unable to do an Assembly.Load of WinMD files?
EDIT2: the call stack above comes on second attempt to use the UWP class. The first attempt shows a different call stack; it could be that CLR caches the "can't load" status and reuses it. Here goes:
KernelBase.dll!_RaiseException#16() Unknown
msvcr120_clr0400.dll!__CxxThrowException#8() Unknown
clr.dll!ThrowHR(long) Unknown
clr.dll!DomainCanShareAptcaAssembly(class DomainAssembly *) Unknown
clr.dll!DomainAssembly::ShouldLoadDomainNeutralHelper(void) Unknown
clr.dll!DomainAssembly::ShouldLoadDomainNeutral(void) Unknown
clr.dll!DomainAssembly::Allocate(void) Unknown
clr.dll!DomainFile::DoIncrementalLoad(enum FileLoadLevel) Unknown
clr.dll!AppDomain::TryIncrementalLoad(class DomainFile *,enum FileLoadLevel,class Wrapper<class FileLoadLock *,&DoNothing<class FileLoadLock *>(class FileLoadLock *),&FileLoadLock::HolderLeave(class FileLoadLock *),0,&CompareDefault<class FileLoadLock *>(class FileLoadLock *,class FileLoadLock *),2,1> &) Unknown
clr.dll!AppDomain::LoadDomainFile(class FileLoadLock *,enum FileLoadLevel) Unknown
clr.dll!AppDomain::LoadDomainAssemblyInternal(class AssemblySpec *,class PEAssembly *,enum FileLoadLevel,struct AssemblyLoadSecurity *) Unknown
clr.dll!AppDomain::LoadDomainAssembly(class AssemblySpec *,class PEAssembly *,enum FileLoadLevel,struct AssemblyLoadSecurity *) Unknown
clr.dll!CLRPrivTypeCacheWinRT::ContainsType(struct ICLRPrivAssembly *,unsigned short const *) Unknown
clr.dll!CLRPrivBinderWinRT::BindWinRTAssemblyByName(struct IAssemblyName *,class CLRPrivAssemblyWinRT * *,int) Unknown
clr.dll!CLRPrivBinderWinRT::BindWinRTAssemblyByName(struct IAssemblyName *,struct ICLRPrivAssembly * *,int) Unknown
clr.dll!CLRPrivBinderWinRT::BindAssemblyByName(struct IAssemblyName *,struct ICLRPrivAssembly * *) Unknown
clr.dll!AppDomain::BindAssemblySpecForHostedBinder(class AssemblySpec *,struct IAssemblyName *,struct ICLRPrivBinder *,class PEAssembly * *) Unknown
clr.dll!AppDomain::BindAssemblySpec(class AssemblySpec *,int,int,enum StackCrawlMark *,struct AssemblyLoadSecurity *,int) Unknown
clr.dll!PEFile::LoadAssembly(unsigned int,struct IMDInternalImport *,char const *,char const *) Unknown
clr.dll!Module::LoadAssembly(class AppDomain *,unsigned int,char const *,char const *) Unknown
clr.dll!Assembly::FindModuleByTypeRef(class Module *,unsigned int,enum Loader::LoadFlag,int *) Unknown
clr.dll!ClassLoader::LoadTypeDefOrRefThrowing(class Module *,unsigned int,enum ClassLoader::NotFoundAction,enum ClassLoader::PermitUninstantiatedFlag,unsigned int,enum ClassLoadLevel) Unknown
clr.dll!MemberLoader::GetDescFromMemberRef(class Module *,unsigned int,class MethodDesc * *,class FieldDesc * *,class SigTypeContext const *,int,class TypeHandle *,int,unsigned char const * *,unsigned long *) Unknown
clr.dll!CEEInfo::resolveToken(struct CORINFO_RESOLVED_TOKEN *) Unknown
clrjit.dll!Compiler::impResolveToken(unsigned char const *,struct CORINFO_RESOLVED_TOKEN *,enum CorInfoTokenKind) Unknown
clrjit.dll!Compiler::impImportBlockCode(struct BasicBlock *) Unknown
clrjit.dll!Compiler::impImportBlock(struct BasicBlock *) Unknown
clrjit.dll!Compiler::impImport(struct BasicBlock *) Unknown
clrjit.dll!Compiler::compCompile(void * *,unsigned long *,unsigned int) Unknown
APTCA stands for "AllowPartiallyTrustedCallersAttribute". However, running under full trust (via system.web/fullTrustAssemblies) doesn't help at all.
At the time of the exception, the Modules window in the native debugger shows Windows.Foundation.winmd as loaded. So it's not an artifact of file not being found somehow.
EDIT: this definitely has to do with the fact that under ASP.NET, code is run as partially trusted, in a sandboxed AppDomain. In a non-sandbox AppDomain, this logic won't be even called. The error is not a security violation though, or the message would've probably been different.
EDIT: tracked it down to a source location. In aptca.cpp, in DomainCanShareAptcaAssembly(), there's a line:
IfFailThrow(pDomainAssembly->GetAppDomain()->GetFusionContext()->GetAssemblyBindingClosure(pFusionAssembly, pNIPath, &pClosure));
which fails and throws, because the pFusionAssembly argument is null. The argument is null, because the local variable pFusionAssembly is null. The local variable is initialized in the line
pFusionAssembly = pDomainAssembly->GetFile()->GetIHostAssembly();
which is null, because the pDomainAssembly object is created in the AppDomain::BindHostedPrivAssembly() (in appdomain.cpp) via the PEAssembly:Open() call with 5 args, which passes a hard-coded nullptr in the pHostAssembly parameter. That's probably a subtle bug in CLR, but a workaround is entirely possible - the very call to DomainCanShareAptcaAssembly() can be shorted out.
The code path that leads to DomainCanShareAptcaAssembly() is taken only if the assembly loading logic tries to share an assembly between app domains. In ASP.NET, that's case. The difference in codepaths begins with the AppDomain::ApplySharePolicyFlag() function which calls GetSharePolicy(); in the ASP.NET environment, the latter returns 3 (SHARE_POLICY_GAC), while in the console project it returns 1 (SHARE_POLICY_NEVER). The share policy is driven by the LoaderOptimization parameter of AppDomainSetup. As long as the domain runs at SingleDomain, the sharing logic is shorted out and UWP works.

Related

ESP32 AsyncWebServer

I currently trying to setup an Async Web Server on the ESP32. But unfortunately I don't get the code to run. I'm usign platform io on windows 10.
#include <Arduino.h>
#include <ESPAsyncWebServer.h>
const char* ssid = "myAP";
const char* password = "123456789";
AsyncWebServer server(80);
setup() and loop() are empty.
If I try to compile the code these message shows up.
compilation terminated.
C:\Users\x\.platformio\lib\ESPAsyncTCP_ID305\src\AsyncPrinter.cpp: In constructor 'AsyncPrinter::AsyncPrinter(AsyncClient*, size_t)':
C:\Users\xanix\.platformio\lib\ESPAsyncTCP_ID305\src\AsyncPrinter.cpp:48:11: error: 'panic' was not declared in this scope
panic(); //What should we do?
^
C:\Users\x\.platformio\lib\ESPAsyncTCP_ID305\src\AsyncPrinter.cpp: In member function 'int AsyncPrinter::connect(IPAddress, uint16_t)':
C:\Users\xanix\.platformio\lib\ESPAsyncTCP_ID305\src\AsyncPrinter.cpp:71:11: error: 'panic' was not declared in this scope
panic();
^
C:\Users\x\.platformio\lib\ESPAsyncTCP_ID305\src\AsyncPrinter.cpp: In member function 'size_t AsyncPrinter::_sendBuffer()':
C:\Users\xanix\.platformio\lib\ESPAsyncTCP_ID305\src\AsyncPrinter.cpp:182:11: error: 'panic' was not declared in this scope
panic(); // Connection should be aborted instead
^
^
C:\Users\x\.platformio\lib\ESPAsyncTCP_ID305\src\ESPAsyncTCPbuffer.cpp: In member function 'size_t AsyncTCPbuffer::_handleRxBuffer(uint8_t*, size_t)':
C:\Users\xanix\.platformio\lib\ESPAsyncTCP_ID305\src\ESPAsyncTCPbuffer.cpp:469:21: error: 'panic' was not declared in this scope
panic(); //TODO: What action should this be ?
C:\Users\x\.platformio\lib\ESPAsyncTCP_ID305\src\ESPAsyncTCP.cpp: In member function 'bool AsyncClient::operator==(const AsyncClient&)':
C:\Users\xanix\.platformio\lib\ESPAsyncTCP_ID305\src\ESPAsyncTCP.cpp:331:66: error: 'ip_addr_t {aka struct ip_addr}' has no membec
r named 'addr'
return (_pcb != NULL && other._pcb != NULL && (_pcb->remote_ip.addr == other._pcb->remote_ip.addr) && (_pcb->remote_port == other._pcb->remote_port));
^
C:\Users\x\.platformio\lib\ESPAsyncTCP_ID305\src\ESPAsyncTCP.cpp: In member function 'void AsyncClient::_dns_found(const ip_addr*)':
C:\Users\xanix\.platformio\lib\ESPAsyncTCP_ID305\src\ESPAsyncTCP.cpp:707:31: error: 'const struct ip_addr' has no member named 'addr'
connect(IPAddress(ipaddr->addr), _connect_port);
^
C:\Users\x\.platformio\lib\ESPAsyncTCP_ID305\src\ESPAsyncTCP.cpp: In member function 'uint32_t AsyncClient::getRemoteAddress()':
C:\Users\xanix\.platformio\lib\ESPAsyncTCP_ID305\src\ESPAsyncTCP.cpp:837:26: error: 'ip_addr_t {aka struct ip_addr}' has no member named 'addr'
return _pcb->remote_ip.addr;
^
C:\Users\x\.platformio\lib\ESPAsyncTCP_ID305\src\ESPAsyncTCP.cpp: In member function 'uint32_t AsyncClient::getLocalAddress()':
C:\Users\xanix\.platformio\lib\ESPAsyncTCP_ID305\src\ESPAsyncTCP.cpp:849:25: error: 'ip_addr_t {aka struct ip_addr}' has no member named 'addr'
return _pcb->local_ip.addr;
^
C:\Users\x\.platformio\lib\ESPAsyncTCP_ID305\src\ESPAsyncTCP.cpp: In member function 'void AsyncServer::begin()':
C:\Users\xanix\.platformio\lib\ESPAsyncTCP_ID305\src\ESPAsyncTCP.cpp:1122:14: error: 'ip_addr_t {aka struct ip_addr}' has no member named 'addr'
local_addr.addr = (uint32_t) _addr;
^
You're using the wrong async TCP library. The one you're using is for the ESP8266, not the ESP32.
Here's its PlatformIO library registry entry:
https://platformio.org/lib/show/305/ESPAsyncTCP
You're seeing errors because it's trying to call functions that are available on the ESP8266 and not the ESP32.
You want the AsyncTCP library:
https://platformio.org/lib/show/1826/AsyncTCP
You should update your platformio.lib file to include this library instead of ESPAsyncTCP. You may also need to remove the build or library directory to get rid of the old library.
had the same issue, downgrading the core of PlatformIO solved for me the issue.
pip install -U "platformio<4.2.0"

Error when building nginx docker

I am trying to build a docker from a fork and I am getting the following error when performing docker build ./:
cc1: all warnings being treated as errors
make[1]: *** [objs/src/event/ngx_event_openssl.o] Error 1
objs/Makefile:748: recipe for target 'objs/src/event/ngx_event_openssl.o' failed
make[1]: Leaving directory '/tmp/nginx/nginx-1.8.0'
make: *** [install] Error 2
On install we run
apt-get -y install libpcre3-dev zlib1g-dev libssl-dev openssl build-essential wget
I can't find this error on google. The full error for reference as I can't find out the exact error reference I need to research:
src/event/ngx_event_openssl.c: In function 'ngx_ssl_init':
src/event/ngx_event_openssl.c:112:5: error: 'OPENSSL_config' is deprecated [-Werror=deprecated-declarations]
OPENSSL_config(NULL);
^~~~~~~~~~~~~~
In file included from /usr/include/openssl/ct.h:13:0,
from /usr/include/openssl/ssl.h:61,
from src/event/ngx_event_openssl.h:15,
from src/core/ngx_core.h:80,
from src/event/ngx_event_openssl.c:9:
/usr/include/openssl/conf.h:92:1: note: declared here
DEPRECATEDIN_1_1_0(void OPENSSL_config(const char *config_name))
^
src/event/ngx_event_openssl.c: In function 'ngx_ssl_rsa512_key_callback':
src/event/ngx_event_openssl.c:753:9: error: 'RSA_generate_key' is deprecated [-Werror=deprecated-declarations]
key = RSA_generate_key(512, RSA_F4, NULL, NULL);
^~~
In file included from /usr/include/openssl/rsa.h:13:0,
from /usr/include/openssl/x509.h:31,
from /usr/include/openssl/ssl.h:50,
from src/event/ngx_event_openssl.h:15,
from src/core/ngx_core.h:80,
from src/event/ngx_event_openssl.c:9:
/usr/include/openssl/rsa.h:193:1: note: declared here
DEPRECATEDIN_0_9_8(RSA *RSA_generate_key(int bits, unsigned long e, void
^
src/event/ngx_event_openssl.c: In function 'ngx_ssl_dhparam':
src/event/ngx_event_openssl.c:943:11: error: dereferencing pointer to incomplete type 'DH {aka struct dh_st}'
dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
^~
src/event/ngx_event_openssl.c: In function 'ngx_ssl_handshake':
src/event/ngx_event_openssl.c:1164:31: error: dereferencing pointer to incomplete type 'SSL {aka struct ssl_st}'
if (c->ssl->connection->s3) {
^~
src/event/ngx_event_openssl.c: In function 'ngx_ssl_connection_error':
src/event/ngx_event_openssl.c:1913:21: error: 'SSL_R_NO_CIPHERS_PASSED' undeclared (first use in this function)
|| n == SSL_R_NO_CIPHERS_PASSED /* 182 */
^~~~~~~~~~~~~~~~~~~~~~~
src/event/ngx_event_openssl.c:1913:21: note: each undeclared identifier is reported only once for each function it appears in
src/event/ngx_event_openssl.c: In function 'ngx_ssl_session_cache':
src/event/ngx_event_openssl.c:2107:43: error: passing argument 2 of 'SSL_CTX_sess_set_get_cb' from incompatible pointer type [-Werror=incompatible-pointer-types]
SSL_CTX_sess_set_get_cb(ssl->ctx, ngx_ssl_get_cached_session);
^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/event/ngx_event_openssl.h:15:0,
from src/core/ngx_core.h:80,
from src/event/ngx_event_openssl.c:9:
/usr/include/openssl/ssl.h:637:6: note: expected 'SSL_SESSION * (*)(struct ssl_st *, const unsigned char *, int, int *) {aka struct ssl_session_st * (*)(struct ssl_st *, const unsigned char *, int, int *)}' but argument is of type 'SSL_SESSION * (*)(SSL *, u_char *, int, int *) {aka struct ssl_session_st * (*)(struct ssl_st *, unsigned char *, int, int *)}'
void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx,
^~~~~~~~~~~~~~~~~~~~~~~
src/event/ngx_event_openssl.c: In function 'ngx_ssl_session_id_context':
src/event/ngx_event_openssl.c:2129:27: error: storage size of 'md' isn't known
EVP_MD_CTX md;
^~
src/event/ngx_event_openssl.c:2195:5: error: implicit declaration of function 'EVP_MD_CTX_cleanup' [-Werror=implicit-function-declaration]
EVP_MD_CTX_cleanup(&md);
^~~~~~~~~~~~~~~~~~
src/event/ngx_event_openssl.c: In function 'ngx_ssl_session_ticket_key_callback':
src/event/ngx_event_openssl.c:2864:9: error: 'RAND_pseudo_bytes' is deprecated [-Werror=deprecated-declarations]
RAND_pseudo_bytes(iv, 16);
^~~~~~~~~~~~~~~~~
In file included from /usr/include/openssl/engine.h:19:0,
from src/event/ngx_event_openssl.h:22,
from src/core/ngx_core.h:80,
from src/event/ngx_event_openssl.c:9:
/usr/include/openssl/rand.h:47:1: note: declared here
DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num))
^
cc1: all warnings being treated as errors
make[1]: *** [objs/src/event/ngx_event_openssl.o] Error 1
objs/Makefile:748: recipe for target 'objs/src/event/ngx_event_openssl.o' failed
make[1]: Leaving directory '/tmp/nginx/nginx-1.8.0'
make: *** [install] Error 2
This is the docker fork I am running https://github.com/meteorhacks/mup-frontend-server
You are getting various errors and warnings here, but they aren't really about Docker or OpenSSL. If we strip away the extraneous information, here are the problems you are encountering.
error: 'OPENSSL_config' is deprecated
error: 'RSA_generate_key' is deprecated
error: dereferencing pointer to incomplete type 'DH {aka struct dh_st}'
error: dereferencing pointer to incomplete type 'SSL {aka struct ssl_st}'
error: 'SSL_R_NO_CIPHERS_PASSED' undeclared (first use in this function)
error: passing argument 2 of 'SSL_CTX_sess_set_get_cb' from incompatible pointer type
error: storage size of 'md' isn't known
error: implicit declaration of function 'EVP_MD_CTX_cleanup'
error: 'RAND_pseudo_bytes' is deprecated
The core of the problem here is probably that you are using a legacy version of Nginx in this project. From the GitHub repository you pointed to, in install-nginx.sh:
NGINX_VERSION=1.8.0
The current mainline version of Nginx is 1.13.2. I haven't combed through the changelogs for Nginx, but based on the errors you are receiving, it seems likely that between the 1.8 releases and the current ones, OpenSSL has deprecated various functions that Nginx 1.8 relied on. Most likely this can be solved by moving to a recent release of Nginx.
As of this writing, 1.13.2 is the current mainline, and 1.12.0 is the current stable. One of those may work better. Whether you can simply drop this in, I can't say. You may have to change something in the build scripts or the nginx config for a more recent version to work properly.
you are getting this error because your nginx version don't support SSL 1.1.0. Either upgrade NGINX version or use SSL 1.0.2.

Are custom sources supported with the IMFCaptureEngine?

I've got a custom source that seams to work with a simple topology. When QueryInterface gets called the stack looks like this:
MySource.dll!MySource::QueryInterface(const _GUID & riid, void * * ppv) Line 83 C++
mfcore.dll!CMediaEventPtr::GetUnknown(struct IMFMediaEvent *,struct _GUID const &,void * *) Unknown
mfcore.dll!CMPSourceManager::OnNewStream() Unknown
mfcore.dll!CMPSourceManager::OnSourceEvent() Unknown
mfcore.dll!CMPSourceManager::OnSourceEventAsyncCallback::Invoke(struct IMFAsyncResult *) Unknown
Using the same custom source without a topology, letting IMFCaptureEngine deal with that. When QueryInterface gets called the stack looks like this:
MySource.dll!MySource::QueryInterface(const _GUID & riid, void * * ppv) Line 42 C++
mfcore.dll!CMediaEventPtr::GetUnknown(struct IMFMediaEvent *,struct _GUID const &,void * *) Unknown
mfcore.dll!CSeqSourceWrap::HandleUpdatedStream(struct IMFMediaEvent *) Unknown
mfcore.dll!CSeqSourceWrap::OnSourceEvent() Unknown
mfcore.dll!CSeqSourceWrap::OnSourceEventAsyncCallback::Invoke(struct IMFAsyncResult *) Unknown
In the topo case, I then get a call to GetStreamDescriptor and RequestSample and everything works.
MySourceCPP_COM.dll!MyStream::GetStreamDescriptor(IMFStreamDescriptor * * ppStreamDescriptor) Line 187 C++
mfcore.dll!CMPSourceManager::OnNewStream() Unknown
mfcore.dll!CMPSourceManager::OnSourceEvent() Unknown
mfcore.dll!CMPSourceManager::OnSourceEventAsyncCallback::Invoke(struct IMFAsyncResult *) Unknown
MySourceCPP_COM.dll!MyStream::RequestSample(IUnknown * pToken) Line 208 C++
mfcore.dll!CMPSourceNodeInfo::RequestSample() Unknown
mfcore.dll!CMPSourceNodeInfo::GenerateData() Unknown
mfcore.dll!CMPSourceNodeInfo::ProcessSample() Unknown
mfcore.dll!CMPWalker::ProcessCommands() Unknown
mfcore.dll!CMFMediaProcessor::ProcessSample() Unknown
mfcore.dll!CMFMediaProcessorStream::_RequestSample() Unknown
mfcore.dll!CMFMediaProcessorStream::RequestSample(struct IUnknown *) Unknown
mfcore.dll!CBitPump::HandleSinkRequestSample() Unknown
mfcore.dll!CBitPump::OnSinkEvent() Unknown
mfcore.dll!CBitPump::OnSinkEventAsyncCallback::Invoke(struct IMFAsyncResult *) Unknown
In the IMFCaptureEngine case I never get either call so data never flows.
I see the only difference is CMPSourceManager vs. CSeqSourceWrap.

Error while compiling: invalid conversion from 'void*' to 'unsigned char*'

Im programming an Arduino mega 2560.
And I bought an tft LCD and for that I want to use a SD card so I can put my pictures on it.
I downloaded this library but its giving me errors.
C:\Arduino\libraries\pff\pff.cpp: In function 'FRESULT pf_read(void*, short unsigned int, short unsigned int*)':
C:\Arduino\libraries\pff\pff.cpp:585: error: invalid conversion from 'void*' to 'unsigned char*'
The problem is imo here:
pff.cpp:
FRESULT pf_read (
void* buff, /* Pointer to the read buffer (NULL:Forward data to the stream)*/
WORD btr, /* Number of bytes to read */
WORD* br /* Pointer to number of bytes read */
)
pff.h:
FRESULT pf_read (void*, WORD, WORD*); /* Read data from the open file */
When I make it a .c file, it gives me more errors, like this one:
tft_menu.cpp.o: In function `open_root_dir()':
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:594: undefined reference to `pf_opendir(_DIR_*, char const*)'
tft_menu.cpp.o: In function `mount_sd()':
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:583: undefined reference to `disk_initialize()'
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:585: undefined reference to `pf_mount(_FATFS_*)'
tft_menu.cpp.o: In function `bitmap_show(char*)':
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:472: undefined reference to `pf_open(char const*)'
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:476: undefined reference to `pf_read(void*, unsigned short, unsigned short*)'
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:518: undefined reference to `pf_read(void*, unsigned short, unsigned short*)'
tft_menu.cpp.o: In function `show_bitmap()':
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:603: undefined reference to `pf_readdir(_DIR_*, _FILINFO_*)'
so I think it should be compiled as a cpp.
EDIT:
I found out that I have to save is as cpp and in the program I have to write what icktoofay states
After that I got some errors, so I went to the line 585, as stated above and changed
BYTE *rbuff = buff;
into
BYTE rbuff = (unsigned char) buff;
And I found out that I had to add mcc.h to get rid of the errors of the "couldnt find resources".
And now Im getting these errors:
C:\libraries\mmc/mmc.h: In function 'void init_spi()':
C:\libraries\mmc/mmc.h:21: error: 'PORTL' was not declared in this scope
C:\libraries\mmc/mmc.h:21: error: 'PORTL0' was not declared in this scope
C:\libraries\mmc/mmc.h:22: error: 'PORTB' was not declared in this scope
C:\libraries\mmc/mmc.h:22: error: 'PORTB2' was not declared in this scope
C:\libraries\mmc/mmc.h:22: error: 'PORTB1' was not declared in this scope
C:\libraries\mmc/mmc.h:23: error: 'DDRB' was not declared in this scope
C:\libraries\mmc/mmc.h:23: error: 'PORTB0' was not declared in this scope
C:\libraries\mmc/mmc.h:25: error: 'DDRL' was not declared in this scope
C:\libraries\mmc/mmc.h:27: error: 'SPCR' was not declared in this scope
C:\libraries\mmc/mmc.h:27: error: 'SPE' was not declared in this scope
C:\libraries\mmc/mmc.h:27: error: 'MSTR' was not declared in this scope
C:\libraries\mmc/mmc.h:28: error: 'SPSR' was not declared in this scope
C:\libraries\mmc/mmc.h:28: error: 'SPI2X' was not declared in this scope
Ive tried to add #include TFT_ARDUINO_MEGA.h on top of the mcc.h and still no luck
Compile it as a C file, but in the file that uses it, include pff.h like this:
extern "C" {
#include <pff.h>
}

Qt forbid declaration of QListView with no type

I have a very strange error in my Qt project. Here is the code, the main_window.h:
#include <QtGui>
#include <QtSql>
class main_window : public QTabWidget
{
Q_OBJECT
/// #name List Widgets
private:
QListWidget* m_documents_list;
....
and here is main_window.cpp:
...
void main_window::create_documents_widget()
{
m_documents = new QWidget(this);
m_documents_list = new QListWidget(m_documents);
}
...
The problem that I can't understand is in QListView, I'm not using it in my project. There is only QListWidget, but when I'm trying to build the project the following errors occur:
qlistview.h:194: error: ISO C++ forbids declaration of 'QListView' with no type
qlistview.h:194: error: expected ',' or '...' before '&' token
Also the following strange errors:
qlistwidget.h:308: error: no 'void QListWidget::removeItemWidget(QListWidgetItem)' member function declared in class 'QListWidget'*
qlistwidget.h:311: error: no 'void QListWidget::addItem(QListWidgetItem)' member function declared in class 'QListWidget'*
qlistwidget.h:314: error: no 'QListWidgetItem QListWidget::itemAt(int, int) const' member function declared in class 'QListWidget'*
etc.
Thanks in advance.
UPD: I'm using QtCreator 2.2.1 on Windows 7.
UPD2: Qt version is 4.7.1.
UPD3: The complete output
In file included from c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/QtGui:68,
from ..\my_project\/main_window.h:4,
from ..\my_project\main.cpp:2:
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistview.h:194: error: ISO C++ forbids declaration of 'QListView' with no type
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistview.h:194: error: expected ',' or '...' before '&' token
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistview.h:194: error: ISO C++ forbids declaration of 'QListView' with no type
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistview.h:194: error: ISO C++ forbids declaration of 'QListView' with no type
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistview.h:194: error: expected ';' before '&' token
In file included from c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/QtGui:69,
from ..\my_project\/main_window.h:4,
from ..\my_project\main.cpp:2:
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:202: error: redefinition of 'class QListWidget'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistview.h:58: error: previous definition of 'class QListWidget'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:308: error: no 'void QListWidget::removeItemWidget(QListWidgetItem*)' member function declared in class 'QListWidget'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:311: error: no 'void QListWidget::addItem(QListWidgetItem*)' member function declared in class 'QListWidget'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:314: error: no 'QListWidgetItem* QListWidget::itemAt(int, int) const' member function declared in class 'QListWidget'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h: In member function 'void QListWidgetItem::setSelected(bool)':
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:318: error: 'class QListWidget' has no member named 'setItemSelected'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h: In member function 'bool QListWidgetItem::isSelected() const':
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:321: error: 'class QListWidget' has no member named 'isItemSelected'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h: In member function 'void QListWidgetItem::setHidden(bool)':
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:324: error: 'class QListWidget' has no member named 'setItemHidden'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h: In member function 'bool QListWidgetItem::isHidden() const':
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:327: error: 'class QListWidget' has no member named 'isItemHidden'
Firstly - you should also mention qt version, as in this case that's most important.
This seems like some weird quirk of compiler or qt - my recomendation would be first to create simplest program where problem occurs. If it shows also in program like
#include <QtGui/QListWidget>
int main(int argc, char* argv[]){
QListWidget* w = 0;
}
then it is some problem with qt headers of compiler - then answer cannot be provided from data provided. If it works, then try to slowly add other elements of your code to this simple file - most likely at some point you will get the same error again - then you will know that last added piece of code is guilty. Some additional thinking might be required to figure out how to remove problem once located.
It should be noted that QListWidget inherits from QListView, so you are indirectly using it.
The error your getting looks like you're simply missing a #include <QListWidget> line in your header file.
Also, it could be that that you're missing #include guards in your header file
#ifndef MYCLASS
#define MYCLASS
class MyClass { ... };
#endif
If your header file is #included by more than one project then that would explain the errors you're seeing.

Resources