-
-
Notifications
You must be signed in to change notification settings - Fork 15.5k
chicken: fix cross-compilation #104775
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
chicken: fix cross-compilation #104775
Conversation
43f062d
to
8c38a02
Compare
This is why ifdef HOSTSYSTEM
C_COMPILER ?= $(HOSTSYSTEM)-gcc
CXX_COMPILER ?= $(HOSTSYSTEM)-g++
LIBRARIAN ?= $(HOSTSYSTEM)-ar # problematic line
else
C_COMPILER ?= gcc
CXX_COMPILER ?= g++
LIBRARIAN ?= ar
endif The cross-compiled gcc is named |
19b1c4b
to
53b0d43
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting this error when building (without parallelism) on non-nixos x86_64
x86_64-unknown-linux-gnu-gcc -shared -Wl,-soname,libchicken.so.11 \
-o libchicken.so library.o eval.o read-syntax.o repl.o data-structures.o pathname.o port.o file.o extras.o lolevel.o tcp.o srfi-4.o continuation.o posixunix.o internal.o irregex.o scheduler.o debugger-client.o profiler.o stub.o expand.o modules.o chicken-syntax.o chicken-ffi-syntax.o build-version.o runtime.o -lm -ldl
/nix/store/p3kn26g5nhmx6spn37ar3mn0xjbzks3g-binutils-2.31.1/bin/ld: cannot find crti.o: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [rules.make:190: libchicken.so] Error 1
Using the compiler on the target doesn't seem to work,
|
48c5a87
to
e818f1a
Compare
EDIT:
|
Relevant section of the docs on cross-compilation
|
@siraben ifneq TARGETSYSTEM HOSTSYSTEM
TOOL_PREFIX ?= TARGETSYSTEM
else
TOOL_PREFIX ?=
endif
C_COMPILER ?= $(TOOL_PREFIX)gcc
CXX_COMPILER ?= $(TOOL_PREFIX)g++
LIBRARIAN ?= $(TOOL_PREFIX)ar # problematic line But even that I suspect will not be enough, as the will need to distinguish between the tools used at runtime, and the tools used at build time, if, for example, they want to build libchicken in one go. How slow is this build? A related good thing we can do is always build |
e818f1a
to
f0c3eef
Compare
Hey @Mindavi, if you're free, could you also take a look at cross-compilation of CHICKEN as well? Let me know if you have any questions. |
I have implemented this in #245420 . I am going to proclaim, that everything here has been done and close this PR. |
Motivation for this change
nix -build -A pkgs.chicken
(build == host == target == x86_64-apple-darwin)nix-build --argstr system 'x86_64-linux' -A pkgs.chicken
(build == host == target)nix-build --argstr system 'x86_64-linux' -A pkgs.pkgsCross.remarkable1.chicken
(build != host == target)nix-build --argstr system 'x86_64-linux' -A pkgs.pkgsCross.remarkable1.buildPackages.chicken
(build == host != target)Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)