Re: building on macos

2022-05-29 Thread Jean-Christophe Helary



> On May 29, 2022, at 23:41, Mike  wrote:
> 
>>> show output:
>>> ===
>>> $ which opt
>>> $ which clang 
>>> $ which llvm-link
>>> ===
>>> 
>> 
>> ➜ src git:(master) ✗ which opt
>> /opt/local/bin/opt
>> ➜ src git:(master) ✗ which clang
>> /usr/bin/clang
>> ➜ src git:(master) ✗ which llvm-link 
>> /opt/local/bin/llvm-link
> 
> this is mess.
> all three must be from *the same* source, fix it and try again.

Thank you for the helpful comments and suggestions.


-- 
Jean-Christophe Helary @brandelune
https://mac4translators.blogspot.com
https://sr.ht/~brandelune/omegat-as-a-book/


--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: building on macos

2022-05-29 Thread Jean-Christophe Helary
Thank you.

It looks like it was a clang issue.

I'll check that later next week. And *will* come back here to report :-)

JC

> On May 29, 2022, at 23:23, Frithjof Schulze  wrote:
> 
> Hi all,
> 
> I never used Picolisp on a MacOS system, but tried the Makefile.macos today. 
> I needed to do a few changes, because my version of Homebrew uses other 
> patches, but then everything worked fine with the llvm, readline, libffi and 
> openssl versions from brew. 
> 
> % make clean
> % export PATH="/opt/homebrew/opt/llvm/bin:$PATH"
> % which clang
> /opt/homebrew/opt/llvm/bin/clang
> % which opt
> /opt/homebrew/opt/llvm/bin/opt
> % make -f Makefile.macos
> % ./bin/picolisp 
> : (bye)
> % 
> 
> w
> 
> --- Makefile.macos2022-05-29 15:47:48.0 +0200
> +++ Makefile.macos.orig   2022-05-29 16:14:59.0 +0200
> @@ -7,7 +7,7 @@
>  ASM = opt -O3  # llvm-as
>  LLC = llc
>  LINK = llvm-link
> -MAIN = -lm -ldl -lreadline -lffi -lncurses -L/opt/homebrew/opt/readline/lib
> +MAIN = -lm -ldl -lreadline -lffi -lncurses -L/usr/local/opt/readline/lib
>  SHARED =
>  STRIP = strip
>  
> @@ -44,7 +44,7 @@
>   mv base.map $(LIB)/map
>  
>  lib.bc: pico.h lib.c
> - $(CC) -O3 -w -c -o lib.bc -D_OS='"$(OS)"' -D_CPU='"$(CPU)"' 
> -I/opt/homebrew/opt/libffi/include -I/opt/homebrew/opt/readline/include 
> -emit-llvm lib.c
> + $(CC) -O3 -w -c -o lib.bc -D_OS='"$(OS)"' -D_CPU='"$(CPU)"' 
> -I/usr/local/opt/libffi/include -I/usr/local/opt/readline/include -emit-llvm 
> lib.c
>  
>  # Extension libraries
>  $(LIB)/ext.so: ext.bc
> @@ -76,11 +76,11 @@
>  
>  # Gate
>  $(BIN)/ssl: ssl.c
> - $(CC) -O3 -w -o $(BIN)/ssl ssl.c -lssl -lcrypto 
> -L/opt/homebrew/opt/openssl/lib -I/opt/homebrew/opt/openssl/include
> + $(CC) -O3 -w -o $(BIN)/ssl ssl.c -lssl -lcrypto 
> -L/usr/local/opt/openssl/lib -I/usr/local/opt/openssl/include
>   $(STRIP) $(BIN)/ssl
>  
>  $(BIN)/httpGate: httpGate.c
> - $(CC) -O3 -w -o $(BIN)/httpGate httpGate.c -lssl -lcrypto 
> -L/opt/homebrew/opt/openssl/lib -I/opt/homebrew/opt/openssl/include
> + $(CC) -O3 -w -o $(BIN)/httpGate httpGate.c -lssl -lcrypto 
> -L/usr/local/opt/openssl/lib -I/usr/local/opt/openssl/include
>   $(STRIP) $(BIN)/httpGate
>  
>  # Clean up
>  
> Cheers,
> Frithjof
> 
>> Am 29.05.2022 um 15:28 schrieb Jean-Christophe Helary 
>> :
>> 
>> 
>> 
>>> On May 29, 2022, at 22:12, Mike  wrote:
>>> 
 ➜ pil21+ git:(master) ✗ cd src
 ➜ src git:(master) ✗ rm *.bc
 ➜ src git:(master) ✗ make
 opt -O3 -o base.bc base.ll
 clang -O3 -w -c -o lib.bc -D_OS='"Darwin"' -D_CPU='"x86_64"' `pkg-config 
 --cflags libffi` -emit-llvm lib.c
 llvm-link -o picolisp.bc base.bc lib.bc
 /opt/local/libexec/llvm-10/bin/llvm-link: lib.bc: error: Unknown attribute 
 kind (68) (Producer: 'APPLE_1_1300.0.29.30_0' Reader: 'LLVM 10.0.1')
 /opt/local/libexec/llvm-10/bin/llvm-link: error: loading file 'lib.bc'
 make: *** [picolisp.bc] Error 1
>>> 
>>> show output:
>>> ===
>>> $ which opt
>>> $ which clang 
>>> $ which llvm-link
>>> ===
>> 
>> 
>> ➜ src git:(master) ✗ which opt
>> /opt/local/bin/opt
>> ➜ src git:(master) ✗ which clang
>> /usr/bin/clang
>> ➜ src git:(master) ✗ which llvm-link 
>> /opt/local/bin/llvm-link
>> 
>> It looks like clang is not the one we might want ?
>> 
>> ➜ src git:(master) ✗ clang --version
>> Apple clang version 13.0.0 (clang-1300.0.29.30)
>> Target: x86_64-apple-darwin20.6.0
>> Thread model: posix
>> InstalledDir: /Library/Developer/CommandLineTools/usr/bin
>> 
>> -- 
>> Jean-Christophe Helary @brandelune
>> https://mac4translators.blogspot.com
>> https://sr.ht/~brandelune/omegat-as-a-book/
>> 
>> 
>> --
>> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
> 

-- 
Jean-Christophe Helary @brandelune
https://mac4translators.blogspot.com
https://sr.ht/~brandelune/omegat-as-a-book/


--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: building on macos

2022-05-29 Thread Frithjof Schulze
Hi all,

I never used Picolisp on a MacOS system, but tried the Makefile.macos today. I 
needed to do a few changes, because my version of Homebrew uses other patches, 
but then everything worked fine with the llvm, readline, libffi and openssl 
versions from brew. 

% make clean
% export PATH="/opt/homebrew/opt/llvm/bin:$PATH"
% which clang
/opt/homebrew/opt/llvm/bin/clang
% which opt
/opt/homebrew/opt/llvm/bin/opt
% make -f Makefile.macos
% ../bin/picolisp 
: (bye)
% 

w

--- Makefile.macos  2022-05-29 15:47:48.0 +0200
+++ Makefile.macos.orig 2022-05-29 16:14:59.0 +0200
@@ -7,7 +7,7 @@
 ASM = opt -O3  # llvm-as
 LLC = llc
 LINK = llvm-link
-MAIN = -lm -ldl -lreadline -lffi -lncurses -L/opt/homebrew/opt/readline/lib
+MAIN = -lm -ldl -lreadline -lffi -lncurses -L/usr/local/opt/readline/lib
 SHARED =
 STRIP = strip
 
@@ -44,7 +44,7 @@
mv base.map $(LIB)/map
 
 lib.bc: pico.h lib.c
-   $(CC) -O3 -w -c -o lib.bc -D_OS='"$(OS)"' -D_CPU='"$(CPU)"' 
-I/opt/homebrew/opt/libffi/include -I/opt/homebrew/opt/readline/include 
-emit-llvm lib.c
+   $(CC) -O3 -w -c -o lib.bc -D_OS='"$(OS)"' -D_CPU='"$(CPU)"' 
-I/usr/local/opt/libffi/include -I/usr/local/opt/readline/include -emit-llvm 
lib.c
 
 # Extension libraries
 $(LIB)/ext.so: ext.bc
@@ -76,11 +76,11 @@
 
 # Gate
 $(BIN)/ssl: ssl.c
-   $(CC) -O3 -w -o $(BIN)/ssl ssl.c -lssl -lcrypto 
-L/opt/homebrew/opt/openssl/lib -I/opt/homebrew/opt/openssl/include
+   $(CC) -O3 -w -o $(BIN)/ssl ssl.c -lssl -lcrypto 
-L/usr/local/opt/openssl/lib -I/usr/local/opt/openssl/include
$(STRIP) $(BIN)/ssl
 
 $(BIN)/httpGate: httpGate.c
-   $(CC) -O3 -w -o $(BIN)/httpGate httpGate.c -lssl -lcrypto 
-L/opt/homebrew/opt/openssl/lib -I/opt/homebrew/opt/openssl/include
+   $(CC) -O3 -w -o $(BIN)/httpGate httpGate.c -lssl -lcrypto 
-L/usr/local/opt/openssl/lib -I/usr/local/opt/openssl/include
$(STRIP) $(BIN)/httpGate
 
 # Clean up
 
Cheers,
Frithjof

> Am 29.05.2022 um 15:28 schrieb Jean-Christophe Helary 
> :
> 
> 
> 
>> On May 29, 2022, at 22:12, Mike  wrote:
>> 
>>> ➜ pil21+ git:(master) ✗ cd src
>>> ➜ src git:(master) ✗ rm *.bc
>>> ➜ src git:(master) ✗ make
>>> opt -O3 -o base.bc base.ll
>>> clang -O3 -w -c -o lib.bc -D_OS='"Darwin"' -D_CPU='"x86_64"' `pkg-config 
>>> --cflags libffi` -emit-llvm lib.c
>>> llvm-link -o picolisp.bc base.bc lib.bc
>>> /opt/local/libexec/llvm-10/bin/llvm-link: lib.bc: error: Unknown attribute 
>>> kind (68) (Producer: 'APPLE_1_1300.0.29.30_0' Reader: 'LLVM 10.0.1')
>>> /opt/local/libexec/llvm-10/bin/llvm-link: error: loading file 'lib.bc'
>>> make: *** [picolisp.bc] Error 1
>> 
>> show output:
>> ===
>> $ which opt
>> $ which clang 
>> $ which llvm-link
>> ===
> 
> 
> ➜ src git:(master) ✗ which opt
> /opt/local/bin/opt
> ➜ src git:(master) ✗ which clang
> /usr/bin/clang
> ➜ src git:(master) ✗ which llvm-link 
> /opt/local/bin/llvm-link
> 
> It looks like clang is not the one we might want ?
> 
> ➜ src git:(master) ✗ clang --version
> Apple clang version 13.0.0 (clang-1300.0.29.30)
> Target: x86_64-apple-darwin20.6.0
> Thread model: posix
> InstalledDir: /Library/Developer/CommandLineTools/usr/bin
> 
> -- 
> Jean-Christophe Helary @brandelune
> https://mac4translators.blogspot.com 
> https://sr.ht/~brandelune/omegat-as-a-book/ 
> 
> 
> 
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe 
> 


Re: building on macos

2022-05-29 Thread Jean-Christophe Helary



> On May 29, 2022, at 22:12, Mike  wrote:
> 
>> ➜ pil21+ git:(master) ✗ cd src
>> ➜ src git:(master) ✗ rm *.bc
>> ➜ src git:(master) ✗ make
>> opt -O3 -o base.bc base.ll
>> clang -O3 -w -c -o lib.bc -D_OS='"Darwin"' -D_CPU='"x86_64"' `pkg-config 
>> --cflags libffi` -emit-llvm lib.c
>> llvm-link -o picolisp.bc base.bc lib.bc
>> /opt/local/libexec/llvm-10/bin/llvm-link: lib.bc: error: Unknown attribute 
>> kind (68) (Producer: 'APPLE_1_1300.0.29.30_0' Reader: 'LLVM 10.0.1')
>> /opt/local/libexec/llvm-10/bin/llvm-link: error: loading file 'lib.bc'
>> make: *** [picolisp.bc] Error 1
> 
> show output:
> ===
> $ which opt
> $ which clang 
> $ which llvm-link
> ===


➜  src git:(master) ✗ which opt
/opt/local/bin/opt
➜  src git:(master) ✗ which clang
/usr/bin/clang
➜  src git:(master) ✗ which llvm-link 
/opt/local/bin/llvm-link

It looks like clang is not the one we might want ?

➜  src git:(master) ✗ clang --version
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

-- 
Jean-Christophe Helary @brandelune
https://mac4translators.blogspot.com
https://sr.ht/~brandelune/omegat-as-a-book/


--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: building on macos

2022-05-29 Thread Jean-Christophe Helary



> On May 29, 2022, at 21:16, Mike  wrote:
> 
>> 
>> Ok. I have readline installed both with brew and port:
> 
> why you have both brew and port? You mess it.

Because some utilities are only available in port and some in brew but they 
have common dependencies so the dependencies come installed like this.

I tried your MakeFile with only brew, and then with only macport, and both 
ended up with the same error message.

Plus, I already had that mixed setup when I first build pil21 so I'm not sure 
it's relevant here.

>> ➜ pil21+ git:(master) ✗ cd src
>> ➜ src git:(master) ✗ rm *.bc
>> ➜ src git:(master) ✗ make
>> /opt/local/libexec/llvm-10/bin/llvm-link: lib.bc: error: Unknown attribute 
>> kind (68) (Producer: 'APPLE_1_1300.0.29.30_0' Reader: 'LLVM 10.0.1')
>> /opt/local/libexec/llvm-10/bin/llvm-link: error: loading file 'lib.bc'
>> make: *** [picolisp.bc] Error 1
>> 
> 
> remove .SILENT keyword and show full output, you still mess builtin and LLVM 
> from brew-port.

➜  pil21+ git:(master) ✗ cd src
➜  src git:(master) ✗ rm *.bc
➜  src git:(master) ✗ make
opt -O3   -o base.bc base.ll
clang -O3 -w -c -o lib.bc -D_OS='"Darwin"' -D_CPU='"x86_64"' `pkg-config 
--cflags libffi` -emit-llvm lib.c
llvm-link -o picolisp.bc base.bc lib.bc
/opt/local/libexec/llvm-10/bin/llvm-link: lib.bc: error: Unknown attribute kind 
(68) (Producer: 'APPLE_1_1300.0.29.30_0' Reader: 'LLVM 10.0.1')
/opt/local/libexec/llvm-10/bin/llvm-link: error:  loading file 'lib.bc'
make: *** [picolisp.bc] Error 1


-- 
Jean-Christophe Helary @brandelune
https://mac4translators.blogspot.com
https://sr.ht/~brandelune/omegat-as-a-book/


--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: building on macos

2022-05-29 Thread Jean-Christophe Helary



> On May 29, 2022, at 18:52, Mike  wrote:
> 
>> 
>> I've installed readline from macport as you suggested and I'm using your 
>> Makefile.
>> 
>> Also I'm not finding any path to brew installs in your Makefile. There is no 
>> reference to /usr/local anywhere.
>> 
>> Which line in the Makefile would that be ?
> 
> /usr/local/opt is symlink to /usr/local/Cellar 
> 
> ===
> $ brew list readline
> /usr/local/Cellar/readline/8.1.2/include/readline/ (8 files)
> /usr/local/Cellar/readline/8.1.2/lib/libhistory.8.1.dylib
> /usr/local/Cellar/readline/8.1.2/lib/libreadline.8.1.dylib
> /usr/local/Cellar/readline/8.1.2/lib/pkgconfig/readline.pc
> /usr/local/Cellar/readline/8.1.2/lib/ (6 other files)
> /usr/local/Cellar/readline/8.1.2/share/doc/ (3 files)
> /usr/local/Cellar/readline/8.1.2/share/info/ (3 files)
> /usr/local/Cellar/readline/8.1.2/share/man/ (2 files)
> /usr/local/Cellar/readline/8.1.2/share/readline/ (16 files)
> $
> $ cat ~/pil21/src/Makefile | grep readline
> MAIN = -lm -ldl -lreadline -lffi -lncurses -L/usr/local/opt/readline/lib
>   $(CC) -O3 -w -c -o lib.bc -D_OS='"$(OS)"' -D_CPU='"$(CPU)"' 
> -I/usr/local/opt/libffi/include -I/usr/local/opt/readline/include -emit-llvm 
> lib.c
> $ 
> ===

Ok. I have readline installed both with brew and port:

➜  pil21+ git:(master) ✗ brew list readline
/usr/local/Cellar/readline/8.1.2/include/readline/ (8 files)
/usr/local/Cellar/readline/8.1.2/lib/libhistory.8.1.dylib
/usr/local/Cellar/readline/8.1.2/lib/libreadline.8.1.dylib
/usr/local/Cellar/readline/8.1.2/lib/pkgconfig/readline.pc
/usr/local/Cellar/readline/8.1.2/lib/ (6 other files)
/usr/local/Cellar/readline/8.1.2/share/doc/ (3 files)
/usr/local/Cellar/readline/8.1.2/share/info/ (3 files)
/usr/local/Cellar/readline/8.1.2/share/man/ (2 files)
/usr/local/Cellar/readline/8.1.2/share/readline/ (16 files)
➜  pil21+ git:(master) ✗ port installed readline
The following ports are currently installed:
  readline @8.1.2.000_0 (active)
➜  pil21+ git:(master) ✗ 

And now, I have 

➜  pil21+ git:(master) ✗ (cd src; make)
/opt/local/libexec/llvm-10/bin/llvm-link: lib.bc: error: Unknown attribute kind 
(68) (Producer: 'APPLE_1_1300.0.29.30_0' Reader: 'LLVM 10.0.1')
/opt/local/libexec/llvm-10/bin/llvm-link: error:  loading file 'lib.bc'
make: *** [picolisp.bc] Error 1


Which brings me back to last night's mail where you replied:

===
$ cd pil21/src
$ rm *.bc
$ make
===

And when I do that, I get the same results:

➜  pil21+ git:(master) ✗ cd src
➜  src git:(master) ✗ rm *.bc
➜  src git:(master) ✗ make
/opt/local/libexec/llvm-10/bin/llvm-link: lib.bc: error: Unknown attribute kind 
(68) (Producer: 'APPLE_1_1300.0.29.30_0' Reader: 'LLVM 10.0.1')
/opt/local/libexec/llvm-10/bin/llvm-link: error:  loading file 'lib.bc'
make: *** [picolisp.bc] Error 1

btw:
➜  src git:(master) ✗ pwd
/Users/suzume/Documents/Repositories/pil21+/src


-- 
Jean-Christophe Helary @brandelune
https://mac4translators.blogspot.com
https://sr.ht/~brandelune/omegat-as-a-book/


--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: building on macos

2022-05-29 Thread Jean-Christophe Helary



> On May 29, 2022, at 15:16, Mike  wrote:
> 
 lib.c:119:4: error: use of undeclared identifier 'rl_catch_signals'
 rl_catch_signals = 0;
 ^
 lib.c:121:4: error: use of undeclared identifier 'rl_input_available_hook'
 rl_input_available_hook = rlAvail;
 ^
 ...
 
>>> 
>>> They are all from the readline library.
>>> 
>> 
>> Would there be a version issue ?
> 
> I already wrote about this issue before.
> It happened when you link against macos *builtin* readline library which is 
> too old.
> If you check my Makefile you would find paths to readline from brew.

I've installed readline from macport as you suggested and I'm using your 
Makefile.

Also I'm not finding any path to brew installs in your Makefile. There is no 
reference to /usr/local anywhere.

Which line in the Makefile would that be ?

-- 
Jean-Christophe Helary @brandelune
https://mac4translators.blogspot.com
https://sr.ht/~brandelune/omegat-as-a-book/


--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe