jayduhon / inferno-os

Automatically exported from code.google.com/p/inferno-os
2 stars 0 forks source link

Build Error under OSX Tiger #270

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
normal build. emu.c fails with multiply defined 'getfsr'/'setfsr'.
Works under 10.6 on 386

FIX is to remove include 'fpuctl.h' on the PPC version, but that causes 386 
version to fail.

What is the expected output? What do you see instead?
successful compile of emu.c

Which operating system are you using?
OSX 10.4 (Tiger) on PPC
gcc  4.0

Please provide any additional information below.

Details of working and non-working systems, and Error output.
=========================================

mini-too:inferno steve$  uname -prs;uname -v
Darwin 10.8.0 i386
Darwin Kernel Version 10.8.0: Tue Jun  7 16:33:36 PDT 2011; 
root:xnu-1504.15.3~1/RELEASE_I386

mini-too:inferno steve$ hg status |grep -v -e '^? ' -e '^A fonts/' -e '^M dis' 
-e '^M MacOSX/386/bin'
M libinterp/runt.h
M mkconfig

## I think this is an autogenerated file ##
mini-too:inferno steve$ hg diff libinterp/runt.h
diff -r 6cf8bf8ff236 libinterp/runt.h
--- a/libinterp/runt.h  Sat Aug 20 14:02:37 2011 -0400
+++ b/libinterp/runt.h  Mon Aug 22 13:54:27 2011 +1000
@@ -1,3 +1,5 @@
+#pragma hjdicks x4
+#pragma pack x4
 typedef struct Sys_Qid Sys_Qid;
 typedef struct Sys_Dir Sys_Dir;
 typedef struct Sys_FD Sys_FD;
@@ -3998,3 +4000,5 @@
 #define Freetype_PATH "$Freetype"
 #define Freetype_STYLE_ITALIC 1
 #define Freetype_STYLE_BOLD 2
+#pragma pack off
+#pragma hjdicks off

=========================================

Mac-mini:~/src/inferno steve$ uname -prs;uname -v
Darwin 8.11.0 powerpc
Darwin Kernel Version 8.11.0: Wed Oct 10 18:26:00 PDT 2007; 
root:xnu-792.24.17~1/RELEASE_PPC

Mac-mini:~/src/inferno steve$ hg status |grep -v -e '^? ' -e '^A fonts/' -e '^M 
dis' -e '^M MacOSX/power/bin'
M emu/MacOSX/os.c
M mkconfig

Mac-mini:~/src/inferno steve$ hg diff  emu/MacOSX/os.c
diff -r 6cf8bf8ff236 emu/MacOSX/os.c
--- a/emu/MacOSX/os.c   Sat Aug 20 14:02:37 2011 -0400
+++ b/emu/MacOSX/os.c   Mon Aug 22 13:53:22 2011 +1000
@@ -10,7 +10,7 @@
 #include       "error.h"

 #include <raise.h>
-#include <fpuctl.h>
+/* #include <fpuctl.h> */

 #undef _POSIX_C_SOURCE 
 #undef getwd

Mac-mini:~/src/inferno steve$ hg revert emu/MacOSX/os.c
Mac-mini:~/src/inferno steve$ hg diff  emu/MacOSX/os.c

Mac-mini:~/src/inferno steve$ mk all
## snip loads##
cc -arch ppc -multiply_defined suppress -o o.emu ...

/usr/bin/ld: multiple definitions of symbol _getfsr
os.o definition of _getfsr in section (__TEXT,__text)
/Users/steve/src/inferno/MacOSX/power/lib/libmath.a(FPcontrol-MacOSX.o) 
definition of _getfsr in section (__TEXT,__text)
/usr/bin/ld: multiple definitions of symbol _setfcr
os.o definition of _setfcr in section (__TEXT,__text)
/Users/steve/src/inferno/MacOSX/power/lib/libmath.a(FPcontrol-MacOSX.o) 
definition of _setfcr in section (__TEXT,__text)
/usr/bin/ld: multiple definitions of symbol _setfsr
os.o definition of _setfsr in section (__TEXT,__text)
/Users/steve/src/inferno/MacOSX/power/lib/libmath.a(FPcontrol-MacOSX.o) 
definition of _setfsr in section (__TEXT,__text)
collect2: ld returned 1 exit status

Original issue reported on code.google.com by stevej...@gmail.com on 22 Aug 2011 at 4:48

GoogleCodeExporter commented 9 years ago
Upgraded O/S to 10.5.8 and Xcode from 2.? to 3.1.

Now works.

I believe those functions in "fpuctl.h" should be "static" at least, possibly 
"static __inline__" like others in the file.

Original comment by stevej...@gmail.com on 26 Aug 2011 at 2:27

GoogleCodeExporter commented 9 years ago
My mistake, not fixed...

Thought I'd reverted "os.c", but hadn't.

Started from a fresh install into /usr/inferno, "hg pull -uv", "mk install", 
then fail the same conflict:

ld: duplicate symbol _setfcr in 
/usr/inferno/MacOSX/power/lib/libmath.a(FPcontrol-MacOSX.o) and os.o

gcc --version
powerpc-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5493)
Copyright (C) 2005 Free Software Foundation, Inc.

Original comment by stevej...@gmail.com on 26 Aug 2011 at 5:44

GoogleCodeExporter commented 9 years ago
The functions are static in my copy of fpuctl.h

Original comment by Charles....@gmail.com on 26 Aug 2011 at 10:51

GoogleCodeExporter commented 9 years ago
sorry: it wasn't clear that "my copy" meant "the mercurial archive that's the 
primary for googlecode and there aren't any changes noted"

Original comment by Charles....@gmail.com on 26 Aug 2011 at 10:53

GoogleCodeExporter commented 9 years ago
inferno-os@googlecode.com wrote on 27/08/11 8:57 AM:

In my up-to-date version, the 386 include file has 'static' functions,
the powerpc doesn't.

==============================================================
Mac-mini:inferno steve$ pwd
/usr/inferno

Mac-mini:inferno steve$ hg pull
pulling from https://inferno-os.googlecode.com/hg
searching for changes
no changes found

Mac-mini:inferno steve$ less MacOSX/386/include/fpuctl.h
MacOSX/power/include/fpuctl.h

==========================
/*
 * Linux 386 fpu support
 * Mimic Plan9 floating point support
 */

static void
setfcr(ulong fcr)
---
static ulong
getfcr(void)
{
---
static ulong
getfsr(void)
{
---
static ulong
getfsr(void)
{
----
static void
setfsr(ulong fsr)
{
==========================

versus

==========================
/*
 * MacOSX/Darwin ppc fpu support
 * Mimic Plan9 floating point support
 */

#include <architecture/ppc/fp_regs.h>

static __inline__ ulong
getfcr(void)
{
---
ulong
getfsr(void)
{
---
void
setfsr(ulong fsr)
{

Original comment by stevej...@gmail.com on 27 Aug 2011 at 12:46

GoogleCodeExporter commented 9 years ago
This is still an issue
As mentioned earlier the attached patch sets the functions declared in 
MacOSX/power/include/fpuctl.h to static __inline__ 
This resolved the build issue I experienced when trying to build the latest 
source on OS X 10.4.11 running on a PowerBook G4

You can confirm the functions are not set to static from here
https://code.google.com/p/inferno-os/source/browse/MacOSX/power/include/fpuctl.h

Original comment by ventur...@gmail.com on 14 Jun 2014 at 11:21

Attachments: