OCamlPro / gnucobol

A clone of the sourceforge GnuCOBOL compiler from COBOL to C.
https://get-superbol.com
GNU Lesser General Public License v3.0
16 stars 20 forks source link

Fix MacOS CI #145

Closed ddeclerck closed 2 months ago

GitMensch commented 2 months ago

consider to either include libjson-c or copying cJSON.[ch] into the libcob folder

concerning the one failed test:

27. used_binaries.at:1088: testing check include header file ...
../../tests/used_binaries.at:1103: $COMPILE_MODULE prog.cob
../../tests/used_binaries.at:1107: $COMPILE_MODULE --include $(_return_path "$(pwd)/filec.h") -fstatic-call prog.cob
stderr:
/var/folders/3m/p59k4qdj0f17st0gn2cmj3640000gn/T/cob16960_0.c:108:31: error: too few arguments to function call, expected 2, have 1
  b_2 = f ((cob_u8_ptr)"Hello");
        ~                     ^
/Users/runner/work/gnucobol/gnucobol/_build/tests/testsuite.dir/0027/filec.h:3:21: note: 'f' declared here
COB_EXT_IMPORT void f (char *, long);
                    ^
1 error generated.
../../tests/used_binaries.at:1125: $COMPILE_MODULE --save-temps filec.c -o libfilec.$COB_MODULE_EXT
../../tests/used_binaries.at:1129: $COMPILE_MODULE --include $(_return_path "$(pwd)/filec.h") -fstatic-call prog2.cob
--- /dev/null   2024-05-13 14:05:02
+++ /Users/runner/work/gnucobol/gnucobol/_build/tests/testsuite.dir/at-groups/27/stderr 2024-05-13 14:05:04
@@ -0,0 +1,4 @@
+ld: Undefined symbols:
+  _f, referenced from:
+      _prog_ in cob17175_0-e76249.o
+clang: error: linker command failed with exit code 1 (use -v to see invocation)
../../tests/used_binaries.at:1129: exit code was 1, expected 0
../../tests/used_binaries.at:1129: $COMPILE_MODULE --include $(_return_path "$(pwd)/filec.h") -fstatic-call -L. -lfilec prog2.cob
stderr:
ld: unsupported mach-o filetype (only MH_OBJECT and MH_DYLIB can be linked) in '/Users/runner/work/gnucobol/gnucobol/_build/tests/testsuite.dir/0027/libfilec.dylib'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
stdout:
../../tests/used_binaries.at:1129: exit code was 1, expected 0
27. used_binaries.at:1088: 27. check include header file (used_binaries.at:1088): FAILED (used_binaries.at:1129)

I have no clue how to fix that; my changes here seem to have fixed the Win32 (MinGW and MSVC) issues.

ddeclerck commented 2 months ago

concerning the one failed test:

27. used_binaries.at:1088: testing check include header file ...
../../tests/used_binaries.at:1103: $COMPILE_MODULE prog.cob
../../tests/used_binaries.at:1107: $COMPILE_MODULE --include $(_return_path "$(pwd)/filec.h") -fstatic-call prog.cob
stderr:
/var/folders/3m/p59k4qdj0f17st0gn2cmj3640000gn/T/cob16960_0.c:108:31: error: too few arguments to function call, expected 2, have 1
  b_2 = f ((cob_u8_ptr)"Hello");
        ~                     ^
/Users/runner/work/gnucobol/gnucobol/_build/tests/testsuite.dir/0027/filec.h:3:21: note: 'f' declared here
COB_EXT_IMPORT void f (char *, long);
                    ^
1 error generated.
../../tests/used_binaries.at:1125: $COMPILE_MODULE --save-temps filec.c -o libfilec.$COB_MODULE_EXT
../../tests/used_binaries.at:1129: $COMPILE_MODULE --include $(_return_path "$(pwd)/filec.h") -fstatic-call prog2.cob
--- /dev/null 2024-05-13 14:05:02
+++ /Users/runner/work/gnucobol/gnucobol/_build/tests/testsuite.dir/at-groups/27/stderr   2024-05-13 14:05:04
@@ -0,0 +1,4 @@
+ld: Undefined symbols:
+  _f, referenced from:
+      _prog_ in cob17175_0-e76249.o
+clang: error: linker command failed with exit code 1 (use -v to see invocation)
../../tests/used_binaries.at:1129: exit code was 1, expected 0
../../tests/used_binaries.at:1129: $COMPILE_MODULE --include $(_return_path "$(pwd)/filec.h") -fstatic-call -L. -lfilec prog2.cob
stderr:
ld: unsupported mach-o filetype (only MH_OBJECT and MH_DYLIB can be linked) in '/Users/runner/work/gnucobol/gnucobol/_build/tests/testsuite.dir/0027/libfilec.dylib'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
stdout:
../../tests/used_binaries.at:1129: exit code was 1, expected 0
27. used_binaries.at:1088: 27. check include header file (used_binaries.at:1088): FAILED (used_binaries.at:1129)

I have no clue how to fix that; my changes here seem to have fixed the Win32 (MinGW and MSVC) issues.

I believe this has to do with the bundle/loadable module VS dynamic library thing specific to MacOS. I have no idea how to fix that either (and no will to delve into MacOS insanities - I have to preserve my own sanity).

GitMensch commented 2 months ago

Far sanity purpose: let's use AT_XFAIL_IF ($COB_MODULE_EXT="dylib") in this test (with some useful description in a comment up-front.

But that looks highly suspicions: sed -i '' 's/-undefined suppress//g' config.h what are we doing here and why?

Concerning the addition of libjson-c / cJSON-[hc]: without that we don't build and test a complete module (the JSON part).

ddeclerck commented 2 months ago

Far sanity purpose: let's use AT_XFAIL_IF ($COB_MODULE_EXT="dylib") in this test (with some useful description in a comment up-front.

Alright.

But that looks highly suspicions: sed -i '' 's/-undefined suppress//g' config.h what are we doing here and why?

See comment above.

Concerning the addition of libjson-c / cJSON-[hc]: without that we don't build and test a complete module (the JSON part).

Yeah, I realized meanwhile and made the change ;)

GitMensch commented 2 months ago

All checks pass - YAY. As noted: please adjust the typo for "ototype" in configure.ac as well and check that in upstream together with a Changelog entry. As we do change something "quite big" for darwin, it is likely a good idea to also note that in NEWS, what do you think?

After doing the configure.ac related changes upstream, this PR needs to be rebased (or adjusted to only change the mirror-only workflow definitions).

ddeclerck commented 2 months ago

All checks pass - YAY. As noted: please adjust the typo for "ototype" in configure.ac as well and check that in upstream together with a Changelog entry. As we do change something "quite big" for darwin, it is likely a good idea to also note that in NEWS, what do you think?

Changes done. I also added a NEWS entry, because this is indeed an important change.

After doing the configure.ac related changes upstream, this PR needs to be rebased (or adjusted to only change the mirror-only workflow definitions).

I'll do that in the morning.