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

Fix windows builds - link error #9

Open
joanibal opened this issue Mar 15, 2023 · 2 comments
Open

Fix windows builds - link error #9

joanibal opened this issue Mar 15, 2023 · 2 comments

Comments

@joanibal
Copy link
Owner

joanibal commented Mar 15, 2023

On Windows the build repeatedly fails at the linking stage with the following error.

"gfortran"  -o libavl.cp39-win_amd64.pyd libavl.cp39-win_amd64.pyd.p/meson-generated_.._libavlmodule.c.obj libavl.cp39-win_amd64.pyd.p/meson-generated_.._libavl-f2pywrappers.f.obj libavl.cp39-win_amd64.pyd.p/src_aero.f.obj libavl.cp39-win_amd64.pyd.p/src_aic.f.obj libavl.cp39-win_amd64.pyd.p/src_ainput.f.obj libavl.cp39-win_amd64.pyd.p/src_airutil.f.obj libavl.cp39-win_amd64.pyd.p/src_amake.f.obj libavl.cp39-win_amd64.pyd.p/src_amass.f.obj libavl.cp39-win_amd64.pyd.p/src_amode.f.obj libavl.cp39-win_amd64.pyd.p/src_aoper.f.obj libavl.cp39-win_amd64.pyd.p/src_aoutput.f.obj libavl.cp39-win_amd64.pyd.p/src_asetup.f.obj libavl.cp39-win_amd64.pyd.p/src_atpforc.f.obj libavl.cp39-win_amd64.pyd.p/src_atrim.f.obj libavl.cp39-win_amd64.pyd.p/src_autil.f.obj libavl.cp39-win_amd64.pyd.p/src_avl.f.obj libavl.cp39-win_amd64.pyd.p/src_cdcl.f.obj libavl.cp39-win_amd64.pyd.p/src_getvm.f.obj libavl.cp39-win_amd64.pyd.p/src_hidden.f.obj libavl.cp39-win_amd64.pyd.p/src_matrix-lapackdp.f.obj libavl.cp39-win_amd64.pyd.p/src_second.f.obj libavl.cp39-win_amd64.pyd.p/src_sgutil.f.obj libavl.cp39-win_amd64.pyd.p/src_spline.f.obj libavl.cp39-win_amd64.pyd.p/src_userio.f.obj libavl.cp39-win_amd64.pyd.p/src_eispack.f.obj libavl.cp39-win_amd64.pyd.p/306a480927d86681adc867cd3f47a3309803b56d_.._.._f2py_src_fortranobject.c.obj "-Lc:/rtools40/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0" "-LC:/rtools40/ucrt64/lib/gcc/x86_64-w64-mingw32/10.3.0" "-Lc:/rtools40/ucrt64/bin/../lib/gcc" "-LC:/rtools40/ucrt64/lib/gcc" "-Lc:/rtools40/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/lib/../lib" "-LC:/rtools40/ucrt64/x86_64-w64-mingw32/lib" "-Lc:/rtools40/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../lib" "-LC:/rtools40/ucrt64/lib" "-Lc:/rtools40/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/lib" "-Lc:/rtools40/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../.." "-Wl,--allow-shlib-undefined" "-shared" "-Wl,--start-group" "-Wl,--out-implib=libavl.cp39-win_amd64.dll.a" "-lucrt" "-static" "lib_fortranobject.a" "-mcmodel=medium" "c:/opt/64/lib/libopenblas_v0.3.20-571-g3dec11c6-gcc_10_3_0.dll.a" "-defaultlib:advapi32" "c:/rtools40/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/libgfortran.a" "-defaultlib:advapi32" "C:\Users\runneradmin\AppData\Local\pypa\cibuildwheel\Cache\nuget-cpython\python.3.9.13\tools\python39.dll" "-lgfortran" "-lm" "-Wl,--end-group"
    c:/rtools40/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/lib/../lib/dllcrt2.o: in function `_CRT_INIT':
    D:/a/rtools-testing/rtools-testing/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtdll.c:122:(.text+0x4d): relocation truncated to fit: IMAGE_REL_AMD64_REL32 against symbol `__imp_Sleep' defined in .idata$5 section in c:/rtools40/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/lib/../lib\libkernel32.a(dqoks01409.o)
    D:/a/rtools-testing/rtools-testing/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtdll.c:90:(.text+0xc2): relocation truncated to fit: IMAGE_REL_AMD64_REL32 against symbol `__imp_Sleep' defined in .idata$5 section in c:/rtools40/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/lib/../lib\libkernel32.a(dqoks01409.o)
    libavl.cp39-win_amd64.pyd.p/meson-generated_.._libavlmodule.c.obj:libavlmodule.c:(.text+0x17ef): relocation truncated to fit: IMAGE_REL_AMD64_REL32 against symbol `__imp_PyArg_ParseTupleAndKeywords' defined in .idata$5 section in d000001.o
    libavl.cp39-win_amd64.pyd.p/meson-generated_.._libavlmodule.c.obj:libavlmodule.c:(.text+0x17fb): relocation truncated to fit: IMAGE_REL_AMD64_REL32 against symbol `__imp_PyErr_Occurred' defined in .idata$5 section in d000014.o
    libavl.cp39-win_amd64.pyd.p/meson-generated_.._libavlmodule.c.obj:libavlmodule.c:(.text+0x1831): relocation truncated to fit: IMAGE_REL_AMD64_REL32 against symbol `__imp_Py_BuildValue' defined in .idata$5 section in d000045.o
    libavl.cp39-win_amd64.pyd.p/meson-generated_.._libavlmodule.c.obj:libavlmodule.c:(.text+0x187f): relocation truncated to fit: IMAGE_REL_AMD64_REL32 against symbol `__imp_PyArg_ParseTupleAndKeywords' defined in .idata$5 section in d000001.o
    libavl.cp39-win_amd64.pyd.p/meson-generated_.._libavlmodule.c.obj:libavlmodule.c:(.text+0x188b): relocation truncated to fit: IMAGE_REL_AMD64_REL32 against symbol `__imp_PyErr_Occurred' defined in .idata$5 section in d000014.o
    libavl.cp39-win_amd64.pyd.p/meson-generated_.._libavlmodule.c.obj:libavlmodule.c:(.text+0x18c1): relocation truncated to fit: IMAGE_REL_AMD64_REL32 against symbol `__imp_Py_BuildValue' defined in .idata$5 section in d000045.o
    libavl.cp39-win_amd64.pyd.p/meson-generated_.._libavlmodule.c.obj:libavlmodule.c:(.text+0x190f): relocation truncated to fit: IMAGE_REL_AMD64_REL32 against symbol `__imp_PyArg_ParseTupleAndKeywords' defined in .idata$5 section in d000001.o
    libavl.cp39-win_amd64.pyd.p/meson-generated_.._libavlmodule.c.obj:libavlmodule.c:(.text+0x191b): relocation truncated to fit: IMAGE_REL_AMD64_REL32 against symbol `__imp_PyErr_Occurred' defined in .idata$5 section in d000014.o
    libavl.cp39-win_amd64.pyd.p/meson-generated_.._libavlmodule.c.obj:libavlmodule.c:(.text+0x1951): additional relocation overflows omitted from the output
  
    collect2.exe: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    INFO: autodetecting backend as ninja
    INFO: calculating backend command to run: C:\Users\runneradmin\AppData\Local\Temp\pip-build-env-r5a546wj\overlay\Scripts\ninja.EXE
    error: subprocess-exited-with-error

Based on this stack overflow post this issue is related to translating 64 bit memory address to 32 bit addresses.
The linker relocates data in the .o based on its new memory address in the linked program.
A similar operation (R_X86_64_PC32) occurs in the linux .o files so the operation itself may not be the issue.

I tried..

  • additional linking flags
    • '-mcmodel=medium'
    • '-Wl,--image-base,0x10000000'
  • additional compiler args
    • '-fomit-frame-pointer' based on AVL make file
    • '-mcmodel=medium'

So possible next steps

  • compile AVL by itself on Windows using the included make file
    • create a windows virtual machine on your laptop
  • interactive debugging of the failed build using ssh (action here)
@joanibal
Copy link
Owner Author

joanibal commented Mar 5, 2024

Once the windows builds are working again we'll need to add the sym linking to the dynamic libraries for windows.
This post talks about creating sym links without admin privileges.

@HB-Stratos
Copy link

Have there been any news on repairing the windows version? I'd like to use this tool to perform analysis for my student group, and having every team member set up WSL and somehow convincing pycharm to use it is something that I'm not sure is feasible.

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

No branches or pull requests

2 participants