I’m getting an error trying to install the ‘real’ package on MacOS (Connecting SWI-Prolog 8.1.1 to R).
The error is in configure:2937: error: C compiler cannot create executables
I’m running as sudo.
Any advice is appreciated.
The relevant part from config. is:
configure:2826: checking for C compiler version
configure:2835: swipl-ld --version >&5
clang: The build tool has reset ENV; --env=std required.
/usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang returned code 256
*** swipl-ld exit status 1
configure:2846: ? = 1
configure:2835: swipl-ld -v >&5
clang: The build tool has reset ENV; --env=std required.
/usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang returned code 256
*** swipl-ld exit status 1
configure:2846: ? = 1
configure:2835: swipl-ld -V >&5
clang: The build tool has reset ENV; --env=std required.
/usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang returned code 256
*** swipl-ld exit status 1
configure:2846: ? = 1
configure:2835: swipl-ld -qversion >&5
clang: The build tool has reset ENV; --env=std required.
/usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang returned code 256
*** swipl-ld exit status 1
configure:2846: ? = 1
configure:2866: checking whether the C compiler works
configure:2888: swipl-ld -fPIC -pthread -I"/usr/local/Cellar/swipl/8.1.1/lib/swipl/include" conftest.c >&5
clang: The build tool has reset ENV; --env=std required.
/usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang returned code 256
*** swipl-ld exit status 1
configure:2892: $? = 1
configure:2930: result: no
configure: failed program was:
| /* confdefs.h /
| #define PACKAGE_NAME “”
| #define PACKAGE_TARNAME “”
| #define PACKAGE_VERSION “”
| #define PACKAGE_STRING “”
| #define PACKAGE_BUGREPORT “”
| #define PACKAGE_URL “”
| / end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:2935: error: in `/usr/local/Cellar/swipl/8.1.1/lib/swipl/pack/real’:
configure:2937: error: C compiler cannot create executables
Seems Brew redefines the environment and/or clang. It is a little hard to debug without a Mac, but clang: The build tool has reset ENV; --env=std required gives a lot of hints.
The error installing the real package also seems to expose a bug in the handling of packs. After the failure above, I get:
$ swipl
Warning: Package real: no binary for architecture x86_64-darwin
Welcome to SWI-Prolog (threaded, 64 bits, version 8.1.1-18-g6b8c96f10)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.
For online help and background, visit http://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).
?- pack_remove(real).
ERROR: pack `real' does not exist
ERROR: In:
ERROR: [11] throw(error(existence_error(pack,real),_590))
ERROR: [10] '$pack':'$pack_detach'(real,_628) at /Users/pmoura/lib/swipl/boot/packs.pl:67
ERROR: [9] prolog_pack:pack_remove_forced(real) at /Users/pmoura/lib/swipl/library/prolog_pack.pl:1442
ERROR: [7] <user>
ERROR:
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
I.e. I get a warning at startup that a pack is not functional but then trying to remove it generates and error.
Thanks. Pushed 0521ad37993ac287017aeb85bf357fe4666e3ee3 to resolve this. Note that removing a package simply removes the directory. If it is an attached package it also removes the library directory, but as the directory doesn’t exist any longer that isn’t even necessary.