Bug 83806

Summary: Can not compile /usr/src/lib/msun/amd64/fenv.c at make buildworld.
Product: Base System Reporter: KOBAYASHI Hidenobu <kobayasi>
Component: amd64Assignee: freebsd-amd64 (Nobody) <amd64>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 6.0-BETA1   
Hardware: Any   
OS: Any   

Description KOBAYASHI Hidenobu 2005-07-20 20:50:14 UTC
  I can not comple /usr/src/lib/msun/amd64/fenv.c as follow commands.
=== START: COMMAND AND ERROR MESSAGES ===
eins# pwd
/usr/src/lib/msun/amd64
eins# make -f Makefile.inc fenv.o
/usr/local/libexec/ccache/cc -O2 -fno-strict-aliasing -pipe  -c fenv.c
fenv.c:35: warning: braces around scalar initializer
fenv.c:35: warning: (near initialization for `__fe_dfl_env.__control')
fenv.c:35: warning: large integer implicitly truncated to unsigned type
fenv.c:36: warning: excess elements in scalar initializer
fenv.c:36: warning: (near initialization for `__fe_dfl_env.__control')
fenv.c:37: warning: excess elements in scalar initializer
fenv.c:37: warning: (near initialization for `__fe_dfl_env.__control')
fenv.c:38: warning: braces around scalar initializer
fenv.c:38: warning: (near initialization for `__fe_dfl_env.__control')
fenv.c:38: warning: excess elements in scalar initializer
fenv.c:38: warning: (near initialization for `__fe_dfl_env.__control')
fenv.c:38: warning: excess elements in scalar initializer
fenv.c:38: warning: (near initialization for `__fe_dfl_env.__control')
fenv.c:38: warning: excess elements in scalar initializer
fenv.c:38: warning: (near initialization for `__fe_dfl_env.__control')
fenv.c:38: warning: excess elements in scalar initializer
fenv.c:38: warning: (near initialization for `__fe_dfl_env.__control')
fenv.c:38: warning: excess elements in scalar initializer
fenv.c:38: warning: (near initialization for `__fe_dfl_env.__control')
fenv.c:38: warning: excess elements in scalar initializer
fenv.c:38: warning: (near initialization for `__fe_dfl_env.__control')
fenv.c:38: warning: excess elements in scalar initializer
fenv.c:38: warning: (near initialization for `__fe_dfl_env.__control')
fenv.c:39: warning: excess elements in scalar initializer
fenv.c:39: warning: (near initialization for `__fe_dfl_env.__control')
fenv.c:39: warning: excess elements in scalar initializer
fenv.c:39: warning: (near initialization for `__fe_dfl_env.__control')
fenv.c:39: warning: excess elements in scalar initializer
fenv.c:39: warning: (near initialization for `__fe_dfl_env.__control')
fenv.c:39: warning: excess elements in scalar initializer
fenv.c:39: warning: (near initialization for `__fe_dfl_env.__control')
fenv.c:39: warning: excess elements in scalar initializer
fenv.c:39: warning: (near initialization for `__fe_dfl_env.__control')
fenv.c:39: warning: excess elements in scalar initializer
fenv.c:39: warning: (near initialization for `__fe_dfl_env.__control')
fenv.c:39: warning: excess elements in scalar initializer
fenv.c:39: warning: (near initialization for `__fe_dfl_env.__control')
fenv.c:39: warning: excess elements in scalar initializer
fenv.c:39: warning: (near initialization for `__fe_dfl_env.__control')
fenv.c:39: warning: excess elements in scalar initializer
fenv.c:39: warning: (near initialization for `__fe_dfl_env.__control')
fenv.c: In function `fesetexceptflag':
fenv.c:49: error: structure has no member named `__x87'
fenv.c:50: error: structure has no member named `__x87'
fenv.c:51: error: structure has no member named `__x87'
fenv.c:52: error: structure has no member named `__x87'
fenv.c:54: error: structure has no member named `__mxcsr'
fenv.c:55: error: structure has no member named `__mxcsr'
fenv.c:56: error: structure has no member named `__mxcsr'
fenv.c:57: error: structure has no member named `__mxcsr'
fenv.c: In function `fegetenv':
fenv.c:82: error: structure has no member named `__x87'
fenv.c:83: error: structure has no member named `__mxcsr'
fenv.c: In function `feholdexcept':
fenv.c:94: error: structure has no member named `__x87'
fenv.c:96: error: structure has no member named `__mxcsr'
*** Error code 1

Stop in /usr/src/lib/msun/amd64.
=== END: COMMAND AND ERROR MESSAGES ===

So I can not make buildworld.

Fix: The cause of the compile error is in the method of the include of fenv.h. 
    Now include /usr/include/fenv.h but include local fenv.h in same directory.
  
  Please apply the following patch.



const fenv_t __fe_dfl_env = {
        { 0xffff0000 | __INITIAL_FPUCW__,--tv3YiYn2oNW7IPojElY83SG5iF42mKc898Zwa7fM5jy4sPvm
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- fenv.c.orig Thu Mar 17 04:03:45 2005
+++ fenv.c      Thu Jul 21 04:37:50 2005
@@ -29,7 +29,7 @@
 #include <sys/cdefs.h>
 #include <sys/types.h>
 #include <machine/fpu.h>
-#include <fenv.h>
+#include "fenv.h"
How-To-Repeat:   See Description part.
Comment 1 KOBAYASHI Hidenobu 2005-07-24 04:43:37 UTC
I correct Fix parts.

>Fix:
The 1st my report is invalid.

The fact that compiling the fenv.c fails is because the /usr/src/lib/msun/i387/fenv.h is included.
It is correct for the /usr/src/lib/msun/amd64/fenv.h to be included.

When I install the lib32 with the make installworld,
the /usr/include/fenv.h is superscribed with the  /usr/src/lib/msun/i387/fenv.h.

--- START: make installworld log---
 ...

===> lib/msun (install)
install -C -o root -g wheel -m 444   libm.a /usr/lib
install -C -o root -g wheel -m 444   libm_p.a /usr/lib
install -s -o root -g wheel -m 444     libm.so.4 /lib
ln -fs /lib/libm.so.4  /usr/lib/libm.so
install -C -o root -g wheel -m 444  /usr/src/lib/msun/amd64/fenv.h /usr/src/lib/msun/src/math.h
/usr/include

 ...

===> msun (install)
sh /usr/src/tools/install.sh -C -o root -g wheel -m 444   libm.a /usr/lib32
sh /usr/src/tools/install.sh -C -o root -g wheel -m 444   libm_p.a /usr/lib32
sh /usr/src/tools/install.sh -s -o root -g wheel -m 444     libm.so.4 /usr/lib32
ln -fs libm.so.4 /usr/lib32/libm.so
sh /usr/src/tools/install.sh -C -o root -g wheel -m 444  /usr/src/lib/msun/i387/fenv.h /usr/src/
lib/msun/src/math.h /usr/include

--- END: make installworld log ---

Workaround is as follows,
  1. echo "NO_LIB32=yes" >> /etc/make.conf
  2. re-compile and install world.
  3. re-compile and install world. once more.

Best Regards,
-- 
KOBAYASHI Hidenobu
kobayasi@pp.iij4u.or.jp
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2005-11-12 17:16:43 UTC
State Changed
From-To: open->feedback

Is this still a problem with the latest 6-STABLE tree?
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2005-11-14 23:09:33 UTC
State Changed
From-To: feedback->open

Feedback received.
Comment 4 ru freebsd_committer freebsd_triage 2005-11-19 07:33:26 UTC
State Changed
From-To: open->patched

Fixed in 7.0-CURRENT, MFC in 1 week.
Comment 5 ru freebsd_committer freebsd_triage 2005-11-28 19:09:06 UTC
State Changed
From-To: patched->closed

Also fixed in 6.0-STABLE.