Login
Username:

Password:

Remember me



Lost Password?

Register now!
Sections
Who's Online
49 user(s) are online (39 user(s) are browsing Forums)

Members: 0
Guests: 49

more...
Support us!
Recent OS4 Files
OS4Depot.net



(1) 2 »


adtools
Just popping in
Joined:
12/16 8:42
From Czech Republic
Posts: 53
Hi

I installed latest adtools, set GCC assign and PATH according to readme but I'm receiving a lot of errors about undefined reference to __gthread* even on simplest source, like:
/Work/adtools/bin/../lib/gcc/ppc-amigaos/8.1.0/clib2/libgcc_eh.a(unwind-sjlj.o): In function `_Unwind_SjLj_GetContext':
/var/lib/jenkins/workspace/native-gcc-8/gcc/repo/libgcc/unwind-sjlj.c:147: undefined reference to 
`__gthread_getspecific'
/var/lib/jenkins/workspace/native-gcc-8/gcc/repo/libgcc/unwind-sjlj.c:147: undefined reference to `__gthread_getspecific'
/var/lib/jenkins/workspace/native-gcc-8/gcc/repo/libgcc/unwind-sjlj.c:147undefined reference to `__gthread_getspecific'
/var/lib/jenkins/workspace/native-gcc-8/gcc/repo/libgcc/unwind-sjlj.c:147: undefined reference to 
`__gthread_getspecific'
/var/lib/jenkins/workspace/native-gcc-8/gcc/repo/libgcc/unwind-sjlj.c:147: undefined reference to `__gthread_getspecific'
/SDK/clib2/lib/libc.a(stdlib_program_name.o): In function `stdlib_program_name_init_ctor':
stdlib_program_name.c:(.text+0xe4): undefined reference to 
`GetProgramName'


am I missing something? some flag maybe? I'm unable to find any clues regarding this

thanks in advance

   Report Go to top

Re: adtools
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5389
Latest gcc have support of native amigaos threads, which is didn't turn "on" by default (as was in testing, probabaly Sebastian will do it later), but then you also can't link without them. So for now, if you want to compile anything which use c++ / threads and stuff, you need to do it by adding : "-athread=native" option, as well as adding at end "-lpthread".

See other ones also step in into the same problem at begining: https://github.com/sba1/adtools/issues/62

_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: adtools
Just can't stay away
Joined:
2006/11/30 11:30
From Finland
Posts: 1651
@NoCache

You need to install a newer clib2 build:

http://os4depot.net/index.php?functio ... nt/library/misc/clib2.lha

The one that was included with the SDK is broken.

http://forum.hyperion-entertainment.c ... 3194&hilit=getprogramname

   Report Go to top

Re: adtools
Just popping in
Joined:
12/16 8:42
From Czech Republic
Posts: 53
@salass00 @kas1e
Thanks, I'm on it )

   Report Go to top

Re: adtools
Quite a regular
Joined:
2007/2/27 10:47
From Gravity well
Posts: 648
Is clib2 now preferable over newlib?

   Report Go to top

Re: adtools
Just can't stay away
Joined:
2006/11/30 11:30
From Finland
Posts: 1651
@Thematic

Not really, but it's good to have options though.

   Report Go to top

Re: adtools
Just can't stay away
Joined:
2006/11/30 11:30
From Finland
Posts: 1651
@NoCache

Unless the software in question actually uses c++ threads you might be better off using -athread=single.

Also clib2 is not thread safe so if the code does use some form of multithreading you will want to use newlib or clib2-ts which is the thread safe variant of clib2.

   Report Go to top

Re: adtools
Just popping in
Joined:
12/16 8:42
From Czech Republic
Posts: 53
@all

It helped with my code, it now works as it should.

I will try to recompile the DevilutionX code, but it uses cmake which is hardcoded to use newlib while adtools should be used by clib2, I wonder if that might be an issue or not.
No idea if cmake is compatible with clib as well

Thanks with adtools configuration :)

   Report Go to top

Re: adtools
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5389
@NoCache
Adtools not forced to use clib2, i use it everywhere with newlib :) If you need specially clib2 by some reassons, you always can add flag like "-mcrt=clib2" when compile objects.

Also if you use CMAKE, you should be on crosscompiler, with native one you will have all sort of weird issues.

For cmake you can add that clib2 flag when you build makefiles, or when all builds, find out necessary makefile, and manually add that flag to cflags.

_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: adtools
Just popping in
Joined:
12/16 8:42
From Czech Republic
Posts: 53
@kas1e

I have makefiles already generated by cmake with SDK's version of GCC so I will probably try to just modift it for adtools and see how it goes and I will stick with newlib then :)

   Report Go to top

Re: adtools
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5389
Keep in mind, if you want to modify makefile to use clib2, then pretty possible you may have some problems when you will build your objects , as some of functionality which present in newlib, do not present in clib2.

_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: adtools
Just popping in
Joined:
12/16 8:42
From Czech Republic
Posts: 53
@kas1e

I think I will stay with newlib,it was build previously succesfully and when You wrote adtools can be safely used with newlib, I don't see any reason to move to clib then :)

   Report Go to top

Re: adtools
Just popping in
Joined:
12/16 8:42
From Czech Republic
Posts: 53
I got those gthread errors while compiling DevilutionX, so I added -athread=native -lpthreads flags and now I got this:
[  2%] Linking CXX executable devilution
ld
cannot find gthr-amigaos-native.oNo such file or directory
ld
Warningalignment 4 of symbol `channel' in CMakeFiles/devilution.dir/Stub/sound.cpp.obj is smaller than 8 in /SDK/local/newlib/lib/libSDL2_mixer.a(playmidi.o)
gmake[2]: *** [devilution] Error 1
gmake[1]: *** [CMakeFiles/devilution.dir/all] Error 2
gmake: *** [all] Error 2


the library is present in GCC:lib/gcc/ppc-amigaos/8.1.0/ I also tried it to link it to gcc:lib and /SObjs, include the folder with -L flag but now use...

Actually I got error about missing lgcc library, I linked it into GCC:lib folder and now it needs gthr-amigaos-native.o which is unable to find.

   Report Go to top

Re: adtools
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5389
@NoCache
Never seen that error, but seems indeed some mess with libs you tried to link with.

Usually, the rulez i follow all the time when compiling/port something big are:

1). Never use sobjes. That mean no "-use-dynld" flags or kind, no "dynamic". Preferable always set "-static" at the begining of linking line.

2). I never trust the how configure or cmake create for me final linking line. It most of time have wrong order, or put not what i need to. So, i always had to adapt makefiles (be it makefiles done via ./configure, or via cmake).

For example, that the final linking line i have for one game (newlib / latest adtools , via crosscompiler on cygwin):

ppc-amigaos-gcc  ..there_objects... -o game.exe -athread=native -static -lSDL2_image -lpng -lfreetype -lSDL2_mixer -lmikmod -lmodplug -lflac -lsmpeg2 -lvorbisfile -lvorbis -logg -lSDL2 -lgl4es -lGLU -lpthread -lauto -lstdc++ -lz -lm


If you didn't mess with the GCC installation (which is possible, like you maybe copy some clib2 library to newlib directory, or re-copy includes somewhere), then all should be fine.

In end, to be sure what your final linking line looks like, just do "cmake VERBOSE=1" , so you will see real linking line, and what flags it have and what libs and in which order it tried to put.


ps. why its gcc 8.1.0 ? Should be 8.2.0. Are you on crosscompiler or taking some auto-build native version from bintray.com ?

_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: adtools
Just popping in
Joined:
12/16 8:42
From Czech Republic
Posts: 53
@kas1e

Indeed, I probably messed up the libraries while experimenting, I will rather reinstall it.
I'm in AmigaOS, using abc-shell, cmake, sdk and adtools it looked as best option to me...
Downloaded latest adtools package available which gives me version 8.1.0, but I will double check that
I don't have crosscompile environment set up but is seems to be better option as I can see
thanks for the linking line :)

   Report Go to top

Re: adtools
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5389
@NoCache
Crosscompiler vs native build it's like sky and earth. With crosscompiler you never-ever have any issues with any of that things like cmake, autoconf, automake, configure, shells, bisons, yawns, perls, seds, pythons, and all sort of things which can be used by ppls when they do things for unixes. And as bonus, its much faster compiling.

I have 2 versions setup : MSYS2 one, and CYGWIN one, CYGWIN one is more easy to use, where everything always works. You of course will need to know how to spawn right arguments to cmakes/configures/etc, so they will take not the host gcc, but crosscompiler gcc, but that all more or less easy and will save lot of your time.

As for 8.1.0, it seems something wrong with those automatic builds from bintray.com.

_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: adtools
Just popping in
Joined:
12/16 8:42
From Czech Republic
Posts: 53
@kas1e

Found Your guide on os4coding so I will going through
I wonder however, how is debugging working ? I will probably see soon enough :)

   Report Go to top

Re: adtools
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5389
@NoCache
That guide for MSYS, but if you want to use CMAKE and all that stuff with no problems, then build it for CYGWIN instead (you will have no pain with cmake and win32 pathes like double backslaches and all that C:\ and co).

As for debugging, to say it truth: there is no usable for real debuggers on amigaos4 (gdb buggy, db101 unfinished). So the only debugging techniq you can use are good old prinfs + serial cable . And of course GR with crashlogs (to have good information in crashlogs, you need to build your app with -gstabs). There is some article i wrote some time ago which will help to sort things out about debugging and stuff:

https://wiki.amigaos.net/wiki/Advanced_Serial_Debugging_Guide

+
https://wiki.amigaos.net/wiki/Debug_Kernel
https://wiki.amigaos.net/wiki/Exec_Debug

_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: adtools
Just popping in
Joined:
12/16 8:42
From Czech Republic
Posts: 53
Finally I got the crosscompiler working after two days of installations, reinstallations debugging etc...

Now maybe little stupid questions, but...
Include files the project I'm trying to compile needs, like SDL,GL etc, should I install them with cygwin installator or download the libs from os4depot and put them to crosscompiler directory somewhere?
Also Cmake on amiga has it's own platform specification file.. should I use this one, default one that it is using by default or write new one?
Are there any simple tutorials for this maybe? It would be handy for beginners like me to see the correct process steps.

Thanks

   Report Go to top

Re: adtools
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5389
@NoCache
Cygwin's installer need it only for installing necessary host's tools (all those cmakes, autotools, autoconfs, etc). For all specific amiga things like libraries and co you of course need to use ones from os4depot, as those ones which you install for cygwin are for win32.

If you install everything well, you should now have /usr/local/amiga/ppc-amigaos/SDK/ directory, in which all the SDK and gcc files placed. When you will download any developer library from os4depot, you will need to install it here. I prefer to do everything manually, just via total commander going in one panel to the content of archive, and in other one going to c:cygwin/usr/local/amiga/ppc-amigaos/SDK/ or so.

Every developer archive from os4depot (almost all of them), have structure where root of content are SDK directory, so you need to copy libs and headers right as they placed in archive. Newlib ones to newlib, clib2 ones to clib2, etc,etc,without messing it around in all the places.

For first you may try to download let's say SDL2 developer archive, install it, write simple test case programm, compile it via "ppc-amigaos-gcc -static -athread=native test.c -o test -lSDL2 -lpthread" and check if all works fine and runs on aos4.

Once you done with it (which will mean you got the idea of how all structured, etc), you can go deeper by porting things.

There is 2 ways mostly when you port stuff: old one via ./configure way, and new one via CMAKE.

When you use ./configure, then you add 3 specific things at begining always:

./configure --build=x86_64 --host=ppc-amigaos --target=ppc-amigaos

then come original flags. Those first 3 options will make ./configure know that we on cross-compiler, and that we build ppc-amigaos binaries.

--build=x86_64 mean of course if you on x86_64.

Now, next thing is CMAKE. Usually i do things like this:

Go to the unpacked project, and:

Quote:


# mkdir build
# cd build

# cmake \
-DCMAKE_SYSTEM_NAME=Generic \
-DCMAKE_SYSTEM_VERSION=1 \
-DCMAKE_C_COMPILER="/usr/local/amiga/bin/ppc-amigaos-gcc" \
-DCMAKE_CXX_COMPILER="/usr/local/amiga/bin/ppc-amigaos-g++" \
-DCMAKE_LINKER="/usr/local/amiga/bin/ppc-amigaos-ld" \
-DCMAKE_AR="/usr/local/amiga/bin/ppc-amigaos-ar" \
-DCMAKE_RANLIB="/usr/local/amiga/bin/ppc-amigaos-ranlib" \
-DCMAKE_FIND_ROOT_PATH="/usr/local/amiga/ppc-amigaos/" \
..



Of course that mean without specific options to project itself, those ones are necessary as for ./configure things above : to show to cmake that we on crosscompiler, which gcc binaries will be used and from where. That line will generate necessary makefiles (and you have no needs to any platform specific files, all will be generated as need it). And then just "make" and all things will be inside of "build" directory (where will be and makefiles and stuff, which you will need to alter to have normall final linking line).


As for articles for beginners , there are some 10 years old guide from SpotUP, which quite dated, but still can give some clue as well.

Online there:
http://www.amigans.net/modules/AMS/article.php?storyid=18

And there in form of amiga.guide:
http://os4depot.net/share/document/manual/spots-pfd.lha


I plan to make some new one which will help beginners and cover all modern issues i faced with, so if you have any more questions just ask.


Edited by kas1e on 2019/2/10 11:14:20
Edited by kas1e on 2019/2/10 11:16:12
_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top


(1) 2 »



[Advanced Search]


Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project