azihassan / youtube-d

A fast command-line Youtube downloader
MIT License
8 stars 0 forks source link

Undefined errors (with using DUB) #47

Closed joelcnz closed 7 months ago

joelcnz commented 8 months ago
Joel-Computer:youtube-d-0.0.4 joelchristensen$ dub build -b release
    Starting Performing "release" build using /Library/D/dmd/bin/dmd for x86_64.
    Building duktape 0.4.0: building configuration [library]
../../../../.dub/packages/duktape/0.4.0/duktape/source/duk_config.d(909,25): Error: undefined identifier `jmp_buf`
../../../../.dub/packages/duktape/0.4.0/duktape/source/duk_config.d(910,20): Error: undefined identifier `setjmp`
Error /Library/D/dmd/bin/dmd failed with exit code 1.

I'm on macOS.

azihassan commented 8 months ago

Thanks for the report. I haven't tested it on MacOS but I just pushed a commit to test that on GitHub since I don't have access to a macbook.

Edit: reproduced here: https://github.com/azihassan/youtube-d/actions/runs/7411039217/job/20164659137?pr=48

azihassan commented 8 months ago

I looked into it, and it turned out that one of the libraries failed to build under MacOS. Just merged a patch and it seems to be working now, at least on Github actions. Could you pull from main and try again?

joelcnz commented 8 months ago

I get the same errors. I tried the shell files, but didn't anywhere - command not found (used sudo on them).

azihassan commented 8 months ago

Oh ok, I guess there's a mismatch in sed between your version of MacOS and whichever one is used in GitHub actions.

In that case I would have to merge the fix into duktaped and wait for it to be deployed in code.dlang.org, or fork it and find a way to reference it in dub.json. I'll try implementing the second approach tomorrow but if all else fails, we could always resort to Docker.

joelcnz commented 8 months ago

This is a trick I do with my libraries (notice the '../'s):

    "importPaths": [
        "source",
        "source/io",
        "../JMiscLib/source",
    ],
    "sourcePaths": [
        "source",
        "source/io",
        "../JMiscLib/source",
    ]
azihassan commented 8 months ago

TIL, thanks. I also found out dub supports local dependencies. But I couldn't get either of these two solutions to work unless I include duktaped's source code in the project, which I'm trying to avoid. In the end, I decided to fork duktaped and put the changes there, this way I can maintain both projects separately. This PR includes that change. Just merged it into main, let me know if it's still causing you trouble.

joelcnz commented 8 months ago

I still get the same errors. I used "duktaped": "*" -> 1.0.0

azihassan commented 8 months ago

Hmm not sure what else it could be honestly. Maybe dub still references the previous duktaped version instead of the fork. Make sure dub.selections.json both point to the fork, and delete ../../../../.dub/packages/duktape (or whichever folder holds the dub dependencies) to force a redownload and run dub clean, then dub build --force for good measure.

joelcnz commented 8 months ago

I've wiped duktape packages off, used clean and force flags - but I'm still getting the same errors.

../../../../.dub/packages/duktaped/1.0.0/duktaped/source/etc/c/duk_config.d(907,25): Error: undefined identifier `jmp_buf` ../../../../.dub/packages/duktaped/1.0.0/duktaped/source/etc/c/duk_config.d(908,20): Error: undefined identifier `setjmp` Error /Library/D/dmd/bin/dmd failed with exit code 1.

azihassan commented 8 months ago

I'm confused why it says 1.0.0

I don't think dub's targeting the right version, my fork doesn't have anything in line 908: https://github.com/azihassan/duktaped/blob/c1f1939c8e62fbb4022050a0b3b1ba2164881067/source/duk_config.d#L908

What's inside your dub.json and dub.selections.json?

joelcnz commented 8 months ago

dub.json:

{
    "authors": [
        "Hassan Azi"
    ],
    "copyright": "Copyright © 2023, Hassan Azi",
    "dependencies": {
        "htmld": "~>0.3.7",
        "duktaped": "*"
    },
    "description": "Youtube downloader",
    "license": "MIT",
    "name": "youtube-d"
}

dub.selections.json:

{
    "fileVersion": 1,
    "versions": {
        "duktaped": "1.0.0",
        "htmld": "0.3.7"
    }
}
azihassan commented 8 months ago

It looks different from the ones in the main branch, try pulling from main since it includes the MacOS compatible version of duktaped

joelcnz commented 8 months ago

I don't understand how to pull from the main branch?

azihassan commented 8 months ago

Not sure how your project copy is set up, but the easiest way would be to git clone the project in another directory to automatically get the latest changes.

joelcnz commented 8 months ago

I don't understand how to pull from the main branch?

azihassan commented 8 months ago

I'm not sure I follow, did the previous suggestion not work ?

joelcnz commented 7 months ago

I mean to look later. (I guess git clone (copied git link) would pull from the main).

joelcnz commented 7 months ago

I'm not getting those errors any more. I recloned it.