English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 24 October 2023, 11:35   #1521
girv
Mostly Harmless
 
girv's Avatar
 
Join Date: Aug 2004
Location: Northern Ireland
Posts: 1,149
bash 5.2, from homebrew

$ $(brew --prefix)/bin/bash --version
GNU bash, version 5.2.15(1)-release (x86_64-apple-darwin21.6.0)
girv is offline  
Old 24 October 2023, 11:41   #1522
Samurai_Crow
Total Chaos forever!
 
Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,193
Ok. Sorry. I'm out of ideas.
Samurai_Crow is offline  
Old 24 October 2023, 11:59   #1523
girv
Mostly Harmless
 
girv's Avatar
 
Join Date: Aug 2004
Location: Northern Ireland
Posts: 1,149
The failing command is a configure in gcc/isl like this. I've added some quotes etc. so I could run it standalone to test.

Code:
CC=gcc-12 CXX=g++-12 $(brew --prefix)/bin/bash 
/Users/girv/projects/_lib/gcc-bebbo/amiga-gcc/projects/gcc/isl/configure 
--srcdir=/Users/girv/projects/_lib/gcc-bebbo/amiga-gcc/projects/gcc/isl 
--cache-file=./config.cache 
--prefix=/opt/amiga 
--enable-version-specific-runtime-libs 
--disable-libssp 
--disable-nls 
--with-headers=/Users/girv/projects/_lib/gcc-bebbo/amiga-gcc/projects/newlib-cygwin/newlib/libc/sys/amigaos/include/ 
--disable-shared 
--enable-threads=no 
--with-stage1-ldflags="-dynamic-libgcc -dynamic-libstdc++" 
--with-boot-ldflags="-dynamic-libgcc -dynamic-libstdc++" 
--with-gmp=/usr/local 
--with-mpfr=/usr/local 
--with-mpc=/usr/local 
--enable-languages=c,c++,lto,objc 
--program-transform-name="s&^&m68k-amigaos-&" 
--disable-option-checking 
--build=x86_64-apple-darwin21.6.0 
--host=x86_64-apple-darwin21.6.0 
--target=m68k-amigaos 
--disable-shared
girv is offline  
Old 24 October 2023, 13:37   #1524
girv
Mostly Harmless
 
girv's Avatar
 
Join Date: Aug 2004
Location: Northern Ireland
Posts: 1,149
Stand down. I deleted and recloned amiga-gcc and it built OK. I thought I'd done that already though, but perhaps not. Must have been something left over from a previous build

$ ./m68k-amigaos-gcc --version
m68k-amigaos-gcc (GCC) 6.5.0b 230920120617
girv is offline  
Old 24 October 2023, 13:43   #1525
girv
Mostly Harmless
 
girv's Avatar
 
Join Date: Aug 2004
Location: Northern Ireland
Posts: 1,149
Is 6.5.0b the only version available at the moment?
girv is offline  
Old 24 October 2023, 13:45   #1526
arti
Registered User
 
Join Date: Jul 2008
Location: Poland
Posts: 665
Looks like mutex isn't supported in gcc 6.5.

Will --enable-threads=posix work here?

Last edited by arti; 24 October 2023 at 14:04.
arti is offline  
Old 24 October 2023, 16:22   #1527
bebbo
bye
 
Join Date: Jun 2016
Location: Some / Where
Posts: 681
Quote:
Originally Posted by arti View Post
Looks like mutex isn't supported in gcc 6.5.

Will --enable-threads=posix work here?

Code:
#include <pthread.h>

and link with -lpthread


That options adds thread safety to stdio and some other stuff.
bebbo is offline  
Old 24 October 2023, 16:26   #1528
bebbo
bye
 
Join Date: Jun 2016
Location: Some / Where
Posts: 681
Quote:
Originally Posted by girv View Post
I'm trying to build master on macOS Monterey. I'd managed to do this before without issue.

isl@0.18 is disabled in homebrew now, but I managed to get it installed by changing the system date temporarily.

Using the script posted in this thread previously: https://gist.github.com/rrs42/5e5b7b...b89d0f4dd3a2a8
with CC=gcc-12 CXX=g++-12 gmake all SHELL=$(brew --prefix)/bin/bash

It fails on building gcc with:
Code:
...
make use of stdint.h in include/isl/stdint.h (assuming C99 compatible system)
checking which gmp to use... system
checking gmp.h usability... no
checking gmp.h presence... no
checking for gmp.h... no
configure: error: gmp.h header not found
gmake[1]: *** [Makefile:4921: configure-isl] Error 1
make gcc...failed
bison and texinfo paths are set.
isl@0.18 and gmp are linked in brew.
gmp.h exists at /usr/local/Cellar/gmp/6.3.0/include/gmp.h

I'm guessing theres some issue with isl@0.18 and the installed version of gmp? Any ideas?

Also - is the gcc 13 branch gone now?

Despite that the wanky shaker os isn't supported very well, there are resolved tickets regarding isl/gmp -> search the issues.


And the gcc branch amiga13.1 does still exist.
bebbo is offline  
Old 24 October 2023, 17:37   #1529
girv
Mostly Harmless
 
girv's Avatar
 
Join Date: Aug 2004
Location: Northern Ireland
Posts: 1,149
Quote:
Originally Posted by bebbo View Post
there are resolved tickets regarding isl/gmp -> search the issues.

Thanks. I'd had a look at those before posting, but in the end it was something local broken. A delete and clone made the problem go away.


Quote:
Originally Posted by bebbo View Post
And the gcc branch amiga13.1 does still exist.

Which repo is that in?
I don't see it in https://github.com/bebbo/amiga-gcc/branches
girv is offline  
Old 24 October 2023, 17:45   #1530
Samurai_Crow
Total Chaos forever!
 
Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,193
https://github.com/bebbo/gcc/tree/amiga13.1 perhaps?
Samurai_Crow is offline  
Old 24 October 2023, 21:57   #1531
girv
Mostly Harmless
 
girv's Avatar
 
Join Date: Aug 2004
Location: Northern Ireland
Posts: 1,149
Quote:
Originally Posted by Samurai_Crow View Post

Got it. I didn't realise that was used in amiga-gcc project.
girv is offline  
Old 25 October 2023, 17:55   #1532
arti
Registered User
 
Join Date: Jul 2008
Location: Poland
Posts: 665
Clib2 fails to build (gcc 6.5). NDK3.2 was used by default.

Code:
make clib2...failed
#include <...> search starts here:
 include
 .
 /opt/amiga/include
 /opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/include
 /opt/amiga/m68k-amigaos/ndk-include
 /opt/amiga/m68k-amigaos/sys-include
 /opt/amiga/m68k-amigaos/include
End of search list.
GNU C11 (GCC) version 6.5.0b 230920120617 (m68k-amigaos)
        compiled by GNU C version 8.3.0, GMP version 6.1.2, MPFR version 4.0.2, MPC version 1.1.0, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 868b4f8c50bc6ab2380344e3ca361ee1
COLLECT_GCC_OPTIONS='-o' 'large_data_020/libm_objs/complex_crealf.o' '-c' '-Wall' '-Wextra' '-Wpointer-arith' '-Wsign-compare' '-Wmissing-prototypes' '-Wundef' '-Wbad-function-cast' '-Wmissing-declarations' '-Wunused' '-O' '-fomit-frame-pointer' '-finline-functions' '-fno-builtin' '-fno-common' '-D' 'NDEBUG' '-D' 'M68020' '-D' 'USE_64_BIT_INTS' '-I' 'include' '-I' '.' '-I' 'netinclude' '-m68020-60' '-v' '-msoft-float' '-D' 'IEEE_FLOATING_POINT_SUPPORT'
 /opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/as --traditional-format -m68020 -o large_data_020/libm_objs/complex_crealf.o /tmp/ccpGb7CP.s
COMPILER_PATH=/opt/amiga/libexec/gcc/m68k-amigaos/6.5.0b/:/opt/amiga/libexec/gcc/:/opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/
LIBRARY_PATH=/opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/:/opt/amiga/lib/gcc/:/opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/lib/
COLLECT_GCC_OPTIONS='-o' 'large_data_020/libm_objs/complex_crealf.o' '-c' '-Wall' '-Wextra' '-Wpointer-arith' '-Wsign-compare' '-Wmissing-prototypes' '-Wundef' '-Wbad-function-cast' '-Wmissing-declarations' '-Wunused' '-O' '-fomit-frame-pointer' '-finline-functions' '-fno-builtin' '-fno-common' '-D' 'NDEBUG' '-D' 'M68020' '-D' 'USE_64_BIT_INTS' '-I' 'include' '-I' '.' '-I' 'netinclude' '-m68020-60' '-v' '-msoft-float' '-D' 'IEEE_FLOATING_POINT_SUPPORT'
Compiling complex_creall.c [large_data_020:m]
Using built-in specs.
COLLECT_GCC=m68k-amigaos-gcc
Target: m68k-amigaos
Configured with: /mnt/d/dev/gcc/amiga-gcc/projects/gcc/configure --prefix=/opt/amiga --target=m68k-amigaos --enable-languages=c,c++,objc --enable-version-specific-runtime-libs --disable-libssp --disable-nls --with-headers=/mnt/d/dev/gcc/amiga-gcc/projects/newlib-cygwin/newlib/libc/sys/amigaos/include/ --disable-shared --enable-threads=no --with-stage1-ldflags='-dynamic-libgcc -dynamic-libstdc++' --with-boot-ldflags='-dynamic-libgcc -dynamic-libstdc++'
Thread model: single
gcc version 6.5.0b 230920120617 (GCC) 
COLLECT_GCC_OPTIONS='-o' 'large_data_020/libm_objs/complex_creall.o' '-c' '-Wall' '-Wextra' '-Wpointer-arith' '-Wsign-compare' '-Wmissing-prototypes' '-Wundef' '-Wbad-function-cast' '-Wmissing-declarations' '-Wunused' '-O' '-fomit-frame-pointer' '-finline-functions' '-fno-builtin' '-fno-common' '-D' 'NDEBUG' '-D' 'M68020' '-D' 'USE_64_BIT_INTS' '-I' 'include' '-I' '.' '-I' 'netinclude' '-m68020-60' '-v' '-msoft-float' '-D' 'IEEE_FLOATING_POINT_SUPPORT'
 /opt/amiga/libexec/gcc/m68k-amigaos/6.5.0b/cc1 -quiet -v -I include -I . -I netinclude -iprefix /opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/ -Dmc68020 -D__mc68020__ -D__mc68020 -isystem /opt/amiga/include -D NDEBUG -D M68020 -D USE_64_BIT_INTS -D IEEE_FLOATING_POINT_SUPPORT complex_creall.c -quiet -dumpbase complex_creall.c -m68020-60 -msoft-float -auxbase-strip large_data_020/libm_objs/complex_creall.o -O -Wall -Wextra -Wpointer-arith -Wsign-compare -Wmissing-prototypes -Wundef -Wbad-function-cast -Wmissing-declarations -Wunused -version -fomit-frame-pointer -finline-functions -fno-builtin -fno-common -o /tmp/ccNfd5IV.s
GNU C11 (GCC) version 6.5.0b 230920120617 (m68k-amigaos)
        compiled by GNU C version 8.3.0, GMP version 6.1.2, MPFR version 4.0.2, MPC version 1.1.0, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/opt/amiga/libexec/gcc/m68k-amigaos/lib/gcc/m68k-amigaos/6.5.0b/include"
ignoring nonexistent directory "/opt/amiga/libexec/gcc/m68k-amigaos/m68k-amigaos/ndk-include"
ignoring nonexistent directory "/opt/amiga/libexec/gcc/m68k-amigaos/m68k-amigaos/sys-include"
ignoring nonexistent directory "/opt/amiga/libexec/gcc/m68k-amigaos/m68k-amigaos/include"
ignoring nonexistent directory "netinclude"
#include "..." search starts here:
#include <...> search starts here:
 include
 .
 /opt/amiga/include
 /opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/include
 /opt/amiga/m68k-amigaos/ndk-include
 /opt/amiga/m68k-amigaos/sys-include
 /opt/amiga/m68k-amigaos/include
End of search list.
GNU C11 (GCC) version 6.5.0b 230920120617 (m68k-amigaos)
        compiled by GNU C version 8.3.0, GMP version 6.1.2, MPFR version 4.0.2, MPC version 1.1.0, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 868b4f8c50bc6ab2380344e3ca361ee1
COLLECT_GCC_OPTIONS='-o' 'large_data_020/libm_objs/complex_creall.o' '-c' '-Wall' '-Wextra' '-Wpointer-arith' '-Wsign-compare' '-Wmissing-prototypes' '-Wundef' '-Wbad-function-cast' '-Wmissing-declarations' '-Wunused' '-O' '-fomit-frame-pointer' '-finline-functions' '-fno-builtin' '-fno-common' '-D' 'NDEBUG' '-D' 'M68020' '-D' 'USE_64_BIT_INTS' '-I' 'include' '-I' '.' '-I' 'netinclude' '-m68020-60' '-v' '-msoft-float' '-D' 'IEEE_FLOATING_POINT_SUPPORT'
 /opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/as --traditional-format -m68020 -o large_data_020/libm_objs/complex_creall.o /tmp/ccNfd5IV.s
COMPILER_PATH=/opt/amiga/libexec/gcc/m68k-amigaos/6.5.0b/:/opt/amiga/libexec/gcc/:/opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/
LIBRARY_PATH=/opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/:/opt/amiga/lib/gcc/:/opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/lib/
COLLECT_GCC_OPTIONS='-o' 'large_data_020/libm_objs/complex_creall.o' '-c' '-Wall' '-Wextra' '-Wpointer-arith' '-Wsign-compare' '-Wmissing-prototypes' '-Wundef' '-Wbad-function-cast' '-Wmissing-declarations' '-Wunused' '-O' '-fomit-frame-pointer' '-finline-functions' '-fno-builtin' '-fno-common' '-D' 'NDEBUG' '-D' 'M68020' '-D' 'USE_64_BIT_INTS' '-I' 'include' '-I' '.' '-I' 'netinclude' '-m68020-60' '-v' '-msoft-float' '-D' 'IEEE_FLOATING_POINT_SUPPORT'
Compiling fenv_feclearexcept.c [large_data_020:m]
Using built-in specs.
COLLECT_GCC=m68k-amigaos-gcc
Target: m68k-amigaos
Configured with: /mnt/d/dev/gcc/amiga-gcc/projects/gcc/configure --prefix=/opt/amiga --target=m68k-amigaos --enable-languages=c,c++,objc --enable-version-specific-runtime-libs --disable-libssp --disable-nls --with-headers=/mnt/d/dev/gcc/amiga-gcc/projects/newlib-cygwin/newlib/libc/sys/amigaos/include/ --disable-shared --enable-threads=no --with-stage1-ldflags='-dynamic-libgcc -dynamic-libstdc++' --with-boot-ldflags='-dynamic-libgcc -dynamic-libstdc++'
Thread model: single
gcc version 6.5.0b 230920120617 (GCC) 
COLLECT_GCC_OPTIONS='-o' 'large_data_020/libm_objs/fenv_feclearexcept.o' '-c' '-Wall' '-Wextra' '-Wpointer-arith' '-Wsign-compare' '-Wmissing-prototypes' '-Wundef' '-Wbad-function-cast' '-Wmissing-declarations' '-Wunused' '-O' '-fomit-frame-pointer' '-finline-functions' '-fno-builtin' '-fno-common' '-D' 'NDEBUG' '-D' 'M68020' '-D' 'USE_64_BIT_INTS' '-I' 'include' '-I' '.' '-I' 'netinclude' '-m68020-60' '-v' '-msoft-float' '-D' 'IEEE_FLOATING_POINT_SUPPORT'
 /opt/amiga/libexec/gcc/m68k-amigaos/6.5.0b/cc1 -quiet -v -I include -I . -I netinclude -iprefix /opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/ -Dmc68020 -D__mc68020__ -D__mc68020 -isystem /opt/amiga/include -D NDEBUG -D M68020 -D USE_64_BIT_INTS -D IEEE_FLOATING_POINT_SUPPORT fenv_feclearexcept.c -quiet -dumpbase fenv_feclearexcept.c -m68020-60 -msoft-float -auxbase-strip large_data_020/libm_objs/fenv_feclearexcept.o -O -Wall -Wextra -Wpointer-arith -Wsign-compare -Wmissing-prototypes -Wundef -Wbad-function-cast -Wmissing-declarations -Wunused -version -fomit-frame-pointer -finline-functions -fno-builtin -fno-common -o /tmp/ccRzMXYW.s
GNU C11 (GCC) version 6.5.0b 230920120617 (m68k-amigaos)
        compiled by GNU C version 8.3.0, GMP version 6.1.2, MPFR version 4.0.2, MPC version 1.1.0, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/opt/amiga/libexec/gcc/m68k-amigaos/lib/gcc/m68k-amigaos/6.5.0b/include"
ignoring nonexistent directory "/opt/amiga/libexec/gcc/m68k-amigaos/m68k-amigaos/ndk-include"
ignoring nonexistent directory "/opt/amiga/libexec/gcc/m68k-amigaos/m68k-amigaos/sys-include"
ignoring nonexistent directory "/opt/amiga/libexec/gcc/m68k-amigaos/m68k-amigaos/include"
ignoring nonexistent directory "netinclude"
#include "..." search starts here:
#include <...> search starts here:
 include
 .
 /opt/amiga/include
 /opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/include
 /opt/amiga/m68k-amigaos/ndk-include
 /opt/amiga/m68k-amigaos/sys-include
 /opt/amiga/m68k-amigaos/include
End of search list.
GNU C11 (GCC) version 6.5.0b 230920120617 (m68k-amigaos)
        compiled by GNU C version 8.3.0, GMP version 6.1.2, MPFR version 4.0.2, MPC version 1.1.0, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 868b4f8c50bc6ab2380344e3ca361ee1
In file included from /opt/amiga/m68k-amigaos/sys-include/errno.h:9:0,
                 from include/errno.h:56,
                 from math_headers.h:40,
                 from fenv_feclearexcept.c:35:
/opt/amiga/m68k-amigaos/sys-include/sys/errno.h:20:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'const'
 extern __IMPORT const char * const _sys_errlist[];
                 ^~~~~
/opt/amiga/m68k-amigaos/sys-include/sys/errno.h:21:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
 extern __IMPORT int _sys_nerr;
                 ^~~
fenv_feclearexcept.c: In function 'feclearexcept':
fenv_feclearexcept.c:46:19: warning: unused parameter 'excepts' [-Wunused-parameter]
 feclearexcept(int excepts)
                   ^~~~~~~
make[2]: *** [GNUmakefile.68k:71: large_data_020/libm_objs/fenv_feclearexcept.o] Error 1
make clib2...failed
use less "log/make clib2.log" to view the full log and search for ***
arti is offline  
Old 25 October 2023, 18:37   #1533
arti
Registered User
 
Join Date: Jul 2008
Location: Poland
Posts: 665
After make clean, and setting NDK to 3.9:
Code:
configure libdebug...failed
configure: WARNING: If you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used.
checking build system type... x86_64-unknown-linux-gnu
checking host system type... m68k-unknown-amigaos
checking target system type... m68k-unknown-amigaos
checking whether make sets $(MAKE)... yes
checking for SFDC... no
checking for sfdc... sfdc
checking for m68k-amigaos-gcc... m68k-amigaos-gcc
checking for m68k-amigaos-ar... m68k-amigaos-ar
checking for m68k-amigaos-ranlib... m68k-amigaos-ranlib
checking for m68k-amigaos-gcc... (cached) m68k-amigaos-gcc
checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log' for more details.
configure libdebug...failed
clib2 compiled ok.
arti is offline  
Old 25 October 2023, 18:42   #1534
arti
Registered User
 
Join Date: Jul 2008
Location: Poland
Posts: 665
with --enable-threads=posix

switch -pthread still doesn't work

m68k-amigaos-g++ -std=c++11 -m68040 -O2 -noixemul -pthread mutex.cpp -o mutex
m68k-amigaos-g++: error: unrecognized command line option '-pthread'; did you mean '-pthread'?

-lpthread is treated as wrongly written -pthread and not a library

m68k-amigaos-g++: error: unrecognized command line option '-lpthread'; did you mean '-pthread'?
arti is offline  
Old 25 October 2023, 20:38   #1535
bebbo
bye
 
Join Date: Jun 2016
Location: Some / Where
Posts: 681
Quote:
Originally Posted by arti View Post
with --enable-threads=posix

switch -pthread still doesn't work

m68k-amigaos-g++ -std=c++11 -m68040 -O2 -noixemul -pthread mutex.cpp -o mutex
m68k-amigaos-g++: error: unrecognized command line option '-pthread'; did you mean '-pthread'?

-lpthread is treated as wrongly written -pthread and not a library

m68k-amigaos-g++: error: unrecognized command line option '-lpthread'; did you mean '-pthread'?

E.g using pthread1.c from https://www.cs.cmu.edu/afs/cs/academ.../pthreads.html


Code:
m68k-amigaos-g++ pthread1.c -noixemul -lpthread -o pthread1 -Os
yields an executable, which runs fine and prints
Code:
Thread 1
Thread 2
Thread 1 returns: 0
Thread 2 returns: 0
bebbo is offline  
Old 04 February 2024, 01:31   #1536
alancfrancis
Registered User
 
alancfrancis's Avatar
 
Join Date: Jun 2020
Location: Scotland
Posts: 146
UPDATE: Never mind, answered my own question and got past this problem, but my plan isn't going to work anyway I think :-). I have been trying to wrap libCurl (which I only have in a gcc-friendly link lib) up in a very simple .library I can use from SAS with, essentially, two functions to make a get or post request and dump the results in a tempfile. I think there's stdio stuff in libCurl that's unhappy in a library.

Quote:
I am trying to build a shared library with amiga-gcc and so far, so good, based on copying the example from https://github.com/bebbo/amigaos-cro...mple-library.c and the associated makefile.

I'd like to make use of functions in a link library.

* I have the header with prototypes included fine, and so the C file compiles.
* I feel pretty sure my -l flags are set up to find the libX.a as if I misspell the library name I get an error, and it goes away if I spell it correctly.

But when I build, the linker reports "undefined reference to 'my_func'"

Is there anything special I should do to be able to build a .library from some C files and some libX.a files ? In short, aside from the -lz, how would I alter the makefile here https://github.com/bebbo/amigaos-cro...mples/Makefile to add, say -lz and call linked zlib functions from inside the simple.library ?

Last edited by alancfrancis; 04 February 2024 at 01:54.
alancfrancis is offline  
Old 13 February 2024, 09:39   #1537
thyslo
Registered User
 
Join Date: Apr 2018
Location: Germany
Posts: 193
I fail to compile a Reaction snippet from the NDK3.2 examples directory. See the attached file Layout1.c.

The macros from reaction_macros.h (also attached and renamed to .c for upload validity) are heavily used in all these examples and this is where the compilation fails.

Code:
$ m68k-amigaos-gcc Layout1.c

    Layout1.c: In function 'main':
    Layout1.c:307:0: error: unterminated argument list invoking macro "NewObject"
     }
    
    Layout1.c:66:10: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
      gParent = VGroupObject,
              ^
    Layout1.c:66:2: error: expected ';' at end of input
      gParent = VGroupObject,
      ^~~~~~~
    Layout1.c:66:2: error: expected declaration or statement at end of input

$
Gcc seems not to detect the macros like VGroupObject etc.

With SAS-C it compiles sucessfully with the command that is given in first line of Layout.c:

Code:
sc LINK Layout1.c LIB lib:reaction.lib NOSTACKCHECK
Can anyone help to get it compiled with gcc as well?
Attached Files
File Type: c Layout1.c (8.0 KB, 21 views)
File Type: c reaction_macros.h.c (11.4 KB, 17 views)

Last edited by thyslo; 13 February 2024 at 09:46.
thyslo is offline  
Old 28 February 2024, 15:56   #1538
thyslo
Registered User
 
Join Date: Apr 2018
Location: Germany
Posts: 193
Bebbo answered me on GitHub. The Reaction problem, see above, can be solved like this:

1. Update your amiga-gcc, and at least rebuild libnix:
Code:
make update
make clean-libnix
make libnix
2. You have to define NO_INLINE_STDARG.
Code:
m68k-amigaos-gcc Layout1.c -o Layout1 -noixemul -Os  -DNO_INLINE_STDARG
thyslo is offline  
Old 28 February 2024, 15:59   #1539
thyslo
Registered User
 
Join Date: Apr 2018
Location: Germany
Posts: 193
And for the Reaction examples from the NDK where reaction.lib is needed, like Chooser1.c, do the following:

Copy

/opt/amiga/m68k-amigaos/vbcc/lib/reaction.lib


To

opt/amiga/lib/libreaction.a

(note the renaming).

And then compile it like this:

Code:
m68k-amigaos-gcc Chooser1.c -o Chooser1 -noixemul -Os -DNO_INLINE_STDARG -lreaction
thyslo is offline  
Old 06 March 2024, 09:27   #1540
Mafi
Registered User
 
Join Date: Jul 2022
Location: Australia
Posts: 49
Quote:
Originally Posted by thyslo View Post
And for the Reaction examples from the NDK where reaction.lib is needed, like Chooser1.c, do the following:

Copy

/opt/amiga/m68k-amigaos/vbcc/lib/reaction.lib


To

opt/amiga/lib/libreaction.a

(note the renaming).

And then compile it like this:

Code:
m68k-amigaos-gcc Chooser1.c -o Chooser1 -noixemul -Os -DNO_INLINE_STDARG -lreaction
You shouldn't even have to do that. I built the tool chain and managed to compile/run a Reaction app without any special options. Here's my CMakeLists.txt:

Code:
 cmake_minimum_required(VERSION 3.10)  # Minimum version of CMake 

 set(CMAKE_EXPORT_COMPILE_COMMANDS ON)                                                        
 set(CMAKE_C_STANDARD 90)                                                                       
 set(CMAKE_C_STANDARD_REQUIRED ON)                                                              
 set(CMAKE_C_EXTENSIONS OFF)                    
                                                
 project(HelloAmiga)                                                    

 add_compile_options(-DNO_INLINE_STDARG)                                                        
 add_compile_options(-Wno-int-conversion)                                                       
 add_compile_options(-Wno-implicit-function-declaration)
                                        
 find_library(DEBUG_LIB NAMES debug PATHS /opt/amiga/m68k-amigaos/lib)                          

 add_executable(hello_amiga test.c)  # Create an executable from test.c
 # Link the executable to the debug library                                                    

 if(DEBUG_LIB)
     target_link_libraries(hello_amiga PRIVATE ${DEBUG_LIB})                                    
 else()
     message(SEND_ERROR "libdebug.a not found")                                                 
 endif()
My biggest problem is that Clang (pretty much used by all language servers like clangd and ccls) chokes on a lot of the NDK includes (mainly protos and any declarations using 68k registers. Basically means auto-complete etc. doesn't work, or partially works.

On second thoughts, I used a pre-canned toolchain config for Cmake, so it probably does some command line/option magic!

(Cmake Amiga toolchain configs here: https://github.com/AmigaPorts/AmigaCMakeCrossToolchains)

-M

Last edited by Mafi; 06 March 2024 at 09:34. Reason: Missed out toolchain config details
Mafi is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
New GCC based dev toolchain for AmigaOS 3.x cla Coders. Releases 8 24 December 2017 10:18
Issue with photon/xxxx WinUAE Toolchain arpz Coders. Asm / Hardware 2 26 September 2015 22:33
New 68k gcc toolchain arti Coders. C/C++ 17 31 July 2015 03:59
Hannibal's WinUAE Demo Toolchain 5 Bobic Amiga scene 1 23 July 2015 21:04
From gcc to vbcc. Cowcat Coders. General 9 06 June 2014 14:45

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 14:32.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.13185 seconds with 14 queries