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

testing rpath on MacOS during testsuite #49

Closed
wants to merge 10 commits into from

Conversation

GitMensch
Copy link
Collaborator

PR to test that with the MacOS runner

@GitMensch
Copy link
Collaborator Author

Yay, I'm a first time contributor so need a maintainer to get my workflow run approved :-)

Note: this is not intended to be merged directly, if it works out I'll commit this upstream with a ChangeLog entry - if you have any review notes then I'm eager to read them in any case.

@GitMensch GitMensch mentioned this pull request Jul 10, 2022
@nberth
Copy link
Contributor

nberth commented Jul 11, 2022

Hi @GitMensch . I've just asked a colleague knowledgeable than me on macos workings for his thoughts on this.

@nberth
Copy link
Contributor

nberth commented Jul 11, 2022

-cobc: prog.cob: No such file or directory
+cobc: /Users/runner/work/gnucobol/gnucobol/_build/libcob/.libs": No such file or directory
 
7. used_binaries.at:328: 7. source file not found (used_binaries.at:328): FAILED (used_binaries.at:331)

Ouch, seems like argument to -R needs to exist… or is it the right one?

@GitMensch
Copy link
Collaborator Author

It should exists, otherwise it does not make any sense.
But there seems to be a general issue here, looking at the testsuite.log (checking for -vv there commonly helps to inspect and fix system specific errors - actually this is the reason those test paths were added for):

command line: /Users/runner/work/gnucobol/gnucobol/_build/cobc/.libs/cobc -x -debug -Wall -fno-diagnostics-show-option -Q "-R -vv -j /Users/runner/work/gnucobol/gnucobol/_build/libcob/.libs"

Something is added between -R and the path ?!?

@GitMensch
Copy link
Collaborator Author

Another workflow to approve - just used the "forward option to linker" this time, which allows comma-separated options because the previous quoting seems to be broken "somewhere" (it always worked with installed versions of GnuCOBOL, so I don't want to put time in that checking about it not working without shell access [I guess there is a way to ssh into GH workers, but I didn't checked if/how it can be done so far]).

tests/atlocal.in Outdated
# MacOS workaround (HACK) to embed rpath during test
if test "$GNUCOBOL_ENV_SETUP" != "1" -a "$GNUCOBOL_TEST_LOCAL" != "1"; then
# HACK, may need some version check, should likely be disabled if configure used --without-rpath
case "$OSTYPE" in darwin*) FLAGS="${FLAGS} -Q -Wl,-rpath,${abs_top_builddir}/libcob/.libs";; esac
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does abs_top_builddir need quotes in case someone has spaces in the build path? But it's a workaround for the CI so I guess that may be ok.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory, yes - as we now are back to "failing as before" I'll add it, just to check if this breaks the test runs again.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work as good as before.

@GitMensch
Copy link
Collaborator Author

Presumably the rpath got inserted but the link-name is still hard-wired in. If this is the case it likely should be possible to post-remove it - but that's not what we want.

I hope your colleague has an idea - here are the commands that are executed and the result:

executing:	gcc -c -I/Users/runner/work/gnucobol/gnucobol/_build/..
		-fstack-protector-strong -pipe
		-I/usr/local/opt/berkeley-db@4/include
		-I/usr/local/Cellar/gmp/6.2.1_1/include -I/usr/local/include
		-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -I/usr/local/include
		-Wno-unused -fsigned-char -Wno-pointer-sign -Qunused-arguments
		-O -v -o
		"/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/cob15636_0.o"
		"/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/cob15636_0.c"
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Applications/Xcode_13.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
 "/Applications/Xcode_13.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx11.0.0 -Wundef-prefix=TARGET_OS_ -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -emit-obj --mrelax-relocations -disable-free -disable-llvm-verifier -discard-value-names -main-file-name cob15636_0.c -mrelocation-model pic -pic-level 2 -mframe-pointer=all -fno-strict-return -fno-rounding-math -munwind-tables -target-sdk-version=12.1 -fvisibility-inlines-hidden-static-local-var -target-cpu penryn -tune-cpu generic -debugger-tuning=lldb -target-linker-version 711 -v -resource-dir /Applications/Xcode_13.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0 -isysroot /Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -I /Users/runner/work/gnucobol/gnucobol/_build/.. -I /usr/local/opt/berkeley-db@4/include -I /usr/local/Cellar/gmp/6.2.1_1/include -I /usr/local/include -U _FORTIFY_SOURCE -D _FORTIFY_SOURCE=2 -I /usr/local/include -I/usr/local/include -internal-isystem /Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include -internal-isystem /Applications/Xcode_13.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0/include -internal-externc-isystem /Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -internal-externc-isystem /Applications/Xcode_13.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -O1 -Wno-unused -Wno-pointer-sign -Wno-reorder-init-list -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-final-dtor-non-final-class -Wno-extra-semi-stmt -Wno-misleading-indentation -Wno-quoted-include-in-framework-header -Wno-implicit-fallthrough -Wno-enum-enum-conversion -Wno-enum-float-conversion -Wno-elaborated-enum-base -fdebug-compilation-dir /Users/runner/work/gnucobol/gnucobol/_build/tests/testsuite.dir/0023 -ferror-limit 19 -stack-protector 2 -fstack-check -mdarwin-stkchk-strong-link -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fmax-type-align=16 -fcommon -clang-vendor-feature=+nullptrToBoolConversion -clang-vendor-feature=+messageToSelfInClassMethodIdReturnType -clang-vendor-feature=+disableInferNewAvailabilityFromInit -clang-vendor-feature=+disableNeonImmediateRangeCheck -clang-vendor-feature=+disableNonDependentMemberExprInCurrentInstantiation -fno-odr-hash-protocols -clang-vendor-feature=+revert09abecef7bbf -mllvm -disable-aligned-alloc-awareness=1 -mllvm -enable-dse-memoryssa=0 -o /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/cob15636_0.o -x c /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/cob15636_0.c
clang -cc1 version 13.0.0 (clang-1300.0.29.30) default target x86_64-apple-darwin20.6.0
ignoring nonexistent directory "/Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Library/Frameworks"
ignoring duplicate directory "/usr/local/include"
ignoring duplicate directory "/usr/local/include"
#include "..." search starts here:
#include <...> search starts here:
 /Users/runner/work/gnucobol/gnucobol/_build/..
 /usr/local/opt/berkeley-db@4/include
 /usr/local/Cellar/gmp/6.2.1_1/include
 /usr/local/include
 /Applications/Xcode_13.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0/include
 /Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
 /Applications/Xcode_13.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
 /Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
End of search list.
return status:	0
executing:	gcc -o "a.out"
		"/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/cob15636_0.o"
		-L/usr/local/opt/berkeley-db@4/lib -L/usr/local/opt/bison/lib
		-L/usr/local/opt/help2man/lib -fstack-protector-strong
		-Wl,-rpath,/Users/runner/work/gnucobol/gnucobol/_build/libcob/.libs
		-L/Users/runner/work/gnucobol/gnucobol/_build/libcob/.libs
		-L/usr/local/lib -lcob
return status:	0
executing:	./a.out
dyld: Library not loaded: /usr/local/lib/libcob.4.dylib
  Referenced from: /Users/runner/work/gnucobol/gnucobol/_build/tests/testsuite.dir/0023/./a.out
  Reason: image not found
cobc: external process "./a.out" ended with signal SIGABRT (6)
return status:	6

@nberth
Copy link
Contributor

nberth commented Jul 11, 2022

As far as I can understand, here maybe an approach is to tweak the "install name" of the library w.r.t the executable. Apparently there's also a tool to change that. (cf. https://stackoverflow.com/questions/27506450/clang-change-dependent-shared-library-install-name-at-link-time )

@GitMensch
Copy link
Collaborator Author

We don't want to tweak the install name of the library as this would also have an effect on the actual installed one - we should only tweak the testsuite.
I'll try to use the full path instead of -L next...

@codecov-commenter
Copy link

codecov-commenter commented Jul 11, 2022

Codecov Report

Merging #49 (ab5b0b7) into gcos4gnucobol-3.x (6a24f9a) will increase coverage by 0.00%.
The diff coverage is n/a.

@@                Coverage Diff                 @@
##           gcos4gnucobol-3.x      #49   +/-   ##
==================================================
  Coverage              66.23%   66.23%           
==================================================
  Files                     32       32           
  Lines                  51948    51948           
  Branches               13386    13386           
==================================================
+ Hits                   34406    34407    +1     
+ Misses                 12150    12149    -1     
  Partials                5392     5392           
Impacted Files Coverage Δ
libcob/intrinsic.c 74.25% <0.00%> (+0.03%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6a24f9a...ab5b0b7. Read the comment docs.

@GitMensch
Copy link
Collaborator Author

OK, changed the compile to not link against the system libcob at all - but it is still searched.

This brings us to another "may be inspected by someone":

+executing:	gcc -c -I/Users/runner/work/gnucobol/gnucobol/_build/..
+		-fstack-protector-strong -pipe
+		-I/usr/local/opt/berkeley-db@4/include
+		-I/usr/local/Cellar/gmp/6.2.1_1/include -I/usr/local/include
+		-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -I/usr/local/include
+		-Wno-unused -fsigned-char -Wno-pointer-sign -Qunused-arguments
+		-O -v -o
+		"/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/cob13089_0.o"
+		"/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/cob13089_0.c"
+Apple clang version 13.0.0 (clang-1300.0.29.30)
+Target: x86_64-apple-darwin20.6.0
+Thread model: posix
+InstalledDir: /Applications/Xcode_13.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
+ "/Applications/Xcode_13.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx11.0.0 -Wundef-prefix=TARGET_OS_ -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -emit-obj --mrelax-relocations -disable-free -disable-llvm-verifier -discard-value-names -main-file-name cob13089_0.c -mrelocation-model pic -pic-level 2 -mframe-pointer=all -fno-strict-return -fno-rounding-math -munwind-tables -target-sdk-version=12.1 -fvisibility-inlines-hidden-static-local-var -target-cpu penryn -tune-cpu generic -debugger-tuning=lldb -target-linker-version 711 -v -resource-dir /Applications/Xcode_13.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0 -isysroot /Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -I /Users/runner/work/gnucobol/gnucobol/_build/.. -I /usr/local/opt/berkeley-db@4/include -I /usr/local/Cellar/gmp/6.2.1_1/include -I /usr/local/include -U _FORTIFY_SOURCE -D _FORTIFY_SOURCE=2 -I /usr/local/include -I/usr/local/include -internal-isystem /Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include -internal-isystem /Applications/Xcode_13.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0/include -internal-externc-isystem /Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -internal-externc-isystem /Applications/Xcode_13.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -O1 -Wno-unused -Wno-pointer-sign -Wno-reorder-init-list -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-final-dtor-non-final-class -Wno-extra-semi-stmt -Wno-misleading-indentation -Wno-quoted-include-in-framework-header -Wno-implicit-fallthrough -Wno-enum-enum-conversion -Wno-enum-float-conversion -Wno-elaborated-enum-base -fdebug-compilation-dir /Users/runner/work/gnucobol/gnucobol/_build/tests/testsuite.dir/0023 -ferror-limit 19 -stack-protector 2 -fstack-check -mdarwin-stkchk-strong-link -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fmax-type-align=16 -fcommon -clang-vendor-feature=+nullptrToBoolConversion -clang-vendor-feature=+messageToSelfInClassMethodIdReturnType -clang-vendor-feature=+disableInferNewAvailabilityFromInit -clang-vendor-feature=+disableNeonImmediateRangeCheck -clang-vendor-feature=+disableNonDependentMemberExprInCurrentInstantiation -fno-odr-hash-protocols -clang-vendor-feature=+revert09abecef7bbf -mllvm -disable-aligned-alloc-awareness=1 -mllvm -enable-dse-memoryssa=0 -o /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/cob13089_0.o -x c /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/cob13089_0.c
+clang -cc1 version 13.0.0 (clang-1300.0.29.30) default target x86_64-apple-darwin20.6.0
+ignoring nonexistent directory "/Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include"
+ignoring nonexistent directory "/Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Library/Frameworks"
+ignoring duplicate directory "/usr/local/include"
+ignoring duplicate directory "/usr/local/include"
+#include "..." search starts here:
+#include <...> search starts here:
+ /Users/runner/work/gnucobol/gnucobol/_build/..
+ /usr/local/opt/berkeley-db@4/include
+ /usr/local/Cellar/gmp/6.2.1_1/include
+ /usr/local/include
+ /Applications/Xcode_13.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0/include
+ /Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
+ /Applications/Xcode_13.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
+ /Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
+End of search list.
+return status:	0
+executing:	gcc -o "a.out"
+		"/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/cob13089_0.o"
+		-L/usr/local/opt/berkeley-db@4/lib -L/usr/local/opt/bison/lib
+		-L/usr/local/opt/help2man/lib -fstack-protector-strong
+		-L/usr/local/lib
+		"/Users/runner/work/gnucobol/gnucobol/_build/libcob/.libs/libcob.dylib"
+return status:	0
+executing:	./a.out
+dyld: Library not loaded: /usr/local/lib/libcob.4.dylib
+  Referenced from: /Users/runner/work/gnucobol/gnucobol/_build/tests/testsuite.dir/0023/./a.out
+  Reason: image not found
+cobc: external process "./a.out" ended with signal SIGABRT (6)

@GitMensch GitMensch closed this Jun 20, 2024
@GitMensch GitMensch deleted the patch-1 branch June 20, 2024 10:43
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