English Amiga Board


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

 
 
Thread Tools
Old 14 April 2021, 00:38   #1
alancfrancis
Registered User
 
alancfrancis's Avatar
 
Join Date: Jun 2020
Location: Scotland
Posts: 146
Cross-Compiling and libs

Hi folks,

Another probably-basic question because I'm not very familiar with cross compiling under gcc (I've been using vbcc).

On a bit of a whim I thought I'd see whether I could get ruby building for the classic amiga. The source is downloadable and its a standard configure/make process on most unixy platforms (I'm on an intel Mac).

I have bebbos gcc toolchain installed and working very well for building stuff I wrote myself, no configure step necessary. It lives in /opt/amiga and the /opt/amiga/bin contains eg m68k-amigaos-gcc

I go into the ruby source dir and type

./configure --source m68k-amigaos and I get pretty far through...until.

Code:
configure: error: clock_gettime() or gettimeofday() must exist
Now a quick grep shows me that gettimeofday() exists in (amongst others) clib2 and libnix, so I know its "there", but I'm not familiar enough with configure to understand (a) how its actually deciding it can't find the function and (b) what arguments I need to pass to configure to tell it what it needs to know.

I know its a bit of a niche question, but I figure there's a lot of people here used to doing this kind of stuff :-).

Thanks in advance for any suggestions,

Alan
alancfrancis is offline  
Old 14 April 2021, 01:18   #2
alancfrancis
Registered User
 
alancfrancis's Avatar
 
Join Date: Jun 2020
Location: Scotland
Posts: 146
Just remembered this other post http://eab.abime.net/showthread.php?t=105897 which also had a problem with gettimeofday() :-/. So...

Code:
CFLAGS=-mcrt=clib2  ./configure --host m68k-amigaos
gets me further :-)

Code:
m68k-amigaos/bin/nm: sorry - this program has been built without plugin support
suggests I'm going to go have to play with configure/build on bebbo's toolchain. Its going to be a long night.
alancfrancis is offline  
Old 14 April 2021, 01:32   #3
alancfrancis
Registered User
 
alancfrancis's Avatar
 
Join Date: Jun 2020
Location: Scotland
Posts: 146
Final update of the evening is that I'm now stuck getting it to recognise /opt/amiga/m68k-amigaos/lib/libpthread.a

Code:
checking for pthread_create in -lthr... no
checking for pthread_create in -lpthread... no
checking for pthread_create in -lpthreads... no
checking for pthread_create in -lc... no
checking for pthread_create in -lc_r... no
checking for pthread_create in -lroot... no
configure: WARNING: "Don't know how to find pthread library on your system -- thread support disabled"
have tried messing with LDFLAGS to be super clear about -lpthread but no joy. I think its bedtime :-)
alancfrancis is offline  
Old 14 April 2021, 08:46   #4
bebbo
bye
 
Join Date: Jun 2016
Location: Some / Where
Posts: 680
Quote:
Originally Posted by alancfrancis View Post
Just remembered this other post http://eab.abime.net/showthread.php?t=105897 which also had a problem with gettimeofday() :-/. So...

Code:
CFLAGS=-mcrt=clib2  ./configure --host m68k-amigaos
gets me further :-)

I recommend using -libnix aka -mcrt=nix20 instead of clib2.



Quote:
Originally Posted by alancfrancis View Post
Code:
m68k-amigaos/bin/nm: sorry - this program has been built without  plugin support
suggests I'm going to go have to play with configure/build on bebbo's toolchain. Its going to be a long night.


use the prefixed programs in $PREFIX/bin -> $PREFIX/bin/m68k-amigaos-nm
bebbo is offline  
Old 14 April 2021, 17:51   #5
alancfrancis
Registered User
 
alancfrancis's Avatar
 
Join Date: Jun 2020
Location: Scotland
Posts: 146
@bebbo

I tried -mcrt=nix20 and configure stopped dead at "checking your c compiler is working" :-/.

I hate that I can't find useful information to help me debug this stuff beyond a "it didn't work" error message. I feel like a 5 year old :-)

As regards a different nm I'm not sure how to point at those binaries beyond the --host m68k-amigaos that I am already using ?
alancfrancis is offline  
Old 14 April 2021, 18:15   #6
alancfrancis
Registered User
 
alancfrancis's Avatar
 
Join Date: Jun 2020
Location: Scotland
Posts: 146
I think the nm problem is just a bad error message, it has managed to auto-translate ranlib -> m68k-amigaos-ranlib for example. My thought is that it *is* using the correct binary but in the amiga-gcc/Makefile I see --disable-plugins

https://github.com/bebbo/amiga-gcc/b.../Makefile#L335

hence "this program has been built without plugin support"
alancfrancis is offline  
Old 14 April 2021, 20:52   #7
alancfrancis
Registered User
 
alancfrancis's Avatar
 
Join Date: Jun 2020
Location: Scotland
Posts: 146
So I changed that line in the amiga-gcc Makefile and rebuilt everything with --enable-plugins. On a whim I tried mcrt=nix20 so I could get the right error message to paste here, and I'll be damed but it worked right the way through.

Code:
CFLAGS=-mcrt=nix20 ./configure --host m68k-amigaos --enable-threads=posix
I have no explanation. I can look back in my history and see -mcrt=nix20 fail with

Code:
checking for m68k-amigaos-gcc-nm... m68k-amigaos-gcc-nm
checking for m68k-amigaos-m68k-amigaos-gcc-ranlib... no
checking for m68k-amigaos-gcc-ranlib... m68k-amigaos-gcc-ranlib
checking for m68k-amigaos-gcc... (cached) m68k-amigaos-gcc
checking whether the C compiler works... no
configure: error: in `/Users/acf/work/ruby-3.0.1':
configure: error: C compiler cannot create executables
Anyhoo. configure done. Now to try and build it :-)
alancfrancis is offline  
Old 14 April 2021, 21:05   #8
alancfrancis
Registered User
 
alancfrancis's Avatar
 
Join Date: Jun 2020
Location: Scotland
Posts: 146
Notes mostly for myself and anyone else who tries this later.

First thing I needed to do was define HAVE_GCC_ATOMIC_BUILTINS=1 to make include/ruby/atomic.h happy.

Have now hit an issue where coroutine/ucontext/Context.h is looking for <ucontext.h> which appears to be part of glibc but isn't present in opt/amiga. Investigations continue. :-)

https://github.com/lattera/glibc/blo...sys/ucontext.h

Last edited by alancfrancis; 14 April 2021 at 21:18.
alancfrancis is offline  
Old 19 January 2023, 17:35   #9
nyteshade
Registered User
 
Join Date: Mar 2020
Location: Boulder Creek / USA
Posts: 43
Have you ever figured it out? Curious as I am looking around to see who has accomplished what with regards to Ruby on the Amiga. @alancfrancis
nyteshade 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
Docker and cross compiling for Amiga platforms Marlon_ Coders. General 3 28 June 2019 22:18
Help with gcc cross-compiling MartinW Coders. C/C++ 7 21 April 2017 13:22
Cross compiling to the Amiga with Sozobon RedskullDC Coders. Language 2 08 December 2016 03:25
Cross Compiling / Environment Info Zetr0 Coders. General 10 09 November 2016 20:28
cross-compiling Basic for Amiga nitrofurano Coders. Language 4 19 November 2013 20:47

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:39.

Top

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