I tried to build sdcc from current trunk in Cygwin on Windows 10 (in a qemu VM on Debian GNU/Linux).
This fails when trying to build the libraries due to some preprocessor issue:
/home/test/sdcc-code/sdcc/bin/sdcc -I../../device/include -I../../device/include/mcs51 -mds390 --nostdinc --std-c2x -c _atof.c -o ds390/_atof.rel
C:/cygwin64/home/test/sdcc-code/sdcc/support/cpp/gcc/cpp.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory
at 1: warning 190: ISO C forbids an empty translation unit
subprocess error 32512
make[4]: *** [Makefile:728: ds390/_atof.rel] Error 1
Looking at the DLLs used:
All are found. Maybe when cpp is called from sdcc, the PATH is lost, and they are no longer found.
Last edit: Philipp Klaus Krause 2023-05-15
In fact, bin/sdcpp replaces PATH. If on cygwin PATH is (wild guess) abused to locate shared libraries, I can imagine that (at least) cygwin1.dll can't be found because of that.
To test this, replace
export PATH=${abs_top_builddir}/support/cpp/gcc
by
export PATH=${abs_top_builddir}/support/cpp/gcc:$PATH
in bin/sdcpp (and bin/sdcpp.in).
Otherwise, it might help to know what the broken error message "[..] libraries: ?: cannot open [..]" is supposed to convey. strace?
Indeed that works. I now can compile. The Cygwin build still fails when linking though (I'll put that problem into a separate reply).
According to https://learn.microsoft.com/de-de/windows/win32/dlls/dynamic-link-library-search-order the following are searched in order when looking for DLLs:
Compilation works when changing PATH in sdcpp, as suggested by @felixs above.
Now the build fails when linking:
I see the wrapper
bin/sdarbut there is nosupport/sdbinutils/binutils/libs/sdar. However, there aresupport/sdbinutils/binutils/sdar.exeandsupport/sdbinutils/binutils/.libs/sdar.exe.There are two ways. Either we patch binutils removing the .exe nonsense, or we patch bin/*.in. I can see some cygwin related stub there, but it doesn't seem to do anything.
In the meantime, you could try and hardcode .exe there, check what else breaks on cygwin.
thanks
felix
The change needed in bin/sdar.in is as follows.
-bin=sdar
+EXEEXT=@EXEEXT@
+bin=sdar${EXEEXT}
This should work as long as configure and support/sdbinutils/configure agree on EXEEXT, which I think they do.
That still leaves a
binutils/libs/sdar.exevsbinutils/.libs/sdar.exeproblem.P.S.: Commenting out the 3 lines following "non-cygwin" makes it work for me.
Last edit: Philipp Klaus Krause 2023-05-16
Fixed in [r14063]. still need to fix regression tests on cygwin...
Related
Commit: [r14063]