#contributions

Seeking C++ Project Contribution Guidance

TLDR Peka wants to contribute to a project and seeks resources. Kishore Nallan provides initial guidance and recommends starting with a simple task on the Typesense project. Peka encounters a setup error well into the process.

Powered by Struct AI

2

1

Nov 25, 2021 (24 months ago)
Peka
Photo of md5-eaab2154c54e0ac8eeb428393b31f22a
Peka
03:13 PM
Hi everyone!
I am looking to contribute to the project. I have basic knowledge of C++. Could anyone please list out some books, resources etc that i should first go through before delving into the project?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
03:16 PM
👋 Can you please tell how familiar you are with cmake? And what OS your development environment is in?
03:19
Kishore Nallan
03:19 PM
I can help you get started based on that Peka
Peka
Photo of md5-eaab2154c54e0ac8eeb428393b31f22a
Peka
03:21 PM
I have a basic idea of cmake and have used it before. I am on Ubuntu
03:22
Peka
03:22 PM
Kishore Nallan
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
03:22 PM
That's great. The first milestone will be getting Typesense to compile locally on your machine. Typesense has quite a few dependencies, some of which are just managed at the system level, while others are built by the CMake (I kinda gave up using Cmake to manage dependencies).

This Dockerfile is used by Typesense to build release builds, so you can just follow this to install the dependencies on Ubuntu: https://github.com/typesense/typesense/blob/single-index-concurrency/docker/development.Dockerfile
03:23
Kishore Nallan
03:23 PM
(Be mindful of that specific branch, that's the development branch right now so contains latest updates, and is not yet merged to master)
03:24
Kishore Nallan
03:24 PM
Once those dependencies are installed, you can now build Typesense like this: https://github.com/typesense/typesense/blob/single-index-concurrency/docker-build.sh#L24
03:25
Kishore Nallan
03:25 PM
Let me once your dev environment is setup and we can pick a small feature to ship 🙂

1

Peka
Photo of md5-eaab2154c54e0ac8eeb428393b31f22a
Peka
03:26 PM
sure!
09:32
Peka
09:32 PM
My dev environment is ready! What shall i start with?
Nov 26, 2021 (24 months ago)
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
04:56 AM
Excellent, https://github.com/typesense/typesense/issues/328 should be a simple one to start with.

This is where we process the fields: https://github.com/typesense/typesense/blob/single-index-concurrency/include/field.h#L197

We need to add a check for field name duplication in that function. The function already does other validations, so you can see how to return an error, which will be automatically handled by higher layers to send back to the API. The error code like "400" follow HTTP status code, which is "Bad Request" in the case of 400. Once you have a basic skeleton, you can try testing it on the API, and if that works I can then explain about adding a test for this.

1

05:02
Kishore Nallan
05:02 AM
Also, the linking time on Linux might be long Peka because we always link with -static-libgcc -static-libstdc++ -- might have to add a flag for dev builds to not do that. For e.g. the Apple target does not statically link to those like the Linux target here: https://github.com/typesense/typesense/blob/single-index-concurrency/CMakeLists.txt#L156
Nov 30, 2021 (24 months ago)
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
03:43 AM
Peka any help needed here?
Peka
Photo of md5-eaab2154c54e0ac8eeb428393b31f22a
Peka
07:56 AM
Yes actually! I think i had not set up my environment correctly earlier. Now that i am redoing it again, i am facing an error. Installed the dependencies but building Typesense shows error. If you'd please take a look, that'd be great!
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
08:10 AM
The docker-build.sh script builds Typesense via Docker. If you have setup the local env, you should not run that directly but only the cmake and make commands inside it.
08:11
Kishore Nallan
08:11 AM
Or run build.sh which is without Docker.

1