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

Need test binaries with shared libraries #2373

Closed
kevemueller opened this issue Dec 1, 2024 · 3 comments
Closed

Need test binaries with shared libraries #2373

kevemueller opened this issue Dec 1, 2024 · 3 comments

Comments

@kevemueller
Copy link

@bapt
Hi Baptiste,

please consider running under MacOS in an empty directory

all: clean macosfat.bin

LIPO?=lipo
TARGET_ARM=arm64-apple-macos10.13
TARGET_AMD=x86_64-apple-macos10.13

clean:
	rm -f answer.c main.c
	rm -f *dylib*
	rm -f bin-*
	rm -f *.bin

answer.c:
	echo 'int answer() { return 42;}' >$@

main.c:
	echo 'int answer(); int main(const int argc, const char *argv[]) { return answer(); }' >$@

libAnswer.A.dylib-aarch64: answer.c
	$(CC) -target $(TARGET_ARM) -dynamiclib -install_name /usr/local/lib/libAnswer.A.dylib $< -current_version 1.1 -compatibility_version 1.0 -o $@

libAnswer.A.dylib-amd64: answer.c
	$(CC) -target $(TARGET_AMD) -dynamiclib -install_name /usr/local/lib/libAnswer.A.dylib $< -current_version 1.2 -compatibility_version 1.0.1 -o $@

%.bin:
	$(LIPO) -create -output $@ $^

macosfatlib.bin: libAnswer.A.dylib-aarch64 libAnswer.A.dylib-amd64

bin-aarch64: main.c macosfatlib.bin
	$(CC) -target $(TARGET_ARM) $^ -o $@ 

bin-amd64: main.c macosfatlib.bin
	$(CC) -target $(TARGET_AMD) $^ -o $@  

macosfat.bin: bin-aarch64 bin-amd64

And replace macosfat.binin with the generated file and adding macosfatlib.binin with the generated library.

These (still trivial) binaries are needed to write unit tests against pkg_abi_macho with shlibs_required/shlibs_provides.
@ifreund
I suggest to have similar binaries for the other major platforms.

Cheers,
K

@bapt
Copy link
Member

bapt commented Dec 2, 2024

I can do that as I don't have any access to any macos @emaste would it be possible for you to do that and host it on freefall so I can fetch it?

@kevemueller
Copy link
Author

I have put the files temporarily into my draft PR, but I do prefer that they are built from within a trusted environment.
Btw. you have access to MacOS via GitHub. It would be trivial to build most of the binaries there. You could have a branch with the scripts and a GH action to build them. Both MacOS as well as Ubuntu runners can also cross-build to FreeBSD possibily also to DragonFly BSD.

@bapt
Copy link
Member

bapt commented Dec 3, 2024

added, we will see to cross build everything later

@bapt bapt closed this as completed Dec 3, 2024
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