DiscordCoreAPI icon indicating copy to clipboard operation
DiscordCoreAPI copied to clipboard

Exe build does not starts correctly

Open muratulashozturk opened this issue 2 years ago • 20 comments
trafficstars

Hello, I've compiled an exe version for the bot and I've moved the files to my Windows 2019 server, I run, and after that, I got the The application was unable to start correctly (0xc0000142) error.

I already installed vc++ redistributable 2022, what else should I install to run the exe build?

Note: the exe works on my main computer which I had the build on.

Bot.exe
Bot.pdb
discordcoreapi.dll
libcrypto-3-x64.dll
libsodium.dll
libssl-3-x64.dll
opus.dll

muratulashozturk avatar Jul 15 '23 04:07 muratulashozturk

Did you copy the .dll files to whichever folder you are running the .exe from?

RealTimeChris avatar Jul 15 '23 05:07 RealTimeChris

Did you copy the .dll files to whichever folder you are running the .exe from?

Well, I mean I got the export and I copied files to the server. What files else do I need to copy?

muratulashozturk avatar Jul 15 '23 18:07 muratulashozturk

This list of .dll files

Bot.exe
Bot.pdb
discordcoreapi.dll
libcrypto-3-x64.dll
libsodium.dll
libssl-3-x64.dll
opus.dll```

RealTimeChris avatar Jul 15 '23 20:07 RealTimeChris

This list of .dll files

Bot.exe
Bot.pdb
discordcoreapi.dll
libcrypto-3-x64.dll
libsodium.dll
libssl-3-x64.dll
opus.dll```

Yes, they are in the directory with the exe.

muratulashozturk avatar Jul 16 '23 09:07 muratulashozturk

Have you tried any of these fixes? https://helpdeskgeek.com/how-to/how-to-fix-the-application-was-unable-to-start-correctly-0xc0000142-error-in-windows/

RealTimeChris avatar Jul 16 '23 09:07 RealTimeChris

Have you tried any of these fixes? https://helpdeskgeek.com/how-to/how-to-fix-the-application-was-unable-to-start-correctly-0xc0000142-error-in-windows/

It didn't work, I will deeply analyze the issue with the dependency walker.

muratulashozturk avatar Jul 16 '23 16:07 muratulashozturk

Still couldn't find the issue. There are a lot of missing dependencies when in VCRUNTIME140.dll when I look it through Dependency walker.

muratulashozturk avatar Jul 18 '23 13:07 muratulashozturk

Hmm interesting. Which version of Visual Studio are you building it with? Maybe try building it with VS2019 instead to see if it runs on Server 2019 more easily?

RealTimeChris avatar Jul 18 '23 15:07 RealTimeChris

Prolly the issue is because of Server 2019, tried with home pc win 10, worked without an issue. Will try with server 2022 today.

muratulashozturk avatar Jul 20 '23 11:07 muratulashozturk

Same result on server 2022 too, I am for sure missing some libraries but I don't know which

muratulashozturk avatar Jul 20 '23 13:07 muratulashozturk

Interesting - this sounds inconvenient.

RealTimeChris avatar Jul 21 '23 06:07 RealTimeChris

Windows reports that the discordcoreapi.dll is faulty. There are missing dependencies for discordcoreapi.dll I think. I'll look on it more

muratulashozturk avatar Jul 22 '23 13:07 muratulashozturk

        const auto _Max_storage_buckets               = static_cast<size_type>(1) << _Max_storage_buckets_log2;

^ Unhandled exception at 0x00007FFE8B9BAC1D (discordcoreapi.dll) in Bot.exe: 0xC000001D: Illegal Instruction.

When I debug the app on the server, It throws the error above. This is really strange. The app works on my friend's computer but on the server not. I don't know which dependencies are missing and can't really locate it too.

muratulashozturk avatar Jul 22 '23 14:07 muratulashozturk

I think this must be due to the AVX instructions that are being used. "Illegal instruction" is what you get when you call one that is not supported.

RealTimeChris avatar Jul 22 '23 15:07 RealTimeChris

I think this means I need to set it up so that you can easily select, at compile time, which instruction set gets used.

RealTimeChris avatar Jul 22 '23 15:07 RealTimeChris

I will try it on Linux too

muratulashozturk avatar Jul 23 '23 12:07 muratulashozturk

Are you running it in a VM by chance?

RealTimeChris avatar Jul 24 '23 05:07 RealTimeChris

Are you running it in a VM by chance?

Nope

muratulashozturk avatar Jul 28 '23 17:07 muratulashozturk

Hello, I saw that you published a new version, could you please try to build an exe and launch it in your free time? It could be helpful if there is an example project and documentation for publishing console exe to host bots on windows servers. @RealTimeChris

muratulashozturk avatar Sep 29 '23 15:09 muratulashozturk

Hello, I saw that you published a new version, could you please try to build an exe and launch it in your free time? It could be helpful if there is an example project and documentation for publishing console exe to host bots on windows servers. @RealTimeChris

https://github.com/RealTimeChris/Bot-Template-For-DiscordCoreAPI This should help you. I just succesfully built and run an executable on Windows.

RealTimeChris avatar Dec 12 '23 03:12 RealTimeChris