compiling plugin/modules

serk118uk · 1028

serk118uk

  • Member
  • ***
    • Posts: 158
    • Karma: +64/-0
on: October 21, 2021, 02:22:01 PM
Hi ppl,

I am trying to compile sasc.module , everything seems fine but i get this message from gcc

Making sasc.module...
gcc -nostartfiles -O3 -s -o sasc.module  sasc.module.o StartUp.o libinit.o -lamiga
There are undefined symbols in 'sasc.module':
__PROGRAM_ENTRIES__symbol_set_handler_missing
__LIBS__symbol_set_handler_missing
make: *** [sasc.module] Error 1

i can not find any or much info about plugins or modules ,

someone please have a look at the attached code..(very little codes) and

makefile and codes are in AmiDE_plugins/modules/sasc.

thanks..



Lets Build Not Destroy...


deadwood

  • AROS Developer
  • Legendary Member
  • *****
    • Posts: 1138
    • Karma: +107/-0
Reply #1 on: October 21, 2021, 08:02:15 PM
What happens if you remove the -nostartfiles argument from command line?

Also in StartUp.c there is aros/libcall.h include - is this something you added or was it already there?

In general the missing symbols are part of AROS automatic startup handling. Possibly manually adding -llibinit could fix the missing symbols.



serk118uk

  • Member
  • ***
    • Posts: 158
    • Karma: +64/-0
Reply #2 on: October 22, 2021, 04:08:56 PM
What happens if you remove the -nostartfiles argument from command line?

compiles and main missing this time (expect main missing because i am trying to compile plugin/module so no main)

------
Making sasc.module...
gcc -O3 -s -llibinit -o sasc.module  sasc.module.o StartUp.o libinit.o
There are undefined symbols in 'sasc.module':
main
make: *** [sasc.module] Error 1
-------


Quote
Also in StartUp.c there is aros/libcall.h include - is this something you added or was it already there?

I added ,i was trying another method..(i forgotten to  remove that line )

Quote
In general the missing symbols are part of AROS automatic startup handling. Possibly manually adding -llibinit could fix the missing symbols.

adding "-llibinit" not done much
------
Making sasc.module...
gcc -O3 -s -llibinit -o sasc.module  sasc.module.o StartUp.o libinit.o
There are undefined symbols in 'sasc.module':
main
make: *** [sasc.module] Error 1
-------


deadwood without -nostartfiles i get main missing and  -llibinit does not make difference , i think i need to compile this
plugin/module with -nostartfiles .

i have wrtiten the makefile, actual amide comes with smakefile, maybe i done bad job with makefile


« Last Edit: October 22, 2021, 04:11:58 PM by serk118uk »

Lets Build Not Destroy...


deadwood

  • AROS Developer
  • Legendary Member
  • *****
    • Posts: 1138
    • Karma: +107/-0
Reply #3 on: October 22, 2021, 05:32:35 PM
Yes, I think you are right - you need -nostartfile. Add this again and also add '-llibinit -lautoinit'

Edit: if that does not help, I will look into the problem over weekend
« Last Edit: October 22, 2021, 05:36:15 PM by deadwood »



serk118uk

  • Member
  • ***
    • Posts: 158
    • Karma: +64/-0
Reply #4 on: October 22, 2021, 07:02:31 PM
Yes, I think you are right - you need -nostartfile. Add this again and also add '-llibinit -lautoinit'

Edit: if that does not help, I will look into the problem over weekend

deadwood
adding -nostartfiles -llibinit -lautoinit

gcc -O3 -nostartfiles -llibinit -lautoinit -o sasc.module  sasc.module.o StartUp.o libinit.o
There are undefined symbols in 'sasc.module':
__PROGRAM_ENTRIES__symbol_set_handler_missing
__LIBS__symbol_set_handler_missing
make: *** [sasc.module] Error 1

Lets Build Not Destroy...


deadwood

  • AROS Developer
  • Legendary Member
  • *****
    • Posts: 1138
    • Karma: +107/-0
Reply #5 on: October 22, 2021, 07:17:37 PM
Does it change if you add "-llibinit -lautoinit" at the end of command line

Heh, I know where the problem is coming from, I just can't remember the solution  :-\
« Last Edit: October 22, 2021, 07:24:13 PM by deadwood »



deadwood

  • AROS Developer
  • Legendary Member
  • *****
    • Posts: 1138
    • Karma: +107/-0
Reply #6 on: October 22, 2021, 07:56:41 PM
I did a quick compile under linux-hosted and didn't get the problems you mentioned. I got missing symbols for C library which I solved with -static argument. Here is a diff of my changes:

Code: [Select]
diff -ruN AmiDE_plugins/modules/sasc/makefile AmiDE_plugins_changed/modules/sasc/makefile
--- AmiDE_plugins/modules/sasc/makefile 2021-10-21 01:05:08.000000000 +0200
+++ AmiDE_plugins_changed/modules/sasc/makefile 2021-10-22 19:47:16.696051696 +0200
@@ -7,7 +7,7 @@
 
 #config n flags
 CC = gcc
-FLAGS = $(OPTIMIZE) -fomit-frame-pointer -I../amide/modules/api/ -I../amide/modules/api/amide/
+FLAGS = $(OPTIMIZE) -fomit-frame-pointer -I../api/ -I../amide/modules/api/amide/
 CFLAGS = $(FLAGS) -DNO_INLINE_STDARG
 LFLAGS = $(FLAGS) #-s #-nostartfiles
 
@@ -15,7 +15,7 @@
 
 sasc.module$(EXT): $(O_FILES)
  echo Making $@...
- $(CC) -nostartfiles $(LINK) -o $@  $(O_FILES) -lamiga
+ $(CC) -nostartfiles -static $(LINK) -o $@  $(O_FILES) -lamiga
 
 StartUp$(EXT).o: StartUp.c
  echo Making $@...
diff -ruN AmiDE_plugins/modules/sasc/sasc.module.c AmiDE_plugins_changed/modules/sasc/sasc.module.c
--- AmiDE_plugins/modules/sasc/sasc.module.c 2021-10-21 01:03:56.000000000 +0200
+++ AmiDE_plugins_changed/modules/sasc/sasc.module.c 2021-10-22 19:51:55.067595642 +0200
@@ -835,3 +835,13 @@
 
   return (DoSuperMethodA(cl, obj, msg));
 }
+
+void * calloc(size_t count, size_t size)
+{
+    AllocVec(count * size, MEMF_ANY | MEMF_CLEAR);
+}
+
+void free(void *ptr)
+{
+    FreeVec(ptr);
+}




serk118uk

  • Member
  • ***
    • Posts: 158
    • Karma: +64/-0
Reply #7 on: October 23, 2021, 12:06:43 AM
I did a quick compile under linux-hosted and didn't get the problems you mentioned. I got missing symbols for C library which I solved with -static argument. Here is a diff of my changes:

Code: [Select]
diff -ruN AmiDE_plugins/modules/sasc/makefile AmiDE_plugins_changed/modules/sasc/makefile
--- AmiDE_plugins/modules/sasc/makefile 2021-10-21 01:05:08.000000000 +0200
+++ AmiDE_plugins_changed/modules/sasc/makefile 2021-10-22 19:47:16.696051696 +0200
@@ -7,7 +7,7 @@
 
 #config n flags
 CC = gcc
-FLAGS = $(OPTIMIZE) -fomit-frame-pointer -I../amide/modules/api/ -I../amide/modules/api/amide/
+FLAGS = $(OPTIMIZE) -fomit-frame-pointer -I../api/ -I../amide/modules/api/amide/
 CFLAGS = $(FLAGS) -DNO_INLINE_STDARG
 LFLAGS = $(FLAGS) #-s #-nostartfiles
 
@@ -15,7 +15,7 @@
 
 sasc.module$(EXT): $(O_FILES)
  echo Making $@...
- $(CC) -nostartfiles $(LINK) -o $@  $(O_FILES) -lamiga
+ $(CC) -nostartfiles -static $(LINK) -o $@  $(O_FILES) -lamiga
 
 StartUp$(EXT).o: StartUp.c
  echo Making $@...
diff -ruN AmiDE_plugins/modules/sasc/sasc.module.c AmiDE_plugins_changed/modules/sasc/sasc.module.c
--- AmiDE_plugins/modules/sasc/sasc.module.c 2021-10-21 01:03:56.000000000 +0200
+++ AmiDE_plugins_changed/modules/sasc/sasc.module.c 2021-10-22 19:51:55.067595642 +0200
@@ -835,3 +835,13 @@
 
   return (DoSuperMethodA(cl, obj, msg));
 }
+
+void * calloc(size_t count, size_t size)
+{
+    AllocVec(count * size, MEMF_ANY | MEMF_CLEAR);
+}
+
+void free(void *ptr)
+{
+    FreeVec(ptr);
+}



my compile with your changes changes
-------
gcc -O2 -fomit-frame-pointer -I../api/ -I../amide/modules/api/amide/ -DNO_INLINE_STDARG -nostartfiles   -c -o sasc.module.o sasc.module.c

In file included from sasc.module.c:63:0:
sasc.module.h:96:1: warning: useless storage class specifier in empty declaration [enabled by default]
sasc.module.h:111:1: warning: useless storage class specifier in empty declaration [enabled by default]
sasc.module.c: In function 'MODULE_New':
sasc.module.c:216:5: warning: passing argument 2 of '__inline_Utility_GetTagData' makes integer from pointer without a cast [enabled by default]

/AROS/Development/bin/../../Development/include/inline/utility.h:44:20: note: expected 'IPTR' but argument is of type 'void *'

echo Making StartUp.o...
Making StartUp.o...
gcc -O2 -fomit-frame-pointer -I../api/ -I../amide/modules/api/amide/ -DNO_INLINE_STDARG -nostartfiles -c -o StartUp.o StartUp.c

In file included from StartUp.c:33:0:
sasc.module.h:96:1: warning: useless storage class specifier in empty declaration [enabled by default]
sasc.module.h:111:1: warning: useless storage class specifier in empty declaration [enabled by default]
StartUp.c: In function 'ExtFuncLib':
StartUp.c:270:2: warning: return makes integer from pointer without a cast [enabled by default]
echo Making libinit.o...
Making libinit.o...
gcc -O2 -fomit-frame-pointer -I../api/ -I../amide/modules/api/amide/ -DNO_INLINE_STDARG -nostartfiles -c -o libinit.o libinit.c

In file included from libinit.c:30:0:
sasc.module.h:96:1: warning: useless storage class specifier in empty declaration [enabled by default]
sasc.module.h:111:1: warning: useless storage class specifier in empty declaration [enabled by default]
libinit.c: In function 'L_OpenLibs':
libinit.c:152:21: warning: assignment makes integer from pointer without a cast [enabled by default]
echo Making sasc.module...
Making sasc.module...
gcc -static -O2 -s -nostartfiles -o sasc.module sasc.module.o StartUp.o libinit.o -lamiga
There are undefined symbols in 'sasc.module':
__PROGRAM_ENTRIES__symbol_set_handler_missing
__LIBS__symbol_set_handler_missing
make: *** [sasc.module] Error 1


makefile with new changes
Code: [Select]
#Simple makefile for plugins/module...

OPTIMIZE := -O2
LINK := $(OPTIMIZE) -s -nostartfiles

O_FILES =  sasc.module$(EXT).o StartUp$(EXT).o libinit$(EXT).o

#config n flags
CC = gcc
FLAGS = $(OPTIMIZE) -fomit-frame-pointer -I../api/ -I../amide/modules/api/amide/
CFLAGS = $(FLAGS) -DNO_INLINE_STDARG -nostartfiles


#if above good than rest should go smooth

sasc.module$(EXT): $(O_FILES)
echo Making $@...
$(CC) -static $(LINK) -o $@ $(O_FILES) -lamiga

StartUp$(EXT).o: StartUp.c
echo Making $@...
$(CC) $(CFLAGS) -c -o $@ $^

libinit$(EXT).o: libinit.c
echo Making $@...
$(CC) $(CFLAGS) -c -o $@ $^


test_link:
ar rc test_plugin.a StartUp.o libinit.o sasc.module.o

copytofolder:
echo Copying to modules directory...
copy QUIET CLONE sasc.module TO modules/
echo module copied ok...

clean:
echo Cleaning distribution...
delete *.o*

Lets Build Not Destroy...


deadwood

  • AROS Developer
  • Legendary Member
  • *****
    • Posts: 1138
    • Karma: +107/-0
Reply #8 on: October 23, 2021, 07:16:01 AM
I suspect you are pulling in link library from arosc or stdc which generates the missing symbols. Can you run link in "verbose" mode and paste in the output?

LINK := $(OPTIMIZE) -s -nostartfiles -v



serk118uk

  • Member
  • ***
    • Posts: 158
    • Karma: +64/-0
Reply #9 on: October 23, 2021, 03:42:15 PM
Code: [Select]
Using built-in specs.
COLLECT_GCC=/Development/bin/gcc
COLLECT_LTO_WRAPPER=/Development/libexec/gcc/i386-aros/4.6.4/lto-wrapper
Target: i386-aros
Configured with: /home/aros/aros_abiv0ontrunk/Build/20160105/AROS/bin/pc-i386/Ports/gcc/gcc-4.6.4/configure --prefix=/Development --build=x86_64-linux --host=i386-aros --target=i386-aros --disable-nls --without-x --without-pic --disable-shared --enable-languages=c,c++,objc --enable-longlong --disable-sjlj-exceptions --enable-version-specific-runtime-libs --disable-libssp --disable-libstdcxx-pch --with-sysroot=/Development --with-build-sysroot=/home/aros/aros_abiv0ontrunk/Build/20160105/AROS/bin/pc-i386/AROS/Development --with-dwarf2 --enable-frame-pointer CFLAGS=-I/home/aros/aros_abiv0ontrunk/Build/20160105/AROS/bin/pc-i386/AROS/Development/include
Thread model: single
gcc version 4.6.4 (GCC)
COMPILER_PATH=/Development/libexec/gcc/i386-aros/4.6.4/:/Development/libexec/gcc/i386-aros/4.6.4/:/Development/libexec/gcc/i386-aros/:/Development/lib/gcc/i386-aros/4.6.4/:/Development/lib/gcc/i386-aros/:/Development/lib/gcc/i386-aros/4.6.4/../../../../i386-aros/bin/
LIBRARY_PATH=/Development/lib/gcc/i386-aros/4.6.4/:/Development/lib/gcc/i386-aros/4.6.4/../../../../i386-aros/lib/:/Development/lib/gcc/i386-aros/4.6.4/../../../:/Development/lib/
COLLECT_GCC_OPTIONS='-static' '-O3' '-s' '-nostartfiles' '-v' '-o' 'sasc.module sasc.module.o' '-mtune=i386' '-march=i386'
 collect-aros --sysroot=/Development -m elf_i386 -L/Development/lib -o sasc.module sasc.module.o -s -L/Development/lib/gcc/i386-aros/4.6.4 -L/Development/lib/gcc/i386-aros/4.6.4/../../../../i386-aros/lib -L/Development/lib/gcc/i386-aros/4.6.4/../../.. -L/Development/lib libinit.o StartUp.o -lamiga -llibinit -lautoinit -lgcc -lmui -larossupport -lamiga -larosc -lcodesets -lkeymap -lexpansion -lcommodities -ldiskfont -lasl -lmuimaster -ldatatypes -lcybergraphics -lworkbench -licon -lintuition -lgadtools -llayers -laros -lpartition -liffparse -lgraphics -llocale -ldos -lutility -loop -lexec -lautoinit -llibinit -lautoinit -lgcc
There are undefined symbols in 'sasc.module sasc.module.o':
cl
AmIDE_API_GetClass
MODULE_Dispatcher

Code: [Select]
Using built-in specs.
COLLECT_GCC=/Development/bin/gcc
COLLECT_LTO_WRAPPER=/Development/libexec/gcc/i386-aros/4.6.4/lto-wrapper
Target: i386-aros
Configured with: /home/aros/aros_abiv0ontrunk/Build/20160105/AROS/bin/pc-i386/Ports/gcc/gcc-4.6.4/configure --prefix=/Development --build=x86_64-linux --host=i386-aros --target=i386-aros --disable-nls --without-x --without-pic --disable-shared --enable-languages=c,c++,objc --enable-longlong --disable-sjlj-exceptions --enable-version-specific-runtime-libs --disable-libssp --disable-libstdcxx-pch --with-sysroot=/Development --with-build-sysroot=/home/aros/aros_abiv0ontrunk/Build/20160105/AROS/bin/pc-i386/AROS/Development --with-dwarf2 --enable-frame-pointer CFLAGS=-I/home/aros/aros_abiv0ontrunk/Build/20160105/AROS/bin/pc-i386/AROS/Development/include
Thread model: single
gcc version 4.6.4 (GCC)
COLLECT_GCC_OPTIONS='-nostartfiles' '-O3' '-fomit-frame-pointer' '-I' './api/' '-I' '../api/' '-I' '../modules/api/' '-I' '../amide/modules/api/amide/' '-s' '-D' 'NO_INLINE_STDARG' '-v' '-c' '-o' 'StartUp.o' '-mtune=i386' '-march=i386'
 /Development/libexec/gcc/i386-aros/4.6.4/cc1 -quiet -v -I ./api/ -I ../api/ -I ../modules/api/ -I ../amide/modules/api/amide/ -isystem /Development/include/aros/posixc -isystem /Development/include/aros/stdc -isystem /Development/include -D NO_INLINE_STDARG StartUp.c -quiet -dumpbase StartUp.c -mtune=i386 -march=i386 -auxbase-strip StartUp.o -O3 -version -fomit-frame-pointer -o /T/cchI2aPA.s
GNU C (GCC) version 4.6.4 (i386-aros)
compiled by GNU C version 4.6.4, GMP version 5.1.2, MPFR version 3.1.2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
ignoring nonexistent directory "/Development/local/include"
ignoring duplicate directory "/Development/include"
ignoring nonexistent directory "./api/"
ignoring nonexistent directory "../modules/api/"
ignoring nonexistent directory "../amide/modules/api/amide/"
#include "..." search starts here:
#include <...> search starts here:
 ../api/
 /Development/include/aros/posixc
 /Development/include/aros/stdc
 /Development/include
 /Development/lib/gcc/i386-aros/4.6.4/include
End of search list.
GNU C (GCC) version 4.6.4 (i386-aros)
compiled by GNU C version 4.6.4, GMP version 5.1.2, MPFR version 3.1.2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: cd4039e4bb7c10dfecfcdcee92827141
In file included from StartUp.c:30:0:
sasc.module.h:92:1: warning: useless storage class specifier in empty declaration [enabled by default]
sasc.module.h:107:1: warning: useless storage class specifier in empty declaration [enabled by default]
StartUp.c: In function 'ExtFuncLib':
StartUp.c:267:2: warning: return makes integer from pointer without a cast [enabled by default]
COLLECT_GCC_OPTIONS='-nostartfiles' '-O3' '-fomit-frame-pointer' '-I' './api/' '-I' '../api/' '-I' '../modules/api/' '-I' '../amide/modules/api/amide/' '-s' '-D' 'NO_INLINE_STDARG' '-v' '-c' '-o' 'StartUp.o' '-mtune=i386' '-march=i386'
 /Development/lib/gcc/i386-aros/4.6.4/../../../../i386-aros/bin/as -o StartUp.o /T/cchI2aPA.s
COMPILER_PATH=/Development/libexec/gcc/i386-aros/4.6.4/:/Development/libexec/gcc/i386-aros/4.6.4/:/Development/libexec/gcc/i386-aros/:/Development/lib/gcc/i386-aros/4.6.4/:/Development/lib/gcc/i386-aros/:/Development/lib/gcc/i386-aros/4.6.4/../../../../i386-aros/bin/
LIBRARY_PATH=/Development/lib/gcc/i386-aros/4.6.4/:/Development/lib/gcc/i386-aros/4.6.4/../../../../i386-aros/lib/:/Development/lib/gcc/i386-aros/4.6.4/../../../:/Development/lib/
COLLECT_GCC_OPTIONS='-nostartfiles' '-O3' '-fomit-frame-pointer' '-I' './api/' '-I' '../api/' '-I' '../modules/api/' '-I' '../amide/modules/api/amide/' '-s' '-D' 'NO_INLINE_STDARG' '-v' '-c' '-o' 'StartUp.o' '-mtune=i386' '-march=i386'

Code: [Select]
Using built-in specs.
COLLECT_GCC=/Development/bin/gcc
COLLECT_LTO_WRAPPER=/Development/libexec/gcc/i386-aros/4.6.4/lto-wrapper
Target: i386-aros
Configured with: /home/aros/aros_abiv0ontrunk/Build/20160105/AROS/bin/pc-i386/Ports/gcc/gcc-4.6.4/configure --prefix=/Development --build=x86_64-linux --host=i386-aros --target=i386-aros --disable-nls --without-x --without-pic --disable-shared --enable-languages=c,c++,objc --enable-longlong --disable-sjlj-exceptions --enable-version-specific-runtime-libs --disable-libssp --disable-libstdcxx-pch --with-sysroot=/Development --with-build-sysroot=/home/aros/aros_abiv0ontrunk/Build/20160105/AROS/bin/pc-i386/AROS/Development --with-dwarf2 --enable-frame-pointer CFLAGS=-I/home/aros/aros_abiv0ontrunk/Build/20160105/AROS/bin/pc-i386/AROS/Development/include
Thread model: single
gcc version 4.6.4 (GCC)
COLLECT_GCC_OPTIONS='-nostartfiles' '-O3' '-fomit-frame-pointer' '-I' './api/' '-I' '../api/' '-I' '../modules/api/' '-I' '../amide/modules/api/amide/' '-s' '-D' 'NO_INLINE_STDARG' '-v' '-c' '-o' 'libinit.o' '-mtune=i386' '-march=i386'
 /Development/libexec/gcc/i386-aros/4.6.4/cc1 -quiet -v -I ./api/ -I ../api/ -I ../modules/api/ -I ../amide/modules/api/amide/ -isystem /Development/include/aros/posixc -isystem /Development/include/aros/stdc -isystem /Development/include -D NO_INLINE_STDARG libinit.c -quiet -dumpbase libinit.c -mtune=i386 -march=i386 -auxbase-strip libinit.o -O3 -version -fomit-frame-pointer -o /T/ccgr90Bo.s
GNU C (GCC) version 4.6.4 (i386-aros)
compiled by GNU C version 4.6.4, GMP version 5.1.2, MPFR version 3.1.2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
ignoring nonexistent directory "/Development/local/include"
ignoring duplicate directory "/Development/include"
ignoring nonexistent directory "./api/"
ignoring nonexistent directory "../modules/api/"
ignoring nonexistent directory "../amide/modules/api/amide/"
#include "..." search starts here:
#include <...> search starts here:
 ../api/
 /Development/include/aros/posixc
 /Development/include/aros/stdc
 /Development/include
 /Development/lib/gcc/i386-aros/4.6.4/include
End of search list.
GNU C (GCC) version 4.6.4 (i386-aros)
compiled by GNU C version 4.6.4, GMP version 5.1.2, MPFR version 3.1.2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: cd4039e4bb7c10dfecfcdcee92827141
In file included from libinit.c:32:0:
sasc.module.h:92:1: warning: useless storage class specifier in empty declaration [enabled by default]
sasc.module.h:107:1: warning: useless storage class specifier in empty declaration [enabled by default]
libinit.c: In function 'L_OpenLibs':
libinit.c:153:21: warning: assignment makes integer from pointer without a cast [enabled by default]
COLLECT_GCC_OPTIONS='-nostartfiles' '-O3' '-fomit-frame-pointer' '-I' './api/' '-I' '../api/' '-I' '../modules/api/' '-I' '../amide/modules/api/amide/' '-s' '-D' 'NO_INLINE_STDARG' '-v' '-c' '-o' 'libinit.o' '-mtune=i386' '-march=i386'
 /Development/lib/gcc/i386-aros/4.6.4/../../../../i386-aros/bin/as -o libinit.o /T/ccgr90Bo.s
COMPILER_PATH=/Development/libexec/gcc/i386-aros/4.6.4/:/Development/libexec/gcc/i386-aros/4.6.4/:/Development/libexec/gcc/i386-aros/:/Development/lib/gcc/i386-aros/4.6.4/:/Development/lib/gcc/i386-aros/:/Development/lib/gcc/i386-aros/4.6.4/../../../../i386-aros/bin/
LIBRARY_PATH=/Development/lib/gcc/i386-aros/4.6.4/:/Development/lib/gcc/i386-aros/4.6.4/../../../../i386-aros/lib/:/Development/lib/gcc/i386-aros/4.6.4/../../../:/Development/lib/
COLLECT_GCC_OPTIONS='-nostartfiles' '-O3' '-fomit-frame-pointer' '-I' './api/' '-I' '../api/' '-I' '../modules/api/' '-I' '../amide/modules/api/amide/' '-s' '-D' 'NO_INLINE_STDARG' '-v' '-c' '-o' 'libinit.o' '-mtune=i386' '-march=i386'

Code: [Select]
sasc.module$(EXT): $(O_FILES)
  echo Making $@...
- $(CC) -nostartfiles $(LINK) -o $@  $(O_FILES) -lamiga
+ $(CC) -nostartfiles -static $(LINK) -o $@  $(O_FILES) -lamiga

i manualy added the changes to makefile and forgottoen the delete extra space at (-static $(LINK) -o $@  space $(O_FILES) -lamiga) that blank space made difference , sorry..

now i am getting

Making sasc.module...
gcc -static -O3 -s -nostartfiles -o sasc.module sasc.module.o libinit.o StartUp.o -lamiga -llibinit -lautoinit
There are undefined symbols in 'sasc.module sasc.module.o':
cl
AmIDE_API_GetClass
MODULE_Dispatcher
make: *** [sasc.module] Error 1
« Last Edit: October 23, 2021, 03:45:54 PM by serk118uk »

Lets Build Not Destroy...


deadwood

  • AROS Developer
  • Legendary Member
  • *****
    • Posts: 1138
    • Karma: +107/-0
Reply #10 on: October 23, 2021, 04:28:34 PM
The errors you are getting right now are connected with a fact that sasc.module.o now becomes somehow part of a binary name instead of object that is to be linked together, see this:

There are undefined symbols in 'sasc.module sasc.module.o':

What looks like an empty space between these two names, probably is some invisible character.

As with regards to initial problem, I don't know if you are using a compile that had a proper support for -static. collect-aros line shows that you are linking in with -larosc

 collect-aros --sysroot=/Development -m elf_i386 -L/Development/lib -o sasc.module sasc.module.o -s -L/Development/lib/gcc/i386-aros/4.6.4 -L/Development/lib/gcc/i386-aros/4.6.4/../../../../i386-aros/lib -L/Development/lib/gcc/i386-aros/4.6.4/../../.. -L/Development/lib libinit.o StartUp.o -lamiga -llibinit -lautoinit -lgcc -lmui -larossupport -lamiga -larosc

arosc.library doesn't work correctly with shared libraries / modules. The unresolved PROGRAM/LIBS symbols you are getting are most likely coming from arosc.library startup code that gets linked in. If you can't make the -static work, your only option is to fake /Development/lib/libarosc.a into an empty linklib. Once it is empty, the C functions won't be resolved


BTW, this is how collect aros parameters look with my compiler:

COLLECT_GCC_OPTIONS='-static' '-O2' '-s' '-nostartfiles' '-v' '-o' 'sasc.module' '-mtune=i386' '-march=i386'
 collect-aros --sysroot=/System/Development/bin/../../Development -m elf_i386 -L/System/Development/bin/../../Developmen
t/lib -o sasc.module -s -L/System/Development/bin/../lib/gcc/i386-aros/4.6.4 -L/System/Development/bin/../lib/gcc -L/Sys
tem/Development/bin/../lib/gcc/i386-aros/4.6.4/../../../../i386-aros/lib -L/System/Development/bin/../lib/gcc/i386-aros/
4.6.4/../../.. -L/System/Development/bin/../../Development/lib sasc.module.o StartUp.o libinit.o -lamiga -lgcc --start-g
roup -lmui -larossupport -lamiga -lcodesets -lkeymap -lexpansion -lcommodities -ldiskfont -lasl -lmuimaster -ldatatypes
-lcybergraphics -lworkbench -licon -lintuition -lgadtools -llayers -laros -lpartition -liffparse -lgraphics -llocale -ld
os -lutility -loop -lexec -lautoinit -llibinit -lstdc.static --end-group -lgcc

Try also '-noarosc' switch together with '-static' (but I don't remember if the old compiler had that -noarosc switch)



serk118uk

  • Member
  • ***
    • Posts: 158
    • Karma: +64/-0
Reply #11 on: October 25, 2021, 12:47:25 AM
The errors you are getting right now are connected with a fact that sasc.module.o now becomes somehow part of a binary name instead of object that is to be linked together, see this:

There are undefined symbols in 'sasc.module sasc.module.o':

What looks like an empty space between these two names, probably is some invisible character.

As with regards to initial problem, I don't know if you are using a compile that had a proper support for -static. collect-aros line shows that you are linking in with -larosc

 collect-aros --sysroot=/Development -m elf_i386 -L/Development/lib -o sasc.module sasc.module.o -s -L/Development/lib/gcc/i386-aros/4.6.4 -L/Development/lib/gcc/i386-aros/4.6.4/../../../../i386-aros/lib -L/Development/lib/gcc/i386-aros/4.6.4/../../.. -L/Development/lib libinit.o StartUp.o -lamiga -llibinit -lautoinit -lgcc -lmui -larossupport -lamiga -larosc

arosc.library doesn't work correctly with shared libraries / modules. The unresolved PROGRAM/LIBS symbols you are getting are most likely coming from arosc.library startup code that gets linked in. If you can't make the -static work, your only option is to fake /Development/lib/libarosc.a into an empty linklib. Once it is empty, the C functions won't be resolved


BTW, this is how collect aros parameters look with my compiler:

COLLECT_GCC_OPTIONS='-static' '-O2' '-s' '-nostartfiles' '-v' '-o' 'sasc.module' '-mtune=i386' '-march=i386'
 collect-aros --sysroot=/System/Development/bin/../../Development -m elf_i386 -L/System/Development/bin/../../Developmen
t/lib -o sasc.module -s -L/System/Development/bin/../lib/gcc/i386-aros/4.6.4 -L/System/Development/bin/../lib/gcc -L/Sys
tem/Development/bin/../lib/gcc/i386-aros/4.6.4/../../../../i386-aros/lib -L/System/Development/bin/../lib/gcc/i386-aros/
4.6.4/../../.. -L/System/Development/bin/../../Development/lib sasc.module.o StartUp.o libinit.o -lamiga -lgcc --start-g
roup -lmui -larossupport -lamiga -lcodesets -lkeymap -lexpansion -lcommodities -ldiskfont -lasl -lmuimaster -ldatatypes
-lcybergraphics -lworkbench -licon -lintuition -lgadtools -llayers -laros -lpartition -liffparse -lgraphics -llocale -ld
os -lutility -loop -lexec -lautoinit -llibinit -lstdc.static --end-group -lgcc

Quote
Try also '-noarosc' switch together with '-static' (but I don't remember if the old compiler had that -noarosc switch)

Current compiler won't accept-noarosc switch

I have written new makefile to avoid extra characters ,spaces  and error back to unresolved PROGRAM/LIBS.

Quote
your only option is to fake /Development/lib/libarosc.a into an empty linklib. Once it is empty,

Can you open up bit more , you mean a empty arosc.a and just swich them around until I compile this plugin..

Thanks deadwood..(BTW I am flying sorry for late response)

Lets Build Not Destroy...


deadwood

  • AROS Developer
  • Legendary Member
  • *****
    • Posts: 1138
    • Karma: +107/-0
Reply #12 on: October 25, 2021, 05:33:58 PM
Ok, I have a simpler workaround:

add -nodefaultlibs like this:

Code: [Select]
LINK := $(OPTIMIZE) -s -nostartfiles -nodefaultlibs
This should remove all automatically added libraries and now you will have to add them manually. Here is how I did it:

Code: [Select]
$(CC) $(LINK) -o $@ $(O_FILES) -lamiga -lstdc.static -lgcc



serk118uk

  • Member
  • ***
    • Posts: 158
    • Karma: +64/-0
Reply #13 on: October 26, 2021, 01:21:23 AM
Ok, I have a simpler workaround:

add -nodefaultlibs like this:

Code: [Select]
LINK := $(OPTIMIZE) -s -nostartfiles -nodefaultlibs
This should remove all automatically added libraries and now you will have to add them manually. Here is how I did it:

Code: [Select]
$(CC) $(LINK) -o $@ $(O_FILES) -lamiga -lstdc.static -lgcc

Hi deadwood ,

your workaround WORKS without single error thanks for your help..


makefile (i written one during the flight lol) just simple makefile
Code: [Select]
#simple makefile
CC=gcc
CFLAGS=-O2 -s -DNO_INLINE_STDARG -I./api/ -I../api/ -I../modules/api/ -I../amide/modules/api/amide/
LDFLAGS=$(CFLAGS) -nostartfiles -nodefaultlibs -lamiga -lstdc.static -lgcc
EXE=plugins/test.plugin

# Objects
OBJS = StartUp.o \
LibInit.o \
sasc_module.o

all: $(EXE)

clean:
rm -f *.o $(EXE)

$(EXE): $(OBJS)
echo Making $@..
$(CC) -o $(EXE) $(OBJS) $(LDFLAGS)

i added here incase if anyone else ever come cross to this kind of problem and added  "__LIBS__symbol_set_handler_missing" to title for AE search to grab this topic. ..

thank you deadwood...
« Last Edit: October 26, 2021, 01:30:49 AM by serk118uk »

Lets Build Not Destroy...


deadwood

  • AROS Developer
  • Legendary Member
  • *****
    • Posts: 1138
    • Karma: +107/-0
Reply #14 on: October 26, 2021, 07:58:27 AM
I'm glad it worked :) Have fun with development!