English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language

 
 
Thread Tools
Old 25 November 2011, 05:22   #1
tygre
Returning fan!
 
tygre's Avatar
 
Join Date: Jan 2011
Location: Montréal, QC, Canada
Posts: 1,434
GCC on Linux and MathIeeeDoubTrans

Dear all!

Could someone help me understand why what I am doing works

I am compiling PHP v4.2.3. The maths functions "used" by PHP, such as "atan2", were leading to compilation errors. I solved these errors by adding the options "-m68020 -m68881" to GCC . Yet, two compilation errors still remained, for "asinh" and "acosh":

Code:
./.libs/libphp4cli.a(math.o)(.text+0x1150): In function `_zif_asinh':
/php-4.2.3/ext/standard/math.c:329: undefined reference to `_asinh'
./.libs/libphp4cli.a(math.o)(.text+0x1230): In function `_zif_acosh':
/php-4.2.3/ext/standard/math.c:345: undefined reference to `_acosh'
Digging up, I found that "configure" was telling me that it cannot find the math library:

Code:
configure:5776: checking for sin in -lm
configure:5795: /usr/local/amiga/bin/m68k-amigaos-gcc.exe -m68020 -m68881 -o conftest -g -O2   conftest.c -lm   1>&5
/usr/local/amiga/lib/gcc/m68k-amigaos/3.4.0/../../../../m68k-amigaos/bin/ld: cannot find -lm
So, I thought, GCC cannot find "libm.a", in which "asinh" and "acosh" must be defined, so let's give it it one and I added:

Code:
LDFLAGS="-L/usr/local/amiga/m68k-amigaos/lib/libb/libm020/libm881/libnix/"
which led to "configure" to complain about MathIEEEDoubTrans:

Code:
configure:5776: checking for sin in -lm
configure:5795: /usr/local/amiga/bin/m68k-amigaos-gcc.exe -m68020 -m68881 -o conftest -g -O2  -L/usr/local/amiga/m68k-amigaos/lib/libb/libm020/libm881/libnix/ conftest.c -lm   1>&5
/usr/local/amiga/m68k-amigaos/lib/libb/libm020/libm881/libnix//libm.a(sin.o)(.text+0x4):sin.o: undefined reference to `___MathIeeeDoubTransBase'
Then, I found the excellent Geek Gadgets documentation, removed the "LDFLAGS", added the option "-ixemul", and and "configure" is happy because it finds "sin":

Code:
configure:5776: checking for sin in -lm
configure:5795: /usr/local/amiga/bin/m68k-amigaos-gcc.exe -m68020 -m68881 -noixemul -o conftest -g -O2   conftest.c -lm   1>&5
... but... why? What could be the alternative then if I wanted to use "ixemul"?

And, of course, I cannot compile PHP without "ixemul" because some functions are then missing, such as "strtod": so, at this point either I have "sin" and other compilation errors or no compilation errors but for the missing "asinh" and "acosh"... (Interestingly, "math.c" also contains a call to "atanh", which is not causing any compilation error...)

How can I link to these functions?

Thanks to explain a newbie!
Tygre

Last edited by tygre; 25 November 2011 at 05:48. Reason: Added some more information...
tygre is offline  
Old 26 November 2011, 06:44   #2
NovaCoder
Registered User
 
NovaCoder's Avatar
 
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,400
Hiya,

I'm no expert in this stuff but when you're compiling stuff that was coded for UNIX (eg PHP) you normally have to use the crappy old unix emulation lib ixemul (because the Amiga libs lack many of the Unix library functions).

I don't use ixemul in my code as it slows everything down, if I'm missing a couple of UNIX methods I just have to code them into my application.

It also looks like PHP may need an FPU.

I normal use GCC C++ with these options:

-fno-rtti
-m68040
-O2
-finline-function
NovaCoder is offline  
Old 27 November 2011, 04:20   #3
tygre
Returning fan!
 
tygre's Avatar
 
Join Date: Jan 2011
Location: Montréal, QC, Canada
Posts: 1,434
Quote:
Originally Posted by NovaCoder View Post
I don't use ixemul in my code as it slows everything down, if I'm missing a couple of UNIX methods I just have to code them into my application.

Hi there!

Thanks for the info. I begin to understand... With your help and this page, which states that:

If -noixemul is specified on the GCC command line, the executable created will not require ixemul.library -- it will use the static linker library LibNIX instead. This library is very Amiga-like and SAS/C-like, so it is convenient for the AmigaOS-specific development.

I understand that, when I put "-noixemul", "configure" uses LibNIX, and thus can find "sin" but that it cannot find "sin" without "-noixemul" because... "sin" is not present in "ixemul"?

Also, I still don't understand why are "asinh" and "acosh" missing from "ixemul" but not "atanh". I must be overlooking something there... Any idea?

Quote:
Originally Posted by NovaCoder View Post
-fno-rtti
-m68040
-O2
-finline-function
Thanks, will try that too!

Cheers!
Yann
tygre 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
Porting to Tiny Core Linux and Puppy Linux lorenzos support.FS-UAE 1 05 January 2013 16:13
StormC V4 gcc - ixnet how to? NovaCoder Coders. C/C++ 1 28 February 2012 03:07
GCC and GCCFindHit tygre Coders. Language 2 20 February 2012 16:45
LouiSe's GCC Environment Morbane request.Apps 0 27 December 2011 08:02
StormC4/GCC JoJo Coders. General 0 28 October 2002 09:38

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 13:30.

Top

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