Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error occured when compile avian using cygwin 1.7 on Win 7 sp1 #72

Closed
hydra1983 opened this issue Jul 18, 2013 · 17 comments
Closed

Error occured when compile avian using cygwin 1.7 on Win 7 sp1 #72

hydra1983 opened this issue Jul 18, 2013 · 17 comments

Comments

@hydra1983
Copy link
Contributor

Edison@admin-PC /local/src/avian
$ export JAVA_HOME="/cygdrive/c/Program Files/Java/jdk1.6.0_45"

Edison@admin-PC /local/src/avian
$ make
compiling build/windows-i386/tools/type-generator/main-build.o
src/tools/type-generator/main.cpp:11:20: fatal error: stdlib.h: No such file or                  directory
compilation terminated.
makefile:1717: recipe for target `build/windows-i386/tools/type-generator/main-b                 uild.o' failed
make: *** [build/windows-i386/tools/type-generator/main-build.o] Error 1

Edison@admin-PC /local/src/avian
$ apt-cyg show
The following packages are installed:
_autorebase
_update-info-dir
alternatives
base-cygwin
base-files
bash
bzip2
coreutils
cygutils
cygwin
dash
diffutils
dos2unix
editrights
file
findutils
gawk
gcc-mingw-g++
gettext
grep
groff
gzip
ipc-utils
less
libattr1
libbz2_1
libffi6
libgcc1
libgcrypt11
libgmp10
libgmp3
libgnutls26
libgpg-error0
libiconv2
libidn11
libintl8
liblzma5
liblzo2_2
libmpc3
libmpfr4
libncurses10
libncursesw10
libp11-kit0
libpcre0
libpopt0
libreadline7
libstdc++6
libtasn1_3
login
make
man
mingw-binutils
mingw-gcc-core
mingw-gcc-g++
mingw-pthreads
mingw-runtime
mingw-w32api
mingw64-i686-binutils
mingw64-i686-gcc-core
mingw64-i686-gcc-g++
mingw64-i686-runtime
mingw64-i686-winpthreads
mingw64-x86_64-binutils
mingw64-x86_64-gcc-core
mingw64-x86_64-gcc-g++
mingw64-x86_64-runtime
mingw64-x86_64-winpthreads
mintty
rebase
run
sed
tar
terminfo
texinfo
tzcode
vim-minimal
wget
which
xz
zlib0
@joshuawarner32
Copy link
Collaborator

@hydra1983, it looks like you don't have the standard headers properly installed (or, perhaps installed in a strange location). Can you look around your filesystem for stdlib.h?

@hydra1983
Copy link
Contributor Author

After a fresh installation of cygwin on another machine with the same os, I still got this:

edison@edison-PC ~
$ cd /local/src/avian/

edison@edison-PC /local/src/avian
$ make
compiling build/windows-i386/tools/type-generator/main-build.o
cygwin warning:
  MS-DOS style path detected: C:\Program Files\Java\jdk1.6.0_45/include
  Preferred POSIX equivalent is: /cygdrive/c/Program Files/Java/jdk1.6.0_45/incl                                                                                                 ude
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
src/tools/type-generator/main.cpp:11:20: fatal error: stdlib.h: No such file or                                                                                                  directory
compilation terminated.
makefile:1717: recipe for target `build/windows-i386/tools/type-generator/main-b                                                                                                 uild.o' failed
make: *** [build/windows-i386/tools/type-generator/main-build.o] Error 1

edison@edison-PC /local/src/avian
$ export JAVA_HOME="/cygdrive/c/Program Files/Java/jdk1.6.0_45"

edison@edison-PC /local/src/avian
$ make
compiling build/windows-i386/tools/type-generator/main-build.o
src/tools/type-generator/main.cpp:11:20: fatal error: stdlib.h: No such file or                                                                                                  directory
compilation terminated.
makefile:1717: recipe for target `build/windows-i386/tools/type-generator/main-b                                                                                                 uild.o' failed
make: *** [build/windows-i386/tools/type-generator/main-build.o] Error 1

Here are the locations of my "stdlib.h" file
image

@joshuawarner32
Copy link
Collaborator

A quick test of avian on my cygwin install worked fine, and I don't see anything obviously wrong with the location(s) of stdlib.h (the /usr/include/stdlib.h should be the one).

Are you able to compile other software on cygwin?

You might try editing the makefile and adding a "-v" flag to common-cflags - that should give us a little more idea of what's going wrong. Also, build with "make MAKEFLAGS=" to print the exact commands that make is executing.

@hydra1983
Copy link
Contributor Author

Edison@admin-PC /local/src/avian
$ make MAKEFLAGS=
compiling build/windows-i386/tools/type-generator/main-build.o
i686-w64-mingw32-g++ -DPOINTER_SIZE=4 -O0 -g3 -Wall -Wextra -Werror -Wunused-parameter -Winit-self  -Wno-non-virtual-dtor -v -fno-rtti -fno-exceptions -Iclasspath  "-I/cygdrive/c/Program Files/Java/jdk1.6.0_45/include" -Isrc -Ibuild/windows-i386 -Iinclude   -D__STDC_LIMIT_MACROS -D_JNI_IMPLEMENTATION_ -DAVIAN_VERSION=\"0.7\"  -DAVIAN_INFO="\"\""  -DUSE_ATOMIC_OPERATIONS -DAVIAN_JAVA_HOME=\"\"  -DAVIAN_EMBED_PREFIX=\"c:/avian-embedded\" -DTARGET_BYTES_PER_WORD=4 "-I/cygdrive/c/Program Files/Java/jdk1.6.0_45/include/win32" -Isrc -I"/local/src/win32/include" -mthreads  -c src/tools/type-generator/main.cpp -o build/windows-i386/tools/type-generator/main-build.o
Using built-in specs.
COLLECT_GCC=i686-w64-mingw32-g++
Target: i686-w64-mingw32
Configured with: /cygdrive/i/szsz/tmpp/32gcc/mingw64-i686-gcc-4.7.3-1/src/gcc-4.7.3/configure --srcdir=/cygdrive/i/szsz/tmpp/32gcc/mingw64-i686-gcc-4.7.3-1/src/gcc-4.7.3 --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --datadir=/usr/share --localstatedir=/var --sysconfdir=/etc --datarootdir=/usr/share --docdir=/usr/share/doc/mingw64-i686-gcc -C --build=i686-pc-cygwin --host=i686-pc-cygwin --target=i686-w64-mingw32 --without-libiconv-prefix --without-libintl-prefix --with-sysroot=/usr/i686-w64-mingw32/sys-root --with-build-sysroot=/usr/i686-w64-mingw32/sys-root --disable-multilib --disable-win32-registry --enable-languages=c,ada,c++,fortran,objc,obj-c++ --enable-fully-dynamic-string --enable-libgomp --enable-sjlj-exceptions --enable-version-specific-runtime-libs --with-dwarf2 --enable-decimal-float=bid --enable-lto
Thread model: win32
gcc version 4.7.3 (GCC)
COLLECT_GCC_OPTIONS='-D' 'POINTER_SIZE=4' '-O0' '-g3' '-Wall' '-Wextra' '-Werror' '-Wunused-parameter' '-Winit-self' '-Wno-non-virtual-dtor' '-v' '-fno-rtti' '-fno-exceptions' '-I' 'classpath' '-I' '/cygdrive/c/Program Files/Java/jdk1.6.0_45/include' '-I' 'src' '-I' 'build/windows-i386' '-I' 'include' '-D' '__STDC_LIMIT_MACROS' '-D' '_JNI_IMPLEMENTATION_' '-D' 'AVIAN_VERSION="0.7"' '-D' 'AVIAN_INFO=""' '-D' 'USE_ATOMIC_OPERATIONS' '-D' 'AVIAN_JAVA_HOME=""' '-D' 'AVIAN_EMBED_PREFIX="c:/avian-embedded"' '-D' 'TARGET_BYTES_PER_WORD=4' '-I' '/cygdrive/c/Program Files/Java/jdk1.6.0_45/include/win32' '-I' 'src' '-I' '/local/src/win32/include' '-mthreads' '-c' '-o' 'build/windows-i386/tools/type-generator/main-build.o' '-shared-libgcc' '-mtune=generic' '-march=pentiumpro'
 /usr/lib/gcc/i686-w64-mingw32/4.7.3/cc1plus.exe -quiet -v -I classpath -I /cygdrive/c/Program Files/Java/jdk1.6.0_45/include -I src -I build/windows-i386 -I include -I /cygdrive/c/Program Files/Java/jdk1.6.0_45/include/win32 -I src -I /local/src/win32/include -dD -D_MT -U_REENTRANT -D POINTER_SIZE=4 -D __STDC_LIMIT_MACROS -D _JNI_IMPLEMENTATION_ -D AVIAN_VERSION="0.7" -D AVIAN_INFO="" -D USE_ATOMIC_OPERATIONS -D AVIAN_JAVA_HOME="" -D AVIAN_EMBED_PREFIX="c:/avian-embedded" -D TARGET_BYTES_PER_WORD=4 src/tools/type-generator/main.cpp -quiet -dumpbase main.cpp -mthreads -mtune=generic -march=pentiumpro -auxbase-strip build/windows-i386/tools/type-generator/main-build.o -g3 -O0 -Wall -Wextra -Werror -Wunused-parameter -Winit-self -Wno-non-virtual-dtor -version -fno-rtti -fno-exceptions -o /tmp/ccc4ZKdn.s
GNU C++ (GCC) version 4.7.3 (i686-w64-mingw32)
        compiled by GNU C version 4.7.3, GMP version 5.1.1, MPFR version 3.1.2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/i686-w64-mingw32/sys-root/usr/local/include"
ignoring nonexistent directory "/usr/lib/gcc/i686-w64-mingw32/4.7.3/../../../../i686-w64-mingw32/include"
ignoring duplicate directory "src"
#include "..." search starts here:
#include <...> search starts here:
 classpath
 /cygdrive/c/Program Files/Java/jdk1.6.0_45/include
 src
 build/windows-i386
 include
 /cygdrive/c/Program Files/Java/jdk1.6.0_45/include/win32
 /local/src/win32/include
 /usr/lib/gcc/i686-w64-mingw32/4.7.3/include/c++
 /usr/lib/gcc/i686-w64-mingw32/4.7.3/include/c++/i686-w64-mingw32
 /usr/lib/gcc/i686-w64-mingw32/4.7.3/include/c++/backward
 /usr/lib/gcc/i686-w64-mingw32/4.7.3/include
 /usr/lib/gcc/i686-w64-mingw32/4.7.3/include-fixed
 /usr/i686-w64-mingw32/sys-root/mingw/include
End of search list.
GNU C++ (GCC) version 4.7.3 (i686-w64-mingw32)
        compiled by GNU C version 4.7.3, GMP version 5.1.1, MPFR version 3.1.2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 96b99eb8f7c340d2acdb3e1e802d58cd
src/tools/type-generator/main.cpp:11:20: fatal error: stdlib.h: No such file or directory
compilation terminated.
makefile:1717: recipe for target `build/windows-i386/tools/type-generator/main-build.o' failed
make: *** [build/windows-i386/tools/type-generator/main-build.o] Error 1

Edison@admin-PC /local/src/avian
$ find / -name "stdlib.h"
/lib/gcc/i686-pc-mingw32/4.7.3/include/c++/tr1/stdlib.h
/lib/gcc/i686-w64-mingw32/4.7.3/include/c++/tr1/stdlib.h
/lib/gcc/x86_64-w64-mingw32/4.7.3/include/c++/tr1/stdlib.h
/usr/i686-pc-mingw32/sys-root/mingw/include/stdlib.h
/usr/include/cygwin/stdlib.h
/usr/include/machine/stdlib.h
/usr/include/stdlib.h
/usr/lib/gcc/i686-pc-mingw32/4.7.3/include/c++/tr1/stdlib.h
/usr/lib/gcc/i686-w64-mingw32/4.7.3/include/c++/tr1/stdlib.h
/usr/lib/gcc/x86_64-w64-mingw32/4.7.3/include/c++/tr1/stdlib.h

@hydra1983
Copy link
Contributor Author

I tried to compile this:

#include "stdio.h"
#include "stdlib.h"

int main (int argc, char *argv[])
{
    printf ("Hello .... ");
}

It fails as well:

Edison@admin-PC /local/src/test
$ i686-w64-mingw32-g++ -v test.cc
Using built-in specs.
COLLECT_GCC=i686-w64-mingw32-g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-w64-mingw32/4.7.3/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with: /cygdrive/i/szsz/tmpp/32gcc/mingw64-i686-gcc-4.7.3-1/src/gcc-4.                                                                                                                                                                                               7.3/configure --srcdir=/cygdrive/i/szsz/tmpp/32gcc/mingw64-i686-gcc-4.7.3-1/src/                                                                                                                                                                                               gcc-4.7.3 --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin                                                                                                                                                                                                --libexecdir=/usr/lib --datadir=/usr/share --localstatedir=/var --sysconfdir=/e                                                                                                                                                                                               tc --datarootdir=/usr/share --docdir=/usr/share/doc/mingw64-i686-gcc -C --build=                                                                                                                                                                                               i686-pc-cygwin --host=i686-pc-cygwin --target=i686-w64-mingw32 --without-libicon                                                                                                                                                                                               v-prefix --without-libintl-prefix --with-sysroot=/usr/i686-w64-mingw32/sys-root                                                                                                                                                                                                --with-build-sysroot=/usr/i686-w64-mingw32/sys-root --disable-multilib --disable                                                                                                                                                                                               -win32-registry --enable-languages=c,ada,c++,fortran,objc,obj-c++ --enable-fully                                                                                                                                                                                               -dynamic-string --enable-libgomp --enable-sjlj-exceptions --enable-version-speci                                                                                                                                                                                               fic-runtime-libs --with-dwarf2 --enable-decimal-float=bid --enable-lto
Thread model: win32
gcc version 4.7.3 (GCC)
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' '-march=pentiumpro'
 /usr/lib/gcc/i686-w64-mingw32/4.7.3/cc1plus.exe -quiet -v -U_REENTRANT test.cc                                                                                                                                                                                                -quiet -dumpbase test.cc -mtune=generic -march=pentiumpro -auxbase test -version                                                                                                                                                                                                -o /tmp/ccG52vRt.s
GNU C++ (GCC) version 4.7.3 (i686-w64-mingw32)
        compiled by GNU C version 4.7.3, GMP version 5.1.1, MPFR version 3.1.2,                                                                                                                                                                                                MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/i686-w64-mingw32/sys-root/usr/local/include                                                                                                                                                                                               "
ignoring nonexistent directory "/usr/lib/gcc/i686-w64-mingw32/4.7.3/../../../../                                                                                                                                                                                               i686-w64-mingw32/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/i686-w64-mingw32/4.7.3/include/c++
 /usr/lib/gcc/i686-w64-mingw32/4.7.3/include/c++/i686-w64-mingw32
 /usr/lib/gcc/i686-w64-mingw32/4.7.3/include/c++/backward
 /usr/lib/gcc/i686-w64-mingw32/4.7.3/include
 /usr/lib/gcc/i686-w64-mingw32/4.7.3/include-fixed
 /usr/i686-w64-mingw32/sys-root/mingw/include
End of search list.
GNU C++ (GCC) version 4.7.3 (i686-w64-mingw32)
        compiled by GNU C version 4.7.3, GMP version 5.1.1, MPFR version 3.1.2,                                                                                                                                                                                                MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 96b99eb8f7c340d2acdb3e1e802d58cd
test.cc:1:19: fatal error: stdio.h: No such file or directory
compilation terminated.

@joshuawarner32
Copy link
Collaborator

I have no idea how your environment would have gotten in that state, but it looks like gcc is looking for headers in different (but eerily similar) locations than they're actually installed in. A quick fix would likely be hacking the makefile to explicitly add one of the real header install locations to the header include path (-I/path). I wouldn't be surprised if you would have to do something similar for the linking step.

Some quick googling turned up this, which might be relevant: http://cboard.cprogramming.com/c-programming/139429-gcc-compiler-not-finding-header-files.html

@joshuawarner32
Copy link
Collaborator

I don't have access to my windows VM at the moment, but 1.7 sounds familiar. I installed it about six months ago or so, and it was the latest version at the time. I should be able to tell you more specifics on Monday.

@hydra1983
Copy link
Contributor Author

OK, Thank you very much.

@joshuawarner32
Copy link
Collaborator

I was running 1.7.x, and more significantly, gcc 4.5.3. When I upgraded to cygwin 1.7.22 and gcc 4.7.3 (just re-running setup.exe), the build failed for unrelated reasons - but once I got past those, it worked fine.

For reference, here's the include path my gcc is using:

/home/jwarner/win32/include
classpath
/cygdrive/c/Program Files/Java/jdk1.7.0_25//include
src
build/windows-i386
include
/cygdrive/c/Program Files/Java/jdk1.7.0_25//include/win32
/usr/lib/gcc/i686-w64-mingw32/4.7.3/include/c++
/usr/lib/gcc/i686-w64-mingw32/4.7.3/include/c++/i686-w64-mingw32
/usr/lib/gcc/i686-w64-mingw32/4.7.3/include/c++/backward
/usr/lib/gcc/i686-w64-mingw32/4.7.3/include
/usr/lib/gcc/i686-w64-mingw32/4.7.3/include-fixed
/usr/i686-w64-mingw32/sys-root/mingw/include

@hydra1983
Copy link
Contributor Author

I have no "/home/{user}/win32" directory installed. Maybe that's the
problem. I will try to fix it and compile again.
Thank you very much.

On 22 July 2013 23:36, Joshua Warner notifications@github.com wrote:

I was running 1.7.x, and more significantly, gcc 4.5.3. When I upgraded to
cygwin 1.7.22 and gcc 4.7.3 (just re-running setup.exe), the build failed
for unrelated reasons - but once I got past those, it worked fine.

For reference, here's the include path my gcc is using:

/home/jwarner/win32/include
classpath
/cygdrive/c/Program Files/Java/jdk1.7.0_25//include
src
build/windows-i386
include
/cygdrive/c/Program Files/Java/jdk1.7.0_25//include/win32
/usr/lib/gcc/i686-w64-mingw32/4.7.3/include/c++
/usr/lib/gcc/i686-w64-mingw32/4.7.3/include/c++/i686-w64-mingw32
/usr/lib/gcc/i686-w64-mingw32/4.7.3/include/c++/backward
/usr/lib/gcc/i686-w64-mingw32/4.7.3/include
/usr/lib/gcc/i686-w64-mingw32/4.7.3/include-fixed
/usr/i686-w64-mingw32/sys-root/mingw/include


Reply to this email directly or view it on GitHubhttps://github.com//issues/72#issuecomment-21352703
.

@joshuawarner32
Copy link
Collaborator

The important thing to note about the /home/{user}/win32 is that it is adjacent to my avian checkout (in /home/{user}/avian). Note that the win32 directory is just a checkout of https://github.com/ReadyTalk/win32.

That said, I don't think that's your problem - or, at least not your first one. That won't contain any of the standard c headers like stdlib.h.

@hydra1983
Copy link
Contributor Author

After upgrade to 1.7.22, I got this error:

edison@edison-PC /local/src/avian
$ make
compiling build/windows-i386/vm/system/windows-build.o
src/vm/system/windows.cpp:52:1: error: ‘_Ret_maybenull_’ does not name a
type
src/vm/system/windows.cpp:64:1: error: ‘_Ret_maybenull_’ does not name a
type
makefile:1717: recipe for target
`build/windows-i386/vm/system/windows-build.o' failed
make: *** [build/windows-i386/vm/system/windows-build.o] Error 1

@joshuawarner32
Copy link
Collaborator

Aha! Yep. That's the next error I ran into. Try applying this patch:

diff --git a/src/vm/system/windows.cpp b/src/vm/system/windows.cpp
index c611f69..49976ef 100644
--- a/src/vm/system/windows.cpp
+++ b/src/vm/system/windows.cpp
@@ -27,6 +27,7 @@
 #include <avian/vm/system/system.h>
 #include <avian/util/runtime-array.h>

+#if 0
 #if defined(WINAPI_FAMILY)

 #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
@@ -92,6 +93,8 @@ UnmapViewOfFile(

 #endif

+#endif
+
 #define ACQUIRE(s, x) MutexResource MAKE_NAME(mutexResource_) (s, x)

 using namespace vm;

@hydra1983
Copy link
Contributor Author

Should I create a file with ext. patch and paste what you provided and apply that file?
I tried this ,but tortoise git reports format detection error. :(

@joshuawarner32
Copy link
Collaborator

I always use 'git apply file.patch' from the command line. I'm not familiar with tortoiseGit.

This is a really simple patch, though - you could just manually edit it in. The two inserted lines are at 30 and 95 (in the original file).

@hydra1983
Copy link
Contributor Author

I saved the content to a file named windows.diff, and run "git apply {path}/windows.diff", it reports:

edison@edison-PC /local/src/avian
$ git apply C:/Users/edison/Desktop/windows.diff
fatal: corrupt patch at line 8

I will manually edit the file.
Really appreciate your help with this.

@hydra1983
Copy link
Contributor Author

It works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants