-
Notifications
You must be signed in to change notification settings - Fork 30
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
Using tsdl in toplevel on Windows #96
Comments
More context:
but
which misses |
Since 116ab1f
in ec9ddc9 I adapted the Could you perhaps test this ? |
Give me some time to get re-acquainted and a few other things, but yes I'll test this. |
With the latest tsdl: $ git rev-parse master
fd77252b640a835bd58c73929142f182b8544bc6 I get an error from
The logs:
¹ Notes so I can recreate at a later date: https://gist.github.com/jonahbeckford/0b354398726e03a3bbb36e5f22efb902 |
This seems to come from I was recently on a call with Tarides people and they told me there was a problem with cross compiling where basically (Various things were discussed like working around in Perhaps related ? |
I don't do cross-compiling to/from Windows and non-Windows. But just in case I mixed Windows 32-bit PE modules with 64-bit, I checked both:
I'll open a ticket on flexdll: ocaml/flexdll#143 |
Just from a brief glance at the log, I am struck by the use of |
Mmh right. I took that line from @jonahbeckford's patch here in ec9ddc9. All the logic is condensed here. I guess it works on unices, i.e. you can use the The current value should be used for the |
Note that what I wrote here was wrong, it failed custom mode builds and was subsequently fixed by 48b49ad. This means that the state on a unix is:
Mutatis mutandis I think the state on windows should be:
which commit 44bce9b should bring. |
New logs:
The $ dir Y:/source/tsdl/_opam/share/dkcoder-c/debug/lib/pkgconfig/../../lib
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 10/14/2024 7:38 AM 10962 ffi.lib
-a--- 10/14/2024 7:46 AM 12962 SDL2_imaged.lib
-a--- 10/14/2024 7:42 AM 184714 SDL2d.lib
... But the listing of the stub libraries shows we need $ dir _opam\.opam-switch\build\tsdl.1.1.0\_build\src\*.lib
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 10/16/2024 1:26 PM 1696 libtsdl_stubs.lib
-a--- 10/16/2024 1:26 PM 782752 tsdl.lib |
A yes
That's not going to work in the context where it's going to be invoked. For compiling things the OCaml compiler should be setup for finding the |
Thanks. So that works, but now I am getting an error similar to the original symptom: $ opam exec -- cmake -E env --modify PATH=path_list_prepend:Y:\source\tsdl\_opam\share\dkcoder-c\bin dune utop
Fatal error: cannot load shared library dlltsdl_stubs
Reason: Cannot resolve SDL_LogMessage
Exit code 0xc0000409
$ dk Ml.Use -- ldd ..\_opam\.opam-switch\build\tsdl.1.1.0\_build\src\dlltsdl_stubs.dll
Cannot find FLEXDLL_RELOCATE
ntdll.dll => /c/WINDOWS/SYSTEM32/ntdll.dll (0x7ffbbdcb0000)
KERNEL32.DLL => /c/WINDOWS/System32/KERNEL32.DLL (0x7ffbbc5a0000)
KERNELBASE.dll => /c/WINDOWS/System32/KERNELBASE.dll (0x7ffbbb430000)
msvcrt.dll => /c/WINDOWS/System32/msvcrt.dll (0x7ffbbbb80000)
dlltsdl_stubs.dll => /y/source/tsdl/_opam/.opam-switch/build/tsdl.1.1.0/_build/src/dlltsdl_stubs.dll (0x5a200000)
ucrtbase.dll => /c/Windows/System32/ucrtbase.dll (0x7ffbbb7f0000)
vcruntime140.dll => /c/Windows/System32/vcruntime140.dll (0x7ffbaa070000) The What I expect to see is the $ dk Ml.Use -- ldd Y:\source\dksdk-coder\.ci\o\two\lib\stublibs\dlltsdl.dll
ntdll.dll => /c/WINDOWS/SYSTEM32/ntdll.dll (0x7ffbbdcb0000)
KERNEL32.DLL => /c/WINDOWS/System32/KERNEL32.DLL (0x7ffbbc5a0000)
KERNELBASE.dll => /c/WINDOWS/System32/KERNELBASE.dll (0x7ffbbb430000)
msvcrt.dll => /c/WINDOWS/System32/msvcrt.dll (0x7ffbbbb80000)
dlltsdl.dll => /y/source/dksdk-coder/.ci/o/two/lib/stublibs/dlltsdl.dll (0x5a200000)
ucrtbase.dll => /c/Windows/System32/ucrtbase.dll (0x7ffbbb7f0000)
vcruntime140.dll => /c/Windows/System32/vcruntime140.dll (0x7ffbaa070000)
SDL2d.dll => not found
api-ms-win-crt-environment-l1-1-0.dll => /y/VS/Common7/IDE/api-ms-win-crt-environment-l1-1-0.dll (?)
api-ms-win-crt-stdio-l1-1-0.dll => /y/VS/Common7/IDE/api-ms-win-crt-stdio-l1-1-0.dll (?)
api-ms-win-crt-runtime-l1-1-0.dll => /y/VS/Common7/IDE/api-ms-win-crt-runtime-l1-1-0.dll (?) I don't have a hypothesis so it will take substantial time to debug and/or bisect to figure out what is different (which I can't do this week). |
Okay thanks. Also I think that we could remove 9a5f889 and I think something's wrong with the SDL
For example on macos this looks like this:
So basically this looks empty or in other words |
Because we have a regular stub to SDL_LogMessage anyways now.
That sounds right.
Yes, it is empty because it is not an
|
That looks wrong to me. I don't think this should be interpreted that literally. Conceptually this should output how to link your library. If your C toolchain doesn't use a If you read the (It doesn't mean that I don't think the |
Conceptually you are right. After researching the issue more ... I think the correct thing is to use the
and I could make sure that the You would need to also convert the What do you think about doing that instead? The precise semantics can be seen in the Given https://github.com/pkgconf/pkgconf/blob/pkgconf-2.3.0/tests/lib1/fragment-escaping-1.pc the output is https://github.com/pkgconf/pkgconf/blob/a88c0d962a987c62d98ede5a738e37ec71005cbd/tests/parser.sh#L280 |
Sounds good, finger crossed ! beee83f |
Oops. Forgot to do that but I need to go. |
Done in 9efd7ca |
This can wait! Using the last commit I get the
which makes no sense to me since the following works: $ dk Ml.Use -- ls -l Y:/source/tsdl/_opam/share/dkcoder-c/debug/lib/pkgconfig/../../lib/SDL2d.lib
-rw-r--r-- 1 beckf beckf 184714 Oct 14 07:42 Y:/source/tsdl/_opam/share/dkcoder-c/debug/lib/pkgconfig/../../lib/SDL2d.lib
$ dk Ml.Use -- dumpbin /EXPORTS Y:/source/tsdl/_opam/share/dkcoder-c/debug/lib/pkgconfig/../../lib/SDL2d.lib
SDL_AddEventWatch
...
SDL_wcsstr I'll edit this comment once I'm done investigating. EDIT: With the following patch so I can see the ocamlmklib steps: commit 3b5789b69a44469756866a3b86e174dadd43cd83 (HEAD -> tsdl-toplevel)
Author: Jonah Beckford <[email protected]>
Date: Fri Oct 25 11:42:49 2024 -0700
Add -v to ocamlmklib
diff --git a/myocamlbuild.ml b/myocamlbuild.ml
index c686c66..f4d482e 100644
--- a/myocamlbuild.ml
+++ b/myocamlbuild.ml
@@ -52,7 +52,7 @@ let lib_with_clib ~lib ~clib ~has_lib ~src_dir ~stublib =
flag ["c"; "compile"; use_clib] (S clib_cflags);
- flag ["c"; "ocamlmklib"; use_clib] (S (clib_L @ clib_l));
+ flag ["c"; "ocamlmklib"; use_clib] (S (A "-v" :: clib_L @ clib_l));
flag ["link"; "ocaml"; "library"; "byte"; record_stub_lib]
(S (dllibs [dynamic_stub_l] @ clib_ccopts @ clib_cclibs)); I get:
That is a |
(I'll submit a PR)
Using
dune utop
in an opam switch that hastsdl
on Windows results in:That is because
<opamswitch>\lib\tsdl\tsdl.cma
has:It should be something like:
The text was updated successfully, but these errors were encountered: