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

Master branch doesn't build, dev docs are missing details #2217

Closed
riverar opened this issue Jan 13, 2021 · 36 comments
Closed

Master branch doesn't build, dev docs are missing details #2217

riverar opened this issue Jan 13, 2021 · 36 comments

Comments

@riverar
Copy link

riverar commented Jan 13, 2021

Attempting to build Unigram master, with TDLib 1.7.0, results in a litany of errors. There appear to be a bunch of references to a hardcoded path C:\tgcalls, as well as others. None of these folders are listed in the dev docs.

Do you have updated guidance on building Unigram?

Severity	Code	Description	Project	File	Line	Suppression State
Error	CS0535	'MessageAlbum' does not implement interface member 'BaseObject.ToUnmanaged()'	Unigram	C:\Sources\Unigram\Unigram\Unigram\Common\TdExtensions.cs	2229	N/A
Error	CS0535	'MessageChatEvent' does not implement interface member 'BaseObject.ToUnmanaged()'	Unigram	C:\Sources\Unigram\Unigram\Unigram\Common\TdExtensions.cs	2345	N/A
Error	CS0535	'MessageHeaderDate' does not implement interface member 'BaseObject.ToUnmanaged()'	Unigram	C:\Sources\Unigram\Unigram\Unigram\Common\TdExtensions.cs	2376	N/A
Error	CS0535	'MessageHeaderUnread' does not implement interface member 'BaseObject.ToUnmanaged()'	Unigram	C:\Sources\Unigram\Unigram\Unigram\Common\TdExtensions.cs	2380	N/A
Error	C1083	Cannot open source file: 'C:\tgcalls\tgcalls\CodecSelectHelper.cpp': No such file or directory	Unigram.Native.Calls	C:\Sources\Unigram\Unigram\Unigram.Native.Calls\c1xx	1	
Error	C1083	Cannot open source file: 'C:\tgcalls\tgcalls\CryptoHelper.cpp': No such file or directory	Unigram.Native.Calls	C:\Sources\Unigram\Unigram\Unigram.Native.Calls\c1xx	1	
Error	C1083	Cannot open source file: 'C:\tgcalls\tgcalls\EncryptedConnection.cpp': No such file or directory	Unigram.Native.Calls	C:\Sources\Unigram\Unigram\Unigram.Native.Calls\c1xx	1	
Error	C1083	Cannot open source file: 'C:\tgcalls\tgcalls\Instance.cpp': No such file or directory	Unigram.Native.Calls	C:\Sources\Unigram\Unigram\Unigram.Native.Calls\c1xx	1	
Error	C1083	Cannot open source file: 'C:\tgcalls\tgcalls\InstanceImpl.cpp': No such file or directory	Unigram.Native.Calls	C:\Sources\Unigram\Unigram\Unigram.Native.Calls\c1xx	1	
Error	C1083	Cannot open source file: 'C:\tgcalls\tgcalls\LogSinkImpl.cpp': No such file or directory	Unigram.Native.Calls	C:\Sources\Unigram\Unigram\Unigram.Native.Calls\c1xx	1	
Error	C1083	Cannot open source file: 'C:\tgcalls\tgcalls\Manager.cpp': No such file or directory	Unigram.Native.Calls	C:\Sources\Unigram\Unigram\Unigram.Native.Calls\c1xx	1	
Error	C1083	Cannot open source file: 'C:\tgcalls\tgcalls\MediaManager.cpp': No such file or directory	Unigram.Native.Calls	C:\Sources\Unigram\Unigram\Unigram.Native.Calls\c1xx	1	
Error	C1083	Cannot open source file: 'C:\tgcalls\tgcalls\Message.cpp': No such file or directory	Unigram.Native.Calls	C:\Sources\Unigram\Unigram\Unigram.Native.Calls\c1xx	1	
Error	C1083	Cannot open source file: 'C:\tgcalls\tgcalls\NetworkManager.cpp': No such file or directory	Unigram.Native.Calls	C:\Sources\Unigram\Unigram\Unigram.Native.Calls\c1xx	1	
Error	C1083	Cannot open source file: 'C:\tgcalls\tgcalls\platform\tdesktop\DesktopInterface.cpp': No such file or directory	Unigram.Native.Calls	C:\Sources\Unigram\Unigram\Unigram.Native.Calls\c1xx	1	
Error	C1083	Cannot open source file: 'C:\tgcalls\tgcalls\platform\tdesktop\VideoCameraCapturer.cpp': No such file or directory	Unigram.Native.Calls	C:\Sources\Unigram\Unigram\Unigram.Native.Calls\c1xx	1	
Error	C1083	Cannot open source file: 'C:\tgcalls\tgcalls\platform\tdesktop\VideoCapturerInterfaceImpl.cpp': No such file or directory	Unigram.Native.Calls	C:\Sources\Unigram\Unigram\Unigram.Native.Calls\c1xx	1	
Error	C1083	Cannot open source file: 'C:\tgcalls\tgcalls\platform\tdesktop\VideoCapturerTrackSource.cpp': No such file or directory	Unigram.Native.Calls	C:\Sources\Unigram\Unigram\Unigram.Native.Calls\c1xx	1	
Error	C1083	Cannot open source file: 'C:\tgcalls\tgcalls\reference\InstanceImplReference.cpp': No such file or directory	Unigram.Native.Calls	C:\Sources\Unigram\Unigram\Unigram.Native.Calls\c1xx	1	
Error	C1083	Cannot open source file: 'C:\tgcalls\tgcalls\ThreadLocalObject.cpp': No such file or directory	Unigram.Native.Calls	C:\Sources\Unigram\Unigram\Unigram.Native.Calls\c1xx	1	
Error	C1083	Cannot open source file: 'C:\tgcalls\tgcalls\VideoCaptureInterface.cpp': No such file or directory	Unigram.Native.Calls	C:\Sources\Unigram\Unigram\Unigram.Native.Calls\c1xx	1	
Error	C1083	Cannot open source file: 'C:\tgcalls\tgcalls\VideoCaptureInterfaceImpl.cpp': No such file or directory	Unigram.Native.Calls	C:\Sources\Unigram\Unigram\Unigram.Native.Calls\c1xx	1	
Error		The "CompileXaml" task returned false but did not log an error.	Unigram	C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\XamlCompiler\Microsoft.Windows.UI.Xaml.Common.targets	486	
Error	MSB4181	The "CompileXaml" task returned false but did not log an error.	Unigram.Native.Calls	C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\XamlCompiler\Microsoft.Windows.UI.Xaml.Common.targets	486	
Error	CS0246	The type or namespace name 'MessageLiveLocationApproached' could not be found (are you missing a using directive or an assembly reference?)	Unigram	C:\Sources\Unigram\Unigram\Unigram\Controls\Messages\MessageService.cs	799	N/A
Error	CS0246	The type or namespace name 'StatisticsGraph' could not be found (are you missing a using directive or an assembly reference?)	Unigram	C:\Sources\Unigram\Unigram\Unigram\ViewModels\Chats\ChatStatisticsViewModel.cs	247	N/A
Error	CS0246	The type or namespace name 'StatisticsValue' could not be found (are you missing a using directive or an assembly reference?)	Unigram	C:\Sources\Unigram\Unigram\Unigram\Controls\ChatStatisticsOverview.xaml.cs	21	N/A
Error	CS0246	The type or namespace name 'StatisticsValue' could not be found (are you missing a using directive or an assembly reference?)	Unigram	C:\Sources\Unigram\Unigram\Unigram\Controls\ChatStatisticsOverview.xaml.cs	22	N/A
Error	CS0246	The type or namespace name 'StatisticsValue' could not be found (are you missing a using directive or an assembly reference?)	Unigram	C:\Sources\Unigram\Unigram\Unigram\Controls\ChatStatisticsOverview.xaml.cs	28	N/A
@MarcAnt01 MarcAnt01 added the meta label Jan 13, 2021
@FrayxRulez
Copy link
Collaborator

👋 you should use develop branch.
You should have WebRTC (m84) in C:\webrtc: https://github.com/microsoft/winrtc/tree/master/patches_for_WebRTC_org/m84
You should have tgcalls in C:\tgcalls: https://github.com/TelegramMessenger/tgcalls

Second repository requires some patches to be built, but I'm sure you can figure out yourself.

@riverar
Copy link
Author

riverar commented Jan 13, 2021

Develop branch doesn't build properly either

Severity	Code	Description	Project	File	Line	Suppression State
Error	MIDL2011	[msg]unresolved type declaration [context]: Telegram.Td.Api.GroupCallPayload [ Parameter 'payload' of Procedure 'Invoke' ( Delegate 'Unigram.Native.Calls.EmitJsonPayloadDelegate' ) ]	Unigram.Native.Calls	C:\Sources\Unigram\Unigram\Unigram.Native.Calls\VoipGroupManager.idl	5	
Error	MIDL2011	[msg]unresolved type declaration [context]: Telegram.Td.Api.GroupCallJoinResponse [ Parameter 'payload' of Procedure 'SetJoinResponsePayload' ( RuntimeClass 'Unigram.Native.Calls.VoipGroupManager' ) ]	Unigram.Native.Calls	C:\Sources\Unigram\Unigram\Unigram.Native.Calls\VoipGroupManager.idl	13	
Error		The "CompileXaml" task returned false but did not log an error.	Unigram	C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\XamlCompiler\Microsoft.Windows.UI.Xaml.Common.targets	486	
Error	CS0006	Metadata file 'C:\Sources\Unigram\Unigram\x64\Debug\Unigram.Native.Calls\Unigram.Native.Calls.winmd' could not be found	Unigram	C:\Sources\Unigram\Unigram\Unigram\CSC	1	N/A
Error		Cannot resolve Assembly or Windows Metadata file 'C:\Sources\Unigram\Unigram\x64\Debug\Unigram.Native.Calls\Unigram.Native.Calls.winmd'	Unigram	C:\Sources\Unigram\Unigram\Unigram\Unigram.csproj		

Will investigate the other deps you just listed, thanks!

@forconz
Copy link

forconz commented Jan 14, 2021

@FrayxRulez Second repository requires some patches to be built, But how to do?

I am C#/React full-stack programmer, but poor C/C++.

@Yeldece
Copy link

Yeldece commented Jan 26, 2021

What's the status, could you guys made it to work? I learned syntax of the c# to improve my programming skills and may be some improvements to this program, but i couldn't build it either.

@hpxiong
Copy link

hpxiong commented Aug 2, 2021

@FrayxRulez can you please provide some guidance on how to patch tgcalls? The patched webrtc UWP repo has too many mismatches with tgcalls.

@FrayxRulez
Copy link
Collaborator

You don't need to patch it, just use FrayxRulez/webrtc-uwp, branch m91

@FrayxRulez
Copy link
Collaborator

Still, apart from patching part build instructions are the same as the official one

@IgorTheLight
Copy link

Unigram is a royal pain in the ass to build right now!
I wasted a few hours and it's still "almost working".
It's ok to build TDLib, but there are also a few non-documented libraries + patches to deal with... Too many places for something to brake.

@gus33000
Copy link
Contributor

gus33000 commented Dec 4, 2021

Managed to build Unigram today.

First of all current commit uses a private TDLib version, so I cherry picked commit 9ca612b

See #2217 (comment)

Getting started

If you want to build WinRTC (WebRTC for Windows) yourself, enabling x86 and arm64 builds as well

Building Unigram

  • Setup two environment variables on your machine:
    <WebRTC_Root>C:\webrtc\src</WebRTC_Root>
    <WebRTC_Output>C:\winrtc\output\msvc\uwp</WebRTC_Output>
  • Inside the unigram cloned repository, create \unigram\unigram\unigram\Constants.Secret.cs
  • Fill it in like so:
namespace Unigram
{
    public static partial class Constants
    {
		static Constants()
		{
			Constants.ApiId = <your api id>;
			Constants.ApiHash = "<your api hash>";
			Constants.AppChannel = "<the user handle @ of a channel you will create, this hosts emojis app update packages etc>";
			Constants.AppCenterId = "<an optional appcenter id, from appcenter.ms, can be left blank>";
		}
	}
}
  • Open Unigram.sln
  • Switch the solution to Release/x64 (or another architecture if you built WinRTC)
  • You might need openssl binaries in the path, you'll need to place include files (OpenSSL-1.1.1l-Win-pc064.zip\OpenSSL\OpenSSL\1.1.1l\include\openssl) under c:\tgcalls\tgcalls\openssl (use openssl 1.1.1, not 3.0.0 or higher)
  • Build the Unigram.Native.Calls project, if you get failures, make sure you cloned under c:\tgcalls and c:\webrtc previously, as these paths are hardcoded.

Optional

The following is to make building quicker down the line:

  • Open Unigram.csproj once Unigram.Native.Calls is built
  • Uncomment the following block:
  <ItemGroup>
    <Reference Include="Unigram.Native.Calls">
      <HintPath>$(SolutionDir)\Unigram.Native.Calls\$(Platform)\Unigram.Native.Calls.winmd</HintPath>
      <Implementation>Unigram.Native.Calls.dll</Implementation>
    </Reference>
    <ReferenceCopyLocalPaths Include="$(SolutionDir)\Unigram.Native.Calls\$(Platform)\Unigram.Native.Calls.dll" />
    <ReferenceCopyLocalPaths Include="$(SolutionDir)\Unigram.Native.Calls\$(Platform)\Unigram.Native.Calls.pri" />
  </ItemGroup>
  • And comment the following one:
    <!--<ProjectReference Include="..\Unigram.Native.Calls\Unigram.Native.Calls.vcxproj">
      <Project>{fdd3c45d-4cff-4a90-8fef-16ca70ab00be}</Project>
      <Name>Unigram.Native.Calls</Name>
    </ProjectReference>-->
  • Place built artifacts for Unigram.Native.Calls under $(SolutionDir)\Unigram.Native.Calls\$(Platform) so it matches the csproj

And now, building the app

  • Build Unigram

if everything goes well, you should end up here:

image

Author note: this might be different from how the app is built by the developer, and might be missing a few things, but this is the general idea/notes I took while doing this, I might try doing a more detailed, completed, and checked step by step guide later on, but hopefully this already helps you.

@IgorTheLight
Copy link

Holy shit!
Thank you SO much!
I didn't tried that myself yet but this looks much more detailed. Still fiddly tho, but that's not your fault ;-)

@gus33000
Copy link
Contributor

gus33000 commented Dec 5, 2021

I have provided more details on how to build WebRTC here: https://gist.github.com/gus33000/7a7f310528082d5b7ba555fed6379e03

x86 UWP target still has some issue but x64 and arm64 are fine

@FrayxRulez
Copy link
Collaborator

Wow @gus33000 thanks a lot. I'll add this to the Readme. I actually made a nuget package for the webrtc fork used by Unigram, for now just x64: Unigram.WebRTC.x64.

@FrayxRulez
Copy link
Collaborator

Develop branch won't build because it's using a not yet public version of TDLib.

@gus33000
Copy link
Contributor

gus33000 commented Dec 5, 2021

Wow @gus33000 thanks a lot. I'll add this to the Readme. I actually made a nuget package for the webrtc fork used by Unigram, for now just x64: Unigram.WebRTC.x64.

You're welcome! Figured out the issue with x86 for WebRTC so it should be fine now. Hope it helps others willing to build the app. I'm just wondering if the tgcalls commit I picked is the right one given I had to do some tiny modifications too last night (going to try again today, but just wanting to be sure)

@gus33000
Copy link
Contributor

gus33000 commented Dec 5, 2021

Updated the instructions with guidance on how to use your own built nuget package for WebRTC and enable ARM64/x86 Release compiles of Unigram.Native.Calls, should now be complete.

image

@IgorTheLight
Copy link

@gus33000 you are our hero!
@FrayxRulez you are also a hero (being a main developer and all...) but we definitely need a better building instructions. For now you more like a villain who created his Doomsday Device :-)

@gus33000
Copy link
Contributor

gus33000 commented Dec 7, 2021

TdLib finally updated so I think you should be able to build the latest source now. Haven't tested yet, but ignore the cherry picked commit hash for unigram only (keep cherry picking tgcalls commit hash).

@FrayxRulez
Copy link
Collaborator

@gus33000 can you make a PR adding the build instructions to the docs?

@riverar
Copy link
Author

riverar commented Feb 12, 2022

I think you should consider improving the build situation before documenting this. Opening up project files, commenting lines out, and manually creating sources is ridiculous. 🤡

@FrayxRulez
Copy link
Collaborator

I think you should consider improving the build situation before documenting this. Opening up project files, commenting lines out, and manually creating sources is ridiculous. 🤡

I don't care about other people being able to build the project. Code-related PRs are not welcome.

@riverar
Copy link
Author

riverar commented Feb 12, 2022

Then why would anyone care to submit a PR? You are terrible.

@riverar riverar closed this as completed Feb 12, 2022
@FrayxRulez
Copy link
Collaborator

Additionally, I'm not sure that it's my fault if UWP environment sucks and you can't find common libraries such as WebRTC ready to be built or even pre-built?
Unigram can be easily built if everything is in place, still dependencies are not my responsibility.

@Aquathing
Copy link

I think you should consider improving the build situation before documenting this. Opening up project files, commenting lines out, and manually creating sources is ridiculous. clown_face

I'm not sure if asking for things to be improved and then using clown emojis to make fun of someone's work is a good idea to get what you want.

@gus33000
Copy link
Contributor

What work though? There's no work done by anyone currently on build documentation, and I do agree with @riverar that there should be ways to make it better (for a start, the c:\tgcalls folder being hardcoded is in unigram project, not in a dependency). Same for WebRTC. Also how do we know things didn't change again?

@Aquathing
Copy link

Aquathing commented Feb 12, 2022

What work though? There's no work done by anyone currently on build documentation

The clown emoji is disrespectful towards the entire project, not just missing build instructions.

and I do agree with @riverar that there should be ways to make it better

And I agree that build instructions would be cool, but using clown emojis and pretending them is wrong.

Also how do we know things didn't change again?

If they change, the documentation can be updated.
The thing here is that you all somehow feel entitled to request things as if you paid for Unigram

@gus33000
Copy link
Contributor

What work though? There's no work done by anyone currently on build documentation

The clown emojis in unrespectful towards the entire projects, not just missing build instructions.

and I do agree with @riverar that there should be ways to make it better

And I agree that build instructions would be cool, but using clown emojis and pretending them is wrong.

Also how do we know things didn't change again?

If they change, they can be updated.

The thing here is that you all somehow feel entitled to request things as if you paid for Unigram

My message made no reference to the clown emojis, and I do not intend to comment on this issue, as it is irrelevant to our goals. You're free to discuss this with the concerned parties, but I'm not, and to me it looks like you just want to fuel fire here. It's just an unicode character.

I was requested to make a PR to provide build instructions, something I would happily do, but this would take me an entire weekend to recheck that everything works the way it already did, and making build instructions requiring to modify system files is ridiculous just to adapt to hardcoded paths that are once again present in the unigram repository itself, and none of the dependencies. Making build instructions involving what is commonly called hacks is not adequate, and would not match the project quality that everyone expects here.

I'm the one that made above's instructions in the first place, I have not said I would not do them, but I would kindly request that the hardcoded paths get resolved so we can make a pull request with the quality you expect from such a large scale project.

@gus33000
Copy link
Contributor

Moreover, speaking of build instructions, it is a violation of the GPLv3 license to not make the project rebuildable by people.

@FrayxRulez
Copy link
Collaborator

@gus33000 Modify system files? 🤨
The project is rebuildable, as you did rebuild it yourself.

@gus33000
Copy link
Contributor

@gus33000 Modify system files? 🤨 The project is rebuildable, as you did rebuild it yourself.

The GPLv3 license requires people to be able to rebuild the project and obtain identical binaries, we cannot be sure at this stage that the binaries we build ourselves match the binaries you build yourself, and that's a big problem

@FrayxRulez
Copy link
Collaborator

@gus33000 Report me to the authorities then

@gus33000
Copy link
Contributor

@gus33000 Report me to the authorities then

Not question of that, I do want to help by providing instructions to fix that issue, but I would love it if you could help us by just removing the hardcoded paths and making them relative to the project root...

@FrayxRulez
Copy link
Collaborator

@gus33000 Is it really needed? The problem with tgcalls is that the repository is private so I can’t add it as a submodule.

@gus33000
Copy link
Contributor

Yes, because TGCalls is LGPL3, which requires to disclose source as well... https://github.com/TelegramMessenger/tgcalls/blob/master/LICENSE

@gus33000
Copy link
Contributor

Thanks a lot for the submodule <3 Will try to do a PR tomorrow

@gus33000
Copy link
Contributor

I tried building Unigram numerous times since my previous comment unfortunately the Unigram.Native project now depends on libraries that are not referenced in the repository as submodules, and seems to depend on a vcpkg configuration missing from my machine. I appreciate all submobules for various libraries being here but some libraries like zlib or ffmpeg are completely missing from the tree and simply adding them in folders under the library directory isn't enough to make the build succeed. Is there any tip/guidance/help that could be given here? Note: my list is non exhaustive there's more missing. I should also note a lottie animation cs file is entirely missing from the main app UWP project.

@AiseKaise

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants