Re: [EXTERNAL]Building GNU APL with clang

2023-10-03 Thread Elias Mårtenson
I'm pretty sure tge use of auto_ptr can be changed to unique_ptr here. I
think I used auto_ptr because I wanted it to work on versions of C++ which
didn't support unique_ptr.

Den tis 3 okt. 2023 20:17Dr. Jürgen Sauermann 
skrev:

> Hi,
>
> thank you all for discussing this.
>
> To address at least some of the issues i have:
>
> 1, removed typeof() entirely, and
> 2. replaced  *std::auto_ptr<>* with *std::unique_ptr<>*
>   as proposed on the internet.
>
> I am not entirely sure about 2. though. It was only used twice
> in  emacs_mode and once in apl-sqlite.cc. Unfortunately I am
> lacking any emacs experience and can therefore not easily
> test the changes. Maybe Elias wants to have a look at  it
> (IMHO some uses of *auto_ptr* can be avoided entirely).
>
> If my changes should break anything then please let me know.
>
> *SVN 1736*.
>
> Best Regards,
> Jürgen
>
>
>
>
> On 10/3/23 04:42, Russtopia wrote:
>
> Aha! I got it to build. In Termux, which currently uses clang-16:
>
> After running ./configure,
> 1. Add -std=gnu++11, rather than c++11, to src/Makefile and
> src/emacs_mode/Makefile CXXFLAGS;
> 2. Add #include  to src/Thread_context.cc and change the call
> near line 49 from pthread_cancel(thread) to pthread_kill(thread, 0)
>
> In regards to pthread_cancel() ...
>
> I hope the following is not true: Termux (or Android beneath it) uses
> 'bionic libc' that does not implement pthread_cancel according to
>
> https://github.com/termux/termux-app/discussions/2639
>
> Some discussion about emulating it or replacing with pthread_kill(thread,
> 0) here: https://github.com/axel-download-accelerator/axel/issues/150
>
> I don't know who or what to test to see what deleterious effects, if any,
> using pthread_kill() instead of pthread_cancel() will have on operation.
> However, the main prompt comes up and I can run basic APL expressions.
>
> -Russ
>
>
> On Mon, Oct 2, 2023 at 6:44 PM Callahan, Brian Robert 
> wrote:
>
>> Hi Russ –
>>
>>
>>
>> On OpenBSD, clang has been the default compiler for many years. I
>> routinely build APL trunk on OpenBSD, and never had any problems so long as
>> I add -std=gnu++11 to CXXFLAGS. I just rebuilt APL from a clean SVN
>> checkout and it built without issues.
>>
>>
>>
>> I am using clang-16.0.6. Not sure what version Termux uses these days.
>>
>>
>>
>> ~Brian
>>
>>
>>
>> --
>>
>> Brian Robert Callahan, Ph.D., CISSP, CCSP, SSCP, CC
>>
>> Graduate Program Director, ITWS@RPI
>>
>> Director, Rensselaer Cybersecurity Collaboratory
>>
>> Office: Lally 304
>>
>>
>>
>> *From:* bug-apl-bounces+callab5=rpi@gnu.org > rpi@gnu.org> *On Behalf Of *Russtopia
>> *Sent:* Monday, October 2, 2023 8:08 PM
>> *To:* bug-apl@gnu.org
>> *Subject:* [EXTERNAL]Building GNU APL with clang
>>
>>
>>
>> *CAUTION:* This email originated from outside of the organization. Do
>> not click links or open attachments unless you recognize the sender and
>> know the content is safe.
>>
>> Hello, See topic.
>>
>>
>>
>> I would rather not, but in this case I am trying to re-build GNU APL in
>> Termux on my newer Android phone, and Termux decided some time ago to
>> remove gcc entirely from its packages, in preference to clang. :(
>>
>>
>>
>> I am not up to date at all on modern C++, but this conversation on
>> Stackoverflow suggests that auto_ptr is considered deprecated in newer C++
>> standards:
>> https://stackoverflow.com/questions/69116001/how-do-i-re-enable-c17-removed-features-in-clang
>>
>>
>> libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../..
>> -Wno-deprecated-declarations -g -O2 -I
>> /data/data/com.termux/files/home/gnuapl/trunk -c Listener.cc -o Listener.o
>> >/dev/null 2>&1
>> network.cc:37:10: error: no member named 'auto_ptr' in namespace 'std'
>> std::auto_ptr connection( (NetworkConnection *)arg );
>> ~^
>> network.cc:37:19: error: 'NetworkConnection' does not refer to a value
>> std::auto_ptr connection( (NetworkConnection *)arg );
>> ^
>>
>>
>>
>> Adding -std=c++11 to src/emacs-mode/Makefile CXXFLAGS got me past the
>> auto_ptr issues, but then I hit issues with 'typeof()' in LineInput.cc:
>>
>>
>> g++ -DHAVE_CONFIG_H -I. -I.. -Wall -I sql -I
>> /data/data/com.termux/files/home/gnuapl/trunk -std=c++11 -g -O2 -I
>> /data/data/com.termux/files/home/gnuapl/trunk -MT apl-Missing_Libraries.o
>> -MD -MP -MF .deps/apl-Missing_Libraries.Tpo -c -o apl-Missing_Libraries.o
>> `test -f 'Missing_Libraries.cc' || echo './'`Missing_Libraries.cc
>> LApack.cc:1784:37: error: unknown type name 'typeof'; did you mean
>> 'typedef'? tau = reinterpret_cast (work);
>> ^~
>> typedef
>> LApack.cc:1784:43: error: expected a type tau =
>> reinterpret_cast (work);
>> ^
>> LApack.cc:1784:37: error: type name does not allow storage class to be
>> specified
>> tau = reinterpret_cast (work);
>> ^
>>
>> Has anyone managed to build and successfully run GNU APL with clang?
>>
>> -Russ
>>
>>
>>
>
>


Re: [EXTERNAL]Building GNU APL with clang

2023-10-03 Thread Dr . Jürgen Sauermann

Hi,

thank you all for discussing this.

To address at least some of the issues i have:

1, removed typeof() entirely, and
2. replaced *std::auto_ptr<>* with *std::unique_ptr<>*
  as proposed on the internet.

I am not entirely sure about 2. though. It was only used twice
in  emacs_mode and once in apl-sqlite.cc. Unfortunately I am
lacking any emacs experience and can therefore not easily
test the changes. Maybe Elias wants to have a look at  it
(IMHO some uses of *auto_ptr* can be avoided entirely).

If my changes should break anything then please let me know.

*SVN 1736*.

Best Regards,
Jürgen




On 10/3/23 04:42, Russtopia wrote:

Aha! I got it to build. In Termux, which currently uses clang-16:

After running ./configure,
1. Add -std=gnu++11, rather than c++11, to src/Makefile and 
src/emacs_mode/Makefile CXXFLAGS;
2. Add #include  to src/Thread_context.cc and change the 
call near line 49 from pthread_cancel(thread) to pthread_kill(thread, 0)


In regards to pthread_cancel() ...

I hope the following is not true: Termux (or Android beneath it) uses 
'bionic libc' that does not implement pthread_cancel according to


https://github.com/termux/termux-app/discussions/2639

Some discussion about emulating it or replacing with 
pthread_kill(thread, 0) here: 
https://github.com/axel-download-accelerator/axel/issues/150


I don't know who or what to test to see what deleterious effects, if 
any, using pthread_kill() instead of pthread_cancel() will have on 
operation. However, the main prompt comes up and I can run basic APL 
expressions.


-Russ


On Mon, Oct 2, 2023 at 6:44 PM Callahan, Brian Robert 
 wrote:


Hi Russ –

On OpenBSD, clang has been the default compiler for many years. I
routinely build APL trunk on OpenBSD, and never had any problems
so long as I add -std=gnu++11 to CXXFLAGS. I just rebuilt APL from
a clean SVN checkout and it built without issues.

I am using clang-16.0.6. Not sure what version Termux uses these days.

~Brian

--

Brian Robert Callahan, Ph.D., CISSP, CCSP, SSCP, CC

Graduate Program Director, ITWS@RPI

Director, Rensselaer Cybersecurity Collaboratory

Office: Lally 304

*From:* bug-apl-bounces+callab5=rpi@gnu.org
 *On Behalf Of *Russtopia
*Sent:* Monday, October 2, 2023 8:08 PM
*To:* bug-apl@gnu.org
*Subject:* [EXTERNAL]Building GNU APL with clang

*CAUTION:*This email originated from outside of the organization.
Do not click links or open attachments unless you recognize the
sender and know the content is safe.

Hello, See topic.

I would rather not, but in this case I am trying to re-build GNU
APL in Termux on my newer Android phone, and Termux decided some
time ago to remove gcc entirely from its packages, in
preference to clang. :(

I am not up to date at all on modern C++, but this conversation on
Stackoverflow suggests that auto_ptr is considered deprecated in
newer C++ standards:

https://stackoverflow.com/questions/69116001/how-do-i-re-enable-c17-removed-features-in-clang


libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../..
-Wno-deprecated-declarations -g -O2 -I
/data/data/com.termux/files/home/gnuapl/trunk -c Listener.cc -o
Listener.o >/dev/null 2>&1
network.cc:37:10: error: no member named 'auto_ptr' in namespace 'std'
std::auto_ptr connection( (NetworkConnection
*)arg );
~^
network.cc:37:19: error: 'NetworkConnection' does not refer to a value
std::auto_ptr connection( (NetworkConnection
*)arg );
^

Adding -std=c++11 to src/emacs-mode/Makefile CXXFLAGS got me past
the auto_ptr issues, but then I hit issues with 'typeof()' in
LineInput.cc:


g++ -DHAVE_CONFIG_H -I. -I.. -Wall -I sql -I
/data/data/com.termux/files/home/gnuapl/trunk -std=c++11 -g -O2 -I
/data/data/com.termux/files/home/gnuapl/trunk -MT
apl-Missing_Libraries.o -MD -MP -MF
.deps/apl-Missing_Libraries.Tpo -c -o apl-Missing_Libraries.o
`test -f 'Missing_Libraries.cc' || echo './'`Missing_Libraries.cc
LApack.cc:1784:37: error: unknown type name 'typeof'; did you mean
'typedef'? tau = reinterpret_cast (work);
^~
typedef
LApack.cc:1784:43: error: expected a type tau =
reinterpret_cast (work);
^
LApack.cc:1784:37: error: type name does not allow storage class
to be specified
tau = reinterpret_cast (work);
^

Has anyone managed to build and successfully run GNU APL with clang?

-Russ



Re: [EXTERNAL]Building GNU APL with clang

2023-10-02 Thread Russtopia
Aha! I got it to build. In Termux, which currently uses clang-16:

After running ./configure,
1. Add -std=gnu++11, rather than c++11, to src/Makefile and
src/emacs_mode/Makefile CXXFLAGS;
2. Add #include  to src/Thread_context.cc and change the call
near line 49 from pthread_cancel(thread) to pthread_kill(thread, 0)

In regards to pthread_cancel() ...

I hope the following is not true: Termux (or Android beneath it) uses
'bionic libc' that does not implement pthread_cancel according to

https://github.com/termux/termux-app/discussions/2639

Some discussion about emulating it or replacing with pthread_kill(thread,
0) here: https://github.com/axel-download-accelerator/axel/issues/150

I don't know who or what to test to see what deleterious effects, if any,
using pthread_kill() instead of pthread_cancel() will have on operation.
However, the main prompt comes up and I can run basic APL expressions.

-Russ


On Mon, Oct 2, 2023 at 6:44 PM Callahan, Brian Robert 
wrote:

> Hi Russ –
>
>
>
> On OpenBSD, clang has been the default compiler for many years. I
> routinely build APL trunk on OpenBSD, and never had any problems so long as
> I add -std=gnu++11 to CXXFLAGS. I just rebuilt APL from a clean SVN
> checkout and it built without issues.
>
>
>
> I am using clang-16.0.6. Not sure what version Termux uses these days.
>
>
>
> ~Brian
>
>
>
> --
>
> Brian Robert Callahan, Ph.D., CISSP, CCSP, SSCP, CC
>
> Graduate Program Director, ITWS@RPI
>
> Director, Rensselaer Cybersecurity Collaboratory
>
> Office: Lally 304
>
>
>
> *From:* bug-apl-bounces+callab5=rpi@gnu.org  rpi@gnu.org> *On Behalf Of *Russtopia
> *Sent:* Monday, October 2, 2023 8:08 PM
> *To:* bug-apl@gnu.org
> *Subject:* [EXTERNAL]Building GNU APL with clang
>
>
>
> *CAUTION:* This email originated from outside of the organization. Do not
> click links or open attachments unless you recognize the sender and know
> the content is safe.
>
> Hello, See topic.
>
>
>
> I would rather not, but in this case I am trying to re-build GNU APL in
> Termux on my newer Android phone, and Termux decided some time ago to
> remove gcc entirely from its packages, in preference to clang. :(
>
>
>
> I am not up to date at all on modern C++, but this conversation on
> Stackoverflow suggests that auto_ptr is considered deprecated in newer C++
> standards:
> https://stackoverflow.com/questions/69116001/how-do-i-re-enable-c17-removed-features-in-clang
>
>
> libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../..
> -Wno-deprecated-declarations -g -O2 -I
> /data/data/com.termux/files/home/gnuapl/trunk -c Listener.cc -o Listener.o
> >/dev/null 2>&1
> network.cc:37:10: error: no member named 'auto_ptr' in namespace 'std'
> std::auto_ptr connection( (NetworkConnection *)arg );
> ~^
> network.cc:37:19: error: 'NetworkConnection' does not refer to a value
> std::auto_ptr connection( (NetworkConnection *)arg );
> ^
>
>
>
> Adding -std=c++11 to src/emacs-mode/Makefile CXXFLAGS got me past the
> auto_ptr issues, but then I hit issues with 'typeof()' in LineInput.cc:
>
>
> g++ -DHAVE_CONFIG_H -I. -I.. -Wall -I sql -I
> /data/data/com.termux/files/home/gnuapl/trunk -std=c++11 -g -O2 -I
> /data/data/com.termux/files/home/gnuapl/trunk -MT apl-Missing_Libraries.o
> -MD -MP -MF .deps/apl-Missing_Libraries.Tpo -c -o apl-Missing_Libraries.o
> `test -f 'Missing_Libraries.cc' || echo './'`Missing_Libraries.cc
> LApack.cc:1784:37: error: unknown type name 'typeof'; did you mean
> 'typedef'? tau = reinterpret_cast (work);
> ^~
> typedef
> LApack.cc:1784:43: error: expected a type tau =
> reinterpret_cast (work);
> ^
> LApack.cc:1784:37: error: type name does not allow storage class to be
> specified
> tau = reinterpret_cast (work);
> ^
>
> Has anyone managed to build and successfully run GNU APL with clang?
>
> -Russ
>
>
>


Re: [EXTERNAL]Building GNU APL with clang

2023-10-02 Thread Russtopia
Hi, thank you all for the rapid replies.

Shortly after posting, I figured out how to set clang-11 as my default cc
and c++ on my Devuan x86_64 laptop, and it builds perfectly there.

So strange; I wonder what is different about the Termux clang environment.
(It is a native ARM aarch64 Linux env, hosted within Android, using its own
package repositories).

I wish they had just stuck with gcc, it was building fine on my older phone
:(.

(I know there's an Android build mode outside of Termux, but I was trying
to go with what I knew worked. Oh well.)


On Mon, Oct 2, 2023 at 6:44 PM Callahan, Brian Robert 
wrote:

> Hi Russ –
>
>
>
> On OpenBSD, clang has been the default compiler for many years. I
> routinely build APL trunk on OpenBSD, and never had any problems so long as
> I add -std=gnu++11 to CXXFLAGS. I just rebuilt APL from a clean SVN
> checkout and it built without issues.
>
>
>
> I am using clang-16.0.6. Not sure what version Termux uses these days.
>
>
>
> ~Brian
>
>
>
> --
>
> Brian Robert Callahan, Ph.D., CISSP, CCSP, SSCP, CC
>
> Graduate Program Director, ITWS@RPI
>
> Director, Rensselaer Cybersecurity Collaboratory
>
> Office: Lally 304
>
>
>
> *From:* bug-apl-bounces+callab5=rpi@gnu.org  rpi@gnu.org> *On Behalf Of *Russtopia
> *Sent:* Monday, October 2, 2023 8:08 PM
> *To:* bug-apl@gnu.org
> *Subject:* [EXTERNAL]Building GNU APL with clang
>
>
>
> *CAUTION:* This email originated from outside of the organization. Do not
> click links or open attachments unless you recognize the sender and know
> the content is safe.
>
> Hello, See topic.
>
>
>
> I would rather not, but in this case I am trying to re-build GNU APL in
> Termux on my newer Android phone, and Termux decided some time ago to
> remove gcc entirely from its packages, in preference to clang. :(
>
>
>
> I am not up to date at all on modern C++, but this conversation on
> Stackoverflow suggests that auto_ptr is considered deprecated in newer C++
> standards:
> https://stackoverflow.com/questions/69116001/how-do-i-re-enable-c17-removed-features-in-clang
>
>
> libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../..
> -Wno-deprecated-declarations -g -O2 -I
> /data/data/com.termux/files/home/gnuapl/trunk -c Listener.cc -o Listener.o
> >/dev/null 2>&1
> network.cc:37:10: error: no member named 'auto_ptr' in namespace 'std'
> std::auto_ptr connection( (NetworkConnection *)arg );
> ~^
> network.cc:37:19: error: 'NetworkConnection' does not refer to a value
> std::auto_ptr connection( (NetworkConnection *)arg );
> ^
>
>
>
> Adding -std=c++11 to src/emacs-mode/Makefile CXXFLAGS got me past the
> auto_ptr issues, but then I hit issues with 'typeof()' in LineInput.cc:
>
>
> g++ -DHAVE_CONFIG_H -I. -I.. -Wall -I sql -I
> /data/data/com.termux/files/home/gnuapl/trunk -std=c++11 -g -O2 -I
> /data/data/com.termux/files/home/gnuapl/trunk -MT apl-Missing_Libraries.o
> -MD -MP -MF .deps/apl-Missing_Libraries.Tpo -c -o apl-Missing_Libraries.o
> `test -f 'Missing_Libraries.cc' || echo './'`Missing_Libraries.cc
> LApack.cc:1784:37: error: unknown type name 'typeof'; did you mean
> 'typedef'? tau = reinterpret_cast (work);
> ^~
> typedef
> LApack.cc:1784:43: error: expected a type tau =
> reinterpret_cast (work);
> ^
> LApack.cc:1784:37: error: type name does not allow storage class to be
> specified
> tau = reinterpret_cast (work);
> ^
>
> Has anyone managed to build and successfully run GNU APL with clang?
>
> -Russ
>
>
>


RE: [EXTERNAL]Building GNU APL with clang

2023-10-02 Thread Callahan, Brian Robert
Hi Russ –

On OpenBSD, clang has been the default compiler for many years. I routinely 
build APL trunk on OpenBSD, and never had any problems so long as I add 
-std=gnu++11 to CXXFLAGS. I just rebuilt APL from a clean SVN checkout and it 
built without issues.

I am using clang-16.0.6. Not sure what version Termux uses these days.

~Brian

--
Brian Robert Callahan, Ph.D., CISSP, CCSP, SSCP, CC
Graduate Program Director, ITWS@RPI
Director, Rensselaer Cybersecurity Collaboratory
Office: Lally 304

From: bug-apl-bounces+callab5=rpi@gnu.org 
 On Behalf Of Russtopia
Sent: Monday, October 2, 2023 8:08 PM
To: bug-apl@gnu.org
Subject: [EXTERNAL]Building GNU APL with clang


CAUTION: This email originated from outside of the organization. Do not click 
links or open attachments unless you recognize the sender and know the content 
is safe.
Hello, See topic.

I would rather not, but in this case I am trying to re-build GNU APL in Termux 
on my newer Android phone, and Termux decided some time ago to remove gcc 
entirely from its packages, in preference to clang. :(

I am not up to date at all on modern C++, but this conversation on 
Stackoverflow suggests that auto_ptr is considered deprecated in newer C++ 
standards: 
https://stackoverflow.com/questions/69116001/how-do-i-re-enable-c17-removed-features-in-clang

libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../.. -Wno-deprecated-declarations 
-g -O2 -I /data/data/com.termux/files/home/gnuapl/trunk -c Listener.cc -o 
Listener.o >/dev/null 2>&1
network.cc:37:10: error: no member named 'auto_ptr' in namespace 'std'
std::auto_ptr connection( (NetworkConnection *)arg );
~^
network.cc:37:19: error: 'NetworkConnection' does not refer to a value
std::auto_ptr connection( (NetworkConnection *)arg );
^

Adding -std=c++11 to src/emacs-mode/Makefile CXXFLAGS got me past the auto_ptr 
issues, but then I hit issues with 'typeof()' in LineInput.cc:

g++ -DHAVE_CONFIG_H -I. -I.. -Wall -I sql -I 
/data/data/com.termux/files/home/gnuapl/trunk -std=c++11 -g -O2 -I 
/data/data/com.termux/files/home/gnuapl/trunk -MT apl-Missing_Libraries.o -MD 
-MP -MF .deps/apl-Missing_Libraries.Tpo -c -o apl-Missing_Libraries.o `test -f 
'Missing_Libraries.cc' || echo './'`Missing_Libraries.cc
LApack.cc:1784:37: error: unknown type name 'typeof'; did you mean 'typedef'? 
tau = reinterpret_cast (work);
^~
typedef
LApack.cc:1784:43: error: expected a type tau = reinterpret_cast 
(work);
^
LApack.cc:1784:37: error: type name does not allow storage class to be specified
tau = reinterpret_cast (work);
^

Has anyone managed to build and successfully run GNU APL with clang?

-Russ