Thread overview
How to setup dub project for contributing to a dub package?
Jun 23, 2023
Ki Rill
Jun 24, 2023
Ki Rill
Jun 24, 2023
Ferhat Kurtulmuş
Jun 24, 2023
Ferhat Kurtulmuş
June 23, 2023

Recently, I tried to set up dcv with dub to improve a few things in the library, but I faced some strange issues.

When doing dub add dcv, it works fine. But when I try to add a local dcv project folder, or a repository, it fails to link the necessary package libraries. Seems like it's only ffmpeg libraries that are not linked.

What am I missing here?

// dub.json

...

"dependencies": {
    "dcv": {
        "repository": "git+https://github.com/rillki/dcv.git",
        "version": "~master"
    }
},

...

Output:

Undefined symbols for architecture x86_64:
  "_av_free_packet", referenced from:
      __D3dcv7videoio5input11InputStream13readFrameImplMFNbNiKCQCc4core5image5ImageZb in libdcv.a(input_2c65_47c.o)
      __D3dcv7videoio6output12OutputStream__T10writeSliceTS3mir7ndslice5slice__T9mir_sliceTPhVmi2VEQBoQBnQBi14mir_slice_kindi2ZQBvZQDiMFNbNiQDeEQFf4core5image11ImageFormatZb in libdcv.a(output_2c76_14e7.o)
      __D3dcv7videoio6output12OutputStream__T10writeSliceTS3mir7ndslice5slice__T9mir_sliceTPhVmi3VEQBoQBnQBi14mir_slice_kindi2ZQBvZQDiMFNbNiQDeEQFf4core5image11ImageFormatZb in libdcv.a(output_2c74_14e8.o)
  "_av_register_all", referenced from:
      __D3dcv7videoio6common9AVStarter6__ctorMFNbNiZCQBsQBrQBmQBi in libdcv.a(common_2c56_37c.o)
  "_avcodec_decode_video2", referenced from:

      ETC....

ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error: linker exited with status 1
Error dmd failed with exit code 1.
June 24, 2023
First things first, dcv is added to the dub-registry, so use this.

https://code.dlang.org/packages/dcv

```json
"dependencies": {
	"dcv": "~>0.3.0"
}
```

For ffmpeg the binding tells you what to add for search paths in the lflags directive.

https://github.com/ljubobratovicrelja/ffmpeg-d#adding-to-dub

All I can suggest is make sure you have the right dev packages for ffmpeg installed and findable by the linker.
June 24, 2023

On Friday, 23 June 2023 at 15:52:44 UTC, Richard (Rikki) Andrew Cattermole wrote:

>

First things first, dcv is added to the dub-registry, so use this.

https://code.dlang.org/packages/dcv

"dependencies": {
	"dcv": "~>0.3.0"
}

For ffmpeg the binding tells you what to add for search paths in the lflags directive.

https://github.com/ljubobratovicrelja/ffmpeg-d#adding-to-dub

All I can suggest is make sure you have the right dev packages for ffmpeg installed and findable by the linker.

It works fine if I add it as a dub package, but I want to add the repository so I can modify it, then test it on a new project, and make a PR that improves the package.

How do people usually set up their projects for such tasks?

June 23, 2023
On 6/23/23 8:23 PM, Ki Rill wrote:

> It works fine if I add it as a `dub` package, but I want to add the repository so I can modify it, then test it on a new project, and make a PR that improves the package.
> 
> How do people usually set up their projects for such tasks?

1. git clone to a local directory (use your fork, so you can change and submit when you want to do a PR)
2. CD to that directory
3. `dub add-local .`

Now it will use the local directory as the equivalent of the latest tag instead of downloading from the repository.

You may have to `dub upgrade` your project that depends on it, or temporarily depend on a different version.

-Steve
June 24, 2023
On Friday, 23 June 2023 at 15:52:44 UTC, Richard (Rikki) Andrew Cattermole wrote:
> First things first, dcv is added to the dub-registry, so use this.
>
> https://code.dlang.org/packages/dcv
>
> ```json
> "dependencies": {
> 	"dcv": "~>0.3.0"
> }
> ```
>
> For ffmpeg the binding tells you what to add for search paths in the lflags directive.
>
> https://github.com/ljubobratovicrelja/ffmpeg-d#adding-to-dub
>
> All I can suggest is make sure you have the right dev packages for ffmpeg installed and findable by the linker.

Just to make things clear,

I don't recommend to use DCV from dub registry, it's outdated. I have an opinion that the docs should be updated before creating a new version updating the dub repo. There are so many API changes between the last dub repo version and the master repo. I don't know if I will find time and motivation anytime soon. I doubt someone else will do it too (it is a huge welcome though).
June 24, 2023

On Friday, 23 June 2023 at 15:22:33 UTC, Ki Rill wrote:

>

Recently, I tried to set up dcv with dub to improve a few things in the library, but I faced some strange issues.

[...]
I recommend adding DCV sub packages separately. Don't add the entire thing to your dub dependencies. Just only add what you need. Ffmpeg-d in only needed for DCV videoing. You can add subpacks like:

"dependencies": {
		"dcv:core": ...,
        "dcv:plot": {"path": "../../"},
        "dcv:imageio": {"path": "../../"},
		"mir-random": "*"
	}