Skip to content

Fix windows debug#398

Open
simonlegrand wants to merge 3 commits into
FreeFem:developfrom
simonlegrand:fix_windows_debug
Open

Fix windows debug#398
simonlegrand wants to merge 3 commits into
FreeFem:developfrom
simonlegrand:fix_windows_debug

Conversation

@simonlegrand

@simonlegrand simonlegrand commented May 31, 2026

Copy link
Copy Markdown
Contributor

Fix of the compilation errors like:

(.pdata$_ZNK10E_F_F0_OptI6ResizeI2KNIPKN5Fem2D4MeshEEEPS6_Lb1EEclEPv+0x0): relocation truncated to fit: IMAGE_REL_AMD64_ADDR32NB against `.text$_ZNK10E_F_F0_OptI6ResizeI2KNIPKN5Fem2D4MeshEEEPS6_Lb1EEclEPv'

on Windows in Debug mode. According to the doc, the address space of the 'relocation section' is only 32 bits large. Since some symbols couldn't fit into this section, it led to many subsequent 'undefined reference'. Adding the "-Wa,-mbig-obj" assembler flag fixes the problem by increasing the size of the relocation section.
There are still errors during the 'make check' phase, but it seems a good beginning, we can debug under Windows.

I also removed unused ff_nocygwin variable

@simonlegrand
simonlegrand force-pushed the fix_windows_debug branch 2 times, most recently from 7f34081 to e0cb3cf Compare May 31, 2026 16:54
@prj-

prj- commented Jun 30, 2026

Copy link
Copy Markdown
Member

@simonlegrand, any plan to wrap this up soon?

@simonlegrand

Copy link
Copy Markdown
Contributor Author

To sum up check failures:

  • 3d/Poisson3d.md on Windows/sequential. An assertion fails.
  • plugin/shell.edp, on both Windows/sequential and Windows/full, generates a SIGSEGV

I just returned from vacation, Ididn't have time to investigate yet. I could use some help for the assertion failure, and I'll try to get more details about the segmentation fault.

@frederichecht

frederichecht commented Jul 1, 2026 via email

Copy link
Copy Markdown
Contributor

frederichecht added a commit that referenced this pull request Jul 2, 2026
@prj-

prj- commented Jul 3, 2026

Copy link
Copy Markdown
Member

@simonlegrand, could you please grant me write-access to your fork?

@prj-
prj- force-pushed the fix_windows_debug branch from e0cb3cf to 180c160 Compare July 3, 2026 13:31
@simonlegrand

Copy link
Copy Markdown
Contributor Author

I found out that the call to the stat function in shell.cpp

long ff_isdir(string *c) {
  struct stat buff;
  if (0 == stat(c->c_str(), &buff)) {
    return (buff.st_mode & S_IFDIR) ? 1 : 0;
  }
  else{
    return -1;
  }
}

triggers a SIGSEV signal in on Windows/Debug. AI told me that it is a known bug in MinGW, the macro stat expands to a function (e.g., _stat64) that writes a larger struct than struct stat resolves to (e.g., struct _stat32).
I proposed an #ifdef _WIN32 solution in 008c1d6, , but I think using std::filesystem would be more robust (and modern). I implies switching to c++17. What do you think?

@prj-

prj- commented Jul 22, 2026

Copy link
Copy Markdown
Member

If we can stick to C++14, I think we should.

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.

3 participants