Skip to content
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

test experimental:compiletimeFFI on windows #18740

Closed

Conversation

timotheecour
Copy link
Member

follows #10150 and the recently merged Araq/libffi#6 which adds win64 support for libffi

@timotheecour timotheecour changed the title test nimHasLibFFI on windows test experimental:compiletimeFFI on windows Aug 24, 2021
@ringabout
Copy link
Member

  • libffi needs a tag or nimble install a specific hash
  • stderr not being able to be imported on windows

@timotheecour
Copy link
Member Author

timotheecour commented Aug 24, 2021

@xflywind

stderr not being able to be imported on windows

i had added nimEvalffiStderrWorkaround a while back to support openbsd; can you test if this change would make things work on windows:

when defined(openbsd):
=>
when defined(openbsd) or defined(windows):

(in tests/misc/trunner.nim)

?
thanks!

(in future work, this can be improved by using similar approach to proposal 5 from nim-lang/RFCs#205, shelling out to clang as discussed elsewhere)

@ringabout
Copy link
Member

I'm not sure how to test it.

bin/nim_temp c -r -d:nimTrunnerFfi tests/misc/trunner

Hint: C:\Users\blue\Documents\GitHub\Nim\tests\misc\trunner.exe  [Exec]
trunner.nim(68)          trunner
assertions.nim(38)       failedAssertImpl
assertions.nim(28)       raiseAssert
fatal.nim(53)            sysFatal
Error: unhandled exception: trunner.nim(68, 14) `output ==
    fmt"""{prefix}foo
foo:100
foo:101
foo:102:103
foo:102:103:104
foo:0.03:asdf:103:105
ret=[s1:foobar s2:foobar age:25 pi:3.14]
"""` MulCmp_352321691
MulCmp_352321691
MulCmp_352321690
foo
foo:100
foo:101
foo:102:103
foo:102:103:104
foo:0.03:asdf:103:105
ret=[s1:foobar s2:foobar age:25 pi:3.14]
 [AssertionDefect]
Error: execution of an external program failed: 'C:\Users\blue\Documents\GitHub\Nim\tests\misc\trunner.exe '
Traceback (most recent call last)
C:\Users\blue\Documents\GitHub\Nim\compiler\nim.nim(138) nim
C:\Users\blue\Documents\GitHub\Nim\compiler\nim.nim(119) handleCmdLine
C:\Users\blue\Documents\GitHub\Nim\compiler\extccomp.nim(403) execExternalProgram
C:\Users\blue\Documents\GitHub\Nim\compiler\msgs.nim(561) liMessage
C:\Users\blue\Documents\GitHub\Nim\compiler\msgs.nim(421) handleError
C:\Users\blue\Documents\GitHub\Nim\compiler\msgs.nim(402) quit

@timotheecour
Copy link
Member Author

timotheecour commented Aug 24, 2021

CI fails with:
2021-08-24T18:55:03.1470079Z could not load: C:\Users\VssAdministrator.nimble\pkgs\libffi-#153322d744666b312dd04b5cbd4e2444415e2260\libs\win64\libffi-7.dll

help welcome to figure out how to add libffi-7.dll for windows

how would i install libffi-7.dll dependency on windows, and in particular in CI?
CI uses nimInternalInstallDepsWindows; i'm assuming libffi-7.dll should be added to https://nim-lang.org/download/dlls.zip in the future but what can i do in the meantime (which is a necessary step before modifying dlls.zip anyways)
there's also https://sourceware.org/libffi/ but it mentions libffi-3.4.2, not libffi-7.dll; i'm not a windows user so I'm kind of in the dark here...

@ringabout ringabout self-assigned this Aug 25, 2021
@ringabout
Copy link
Member

ringabout commented Aug 13, 2022

stdout/stdin/stderr is defined as a macro in msvcrt.dll, so it doesn't work with importc.

@ringabout ringabout closed this Aug 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants