Closed kassane closed 6 months ago
Please do try with 1.2.14
master version
LD_LIBRARY_PATH=$PWD/zig-out/lib ../redub/build/redub :clear --compiler=ldc2
/home/kassane/sokol-d/src/examples/clear.d
/home/kassane/sokol-d/build/libsokol.a
std.exception.ErrnoException@std/stdio.d(682): Cannot open file `/home/kassane/sokol-d/build/libsokol.a' in mode `rb' (No such file or directory)
----------------
??:? [0x588dbc60d04e]
??:? [0x588dbc60ccc2]
??:? [0x588dbc6333be]
??:? [0x588dbc6149ef]
/home/kassane/ldcup/ldc2-bb083913-linux-x86_64/bin/../import/std/exception.d:522 [0x588dbc5a95d5]
??:? [0x588dbc5d1adf]
??:? [0x588dbc5f0fa3]
adv_diff/source/redub/libs/adv_diff/files.d:167 [0x588dbc5c7c78]
source/redub/building/cache.d:150 [0x588dbc5a1c71]
source/redub/building/cache.d:110 [0x588dbc5a1f46]
source/redub/api.d:147 [0x588dbc5a4f60]
source/app.d:231 [0x588dbc5a6203]
source/app.d:70 [0x588dbc5a53ec]
source/app.d:63 [0x588dbc5a5228]
??:? [0x588dbc6146cc]
??:? [0x588dbc6145c6]
??:? [0x588dbc61441c]
??:? [0x7a1f85cdfccf]
??:? __libc_start_main [0x7a1f85cdfd89]
??:? [0x588dbc573b24]
Why /home/kassane/sokol-d/build/libsokol.a
, wrong path? libsokol isn't static (search *.so)!!
My dub.sdl:
libs "sokol"
lflags "-Lzig-out/lib" platform="posix"
ldflags "/LIBPATH:zig-out/lib" platform="windows"
I'm current refactoring the up to date system. Right now it does not support using shared libraries as a dependency. If it is something just as simple as passing the .dll files to the linker I may implement it right after the refactor
I understand. No worries!😅
I'm still learning about dub/redub, in addition to Dlang.
I'm still confused about ldc2's limitation on Windows libraries and the dub doesn't seem friendly to me for adding conditioned dependencies. 🤔
My engine uses dll with no problems, which problem you're having with shared libraries? Usually I dynamically load them
which problem you're having with shared libraries? Usually I dynamically load them
Exactly, shared lib". So, just dynamic library loader. :thinking: I use static libraries by default (in zig build) all targets [ :heavy_check_mark: ]. But for re/dub support I thought about just adding shared. [ :x: ]
@kassane Maybe you could try it again on the latest version? There were a lot of updates since the last time you tried
note: libsokol - shared-library
note: libgc/libgccpp - static-libraries
"excludedSourceFiles": [
"src/examples/*.d",
"src/shaders/*.d"
],
"name": "clear",
"sourceFiles": [
"src/examples/clear.d"
],
So, this is kinda of an issue in how dub works also. So, for this issue, I'll do the following:
What do you think about that @kassane
@kassane This has been fixed at v1.3.20, please test it :)
@MrcSnm , sorry delay...
Not building file...
@@ -32,109 +32,109 @@ subPackage {
name "clear"
targetType "executable"
targetPath "build"
libs "sokol"
sourceFiles "src/examples/clear.d"
lflags "-Lzig-out/lib" platform="posix"
lflags "/LIBPATH:zig-out/lib" platform="windows"
- excludedSourceFiles "src/examples/sgl_context.d" "src/examples/triangle.d" "src/examples/sgl_points.d" "src/examples/saudio.d" "src/examples/debugtext.d" "src/examples/mrt.d" "src/examples/user_data.d" "src/examples/cube.d" "src/examples/blend.d" "src/shaders/*.d"
+ excludedSourceFiles "src/examples/*.d" "src/shaders/*.d"
preBuildCommands "zig build -Dshared -Doptimize=ReleaseFast"
}
$ redub build -b release --compiler=ldc2 :clear
Dependencies resolved in 13 ms for "release" using ldc2
Up-to-Date: clear []. Took 0ms
Up-to-Date: clear, skipping linking
Built project in 0 ms.
$ dub build -b release --compiler=ldc2 :clear Starting Performing "release" build using ldc2 for x86_64.
Building sokol-d:clear 0.1.0: building configuration [application]
Pre-build Running commands
Linking sokol-d_clear
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../lib/Scrt1.o: in function `_start':
(.text+0x1b): undefined reference to `main'
collect2: error: ld returned 1 exit status
Error: /usr/bin/cc failed with status: 1
Error ldc2 failed with exit code 1.
So, dub can't process the file with the given changes? :(
So, dub can't process the file with the given changes? :(
So, actually the dub is correct because the file was not created but redub did not report an error.
What happened was that redub reported that it was up to date, even skipping linking. This might be a bug since it should see also if the binary is up to date
Why re/dub clean
not remove targetPath
& builded files? Only pkg/deps file.
Because one may need to distribute some .dll/.so files in the same path
So, dub can't process the file with the given changes? :(
So, actually the dub is correct because the file was not created but redub did not report an error.
@kassane I have fixed that in the latest version. This bug was that was killing my rebuilding and now it has finally got stability on the up to date cache :)
Nice work @MrcSnm
Note: While testing this issue, a behavioral incompatibility between dub and redub was noted.
For current status, solve my issue... (update sokol-d v0.1.1 used on latest test, now is static-lib for re/dub). I want to understand exactly how to make it usable using your redub together with dub.
Not sure if I misunderstood, but while testing using redub, noticed that it requires dub installed to convert the sdl to json. Right? Could it be viable for a project to use both formats or would dub cause some kind of conflict?
Hide dub from redub
$ redub build -b release :clear
Warning: The compiler 'dmd' that was specified in your system wasn't found. Redub found ldc2 and it will use for this compilation.
object.Exception@source/redub/parsers/sdl.d(26): dub could not convert file at path /home/kassane/sokoldd/dub.sdl to json: /bin/sh: line 1: dub: command not found
@kassane The best way to support both of them is by using JSON
for both. Since JSON is supported out of the box from D, it was the language of choice. The thing about it is that I wanted to reduce complexity from dub codebase, so, supporting one less language makes it easier.
Also, from what I understood, looks like dub executes the exclude after the include (which IMO is pretty wrong. There's no sense into excluding explicitly defined sources)
Testing Environment
OS: ArchLinux & Windows 11 Arch: x86_64 (zen) Compiler: ldc2-master (1.36.0+)
I tried to run redub during my tests for dub support. But I didn't expect it to fail because it doesn't happen with dub.
redub build
```bash $> LD_LIBRARY_PATH=$PWD/zig-out/lib dub run redub -y -- :clear --compiler=ldc2 Building package redub in /home/kassane/.dub/packages/redub/1.2.13/redub/ Warning Warning ## Warning for package redub ## Warning Warning The following compiler flags have been specified in the package description Warning file. They are handled by DUB and direct use in packages is discouraged. Warning Alternatively, you can set the DFLAGS environment variable to pass custom flags Warning to the compiler, or use one of the suggestions below: Warning Warning debugMode: Call DUB with --build=debug Warning debugInfo: Call DUB with --build=debug Warning Starting Performing "debug" build using ldc2 for x86_64. Up-to-date colorize ~master: target for configuration [library] is up to date. Up-to-date semver ~master: target for configuration [library] is up to date. Up-to-date redub 1.2.13: target for configuration [cli] is up to date. Finished To force a rebuild of up-to-date targets, run again with --force Running ../.dub/packages/redub/1.2.13/redub/build/redub :clear --compiler=ldc2 Dependencies resolved in 22 ms. Build Failure: 'clear [] ' using flags 'ldc2' --enable-color=true --d-version=Have_clear -I/home/kassane/sokol-d/src -c --od=/tmp/.redub --of=/home/kassane/sokol-d/build/clear.o /home/kassane/sokol-d/src/examples/clear.d /home/kassane/sokol-d/src/sokol/log.d /home/kassane/sokol-d/src/sokol/utils.d /home/kassane/sokol-d/src/sokol/audio.d /home/kassane/sokol-d/src/sokol/debugtext.d /home/kassane/sokol-d/src/sokol/gfx.d /home/kassane/sokol-d/src/sokol/gl.d /home/kassane/sokol-d/src/sokol/shape.d /home/kassane/sokol-d/src/sokol/time.d /home/kassane/sokol-d/src/sokol/glue.d /home/kassane/sokol-d/src/sokol/app.d /home/kassane/sokol-d/src/examples/clear.d /home/kassane/sokol-d/src/handmade/math.d /home/kassane/sokol-d/src/shaders/blend.d /home/kassane/sokol-d/src/shaders/bufferoffsets.d /home/kassane/sokol-d/src/shaders/cube.d /home/kassane/sokol-d/src/shaders/instancing.d /home/kassane/sokol-d/src/shaders/mrt.d /home/kassane/sokol-d/src/shaders/noninterleaved.d /home/kassane/sokol-d/src/shaders/offscreen.d /home/kassane/sokol-d/src/shaders/quad.d /home/kassane/sokol-d/src/shaders/shapes.d /home/kassane/sokol-d/src/shaders/texcube.d Failed after 6041ms with message Error: module `examples.clear` from file /home/kassane/sokol-d/src/examples/clear.d is specified twice on the command line object.Error@(0): Build failure ---------------- ??:? [0x5ef5a3f0a13e] ??:? [0x5ef5a3f09db2] ??:? [0x5ef5a3f3043e] ??:? [0x5ef5a3f11a6f] ../.dub/packages/redub/1.2.13/redub/source/redub/api.d:84 [0x5ef5a3e8ea9d] ../.dub/packages/redub/1.2.13/redub/source/app.d:70 [0x5ef5a3e8f8cb] ../.dub/packages/redub/1.2.13/redub/source/app.d:63 [0x5ef5a3e8f746] ??:? [0x5ef5a3f1174c] ??:? [0x5ef5a3f11646] ??:? [0x5ef5a3f1149c] /home/kassane/ldcup/ldc2-bb083913-linux-x86_64/bin/../import/core/internal/entrypoint.d:42 [0x5ef5a3e91851] ??:? [0x7679dd1f7ccf] ??:? __libc_start_main [0x7679dd1f7d89] ??:? [0x5ef5a3e35b04] Error Program exited with code 1 ```dub build
```bash $> LD_LIBRARY_PATH=$PWD/zig-out/lib dub :clear --compiler=ldc2 Starting Performing "debug" build using ldc2 for x86_64. Up-to-date sokol-d:clear 0.1.0: target for configuration [application] is up to date. Finished To force a rebuild of up-to-date targets, run again with --force Running build/sokol-d_clear Backend: Glcore33 ```Reference