This is the mail archive of the libffi-discuss@sourceware.org mailing list for the libffi project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix build for newish MSVC


Peter Rosin skrev 2012-03-20 09:08:
> Anthony Green skrev 2012-03-20 06:00:
>> On Tue, Mar 13, 2012 at 10:24 AM, Peter Rosin <peda@lysator.liu.se> wrote:
>>> ---
>>>  ChangeLog       |    6 ++++++
>>>  src/x86/win32.S |    2 +-
>>>  2 files changed, 7 insertions(+), 1 deletions(-)
>>>
>>> Hi!
>>>
>>> I tried to build libffi using MSYS/MSVC and ml stumbled with
>>>
>>> win32.asm(958) : error A2006: undefined symbol : stub
>>>
>>> when it compiled win32.S.  Looking into that, I could fix it
>>> with this patch, but it seems a bit strange that I need it,
>>> given that it fails like this regardless if I use MSVC 2005
>>> or MSVC 2010 (I can't find any ml.exe in my old MSVC 6 (1998)
>>> install, I might have selected to not install it?).  It seems
>>> like this double colon problem should have been detected
>>> earlier...
>>
>>
>> Thanks Peter.  I don't have the ability to test this, but I looked up
>> the uses for ::, and I agree.
> 
> Ok, good.
> 
>>> I would also like a hint on how to do basic tests given that
>>> dejagnu isn't available for MSYS (or is it?).  "make check"
>>> complains with:
>>>
>>> WARNING: could not find `runtest'
>>
>> DejaGNU is available for cygwin, and a quick google search shows that
>> there's also an MSYS version.
> 
> Ok, I tried the Cygwin version in a Cygwin build (mixing Cygwin and
> MSYS is bad for your health, so I'm not going there as a first stop)
> and got the below output.  It should be noted that I don't know the
> first thing about dejagnu so this is probably some simple cockpit
> error... (the summary numbers at the end of the testsuite run seem
> strange to me though)

*snip* log showing FAILs all-over.

To debug this, I ran:

$ runtest -v -v --tool libffi --srcdir /home/peda/libffi/testsuite
Expect binary is /usr/bin/expect
Looking for /usr/share/dejagnu/runtest.exp.
Using /usr/share/dejagnu/runtest.exp as main test driver
Looking for /share/dejagnu/runtest.exp.
Looking for /usr/bin/runtest.exp.
Verbose level is 2
Login name is peda
Looking for ~/.dejagnurc
Looking for /home/peda/libffi/cyg/testsuite/site.exp
Found /home/peda/libffi/cyg/testsuite/site.exp
Looking for /home/peda/libffi/cyg/testsuite/site.exp
Found /home/peda/libffi/cyg/testsuite/site.exp
Using test sources in ../../testsuite
Using test binaries in /home/peda/libffi/cyg/testsuite
Tool root directory is /home/peda/libffi
Using /usr/share/dejagnu to find libraries
Looking for /usr/share/dejagnu/site.exp
WARNING: Couldn't find the global config file.
Looking for library file ../lib/utils.exp
Looking for library file /usr/share/dejagnu/utils.exp
Loading /usr/share/dejagnu/utils.exp
Looking for library file ../lib/framework.exp
Looking for library file /usr/share/dejagnu/framework.exp
Loading /usr/share/dejagnu/framework.exp
Looking for library file ../lib/debugger.exp
Looking for library file /usr/share/dejagnu/debugger.exp
Loading /usr/share/dejagnu/debugger.exp
Looking for library file ../lib/remote.exp
Looking for library file /usr/share/dejagnu/remote.exp
Loading /usr/share/dejagnu/remote.exp
Looking for library file ../lib/mondfe.exp
Looking for library file /usr/share/dejagnu/mondfe.exp
Loading /usr/share/dejagnu/mondfe.exp
Looking for library file ../lib/xsh.exp
Looking for library file /usr/share/dejagnu/xsh.exp
Loading /usr/share/dejagnu/xsh.exp
Looking for library file ../lib/telnet.exp
Looking for library file /usr/share/dejagnu/telnet.exp
Loading /usr/share/dejagnu/telnet.exp
Looking for library file ../lib/rlogin.exp
Looking for library file /usr/share/dejagnu/rlogin.exp
Loading /usr/share/dejagnu/rlogin.exp
Looking for library file ../lib/kermit.exp
Looking for library file /usr/share/dejagnu/kermit.exp
Loading /usr/share/dejagnu/kermit.exp
Looking for library file ../lib/tip.exp
Looking for library file /usr/share/dejagnu/tip.exp
Loading /usr/share/dejagnu/tip.exp
Looking for library file ../lib/rsh.exp
Looking for library file /usr/share/dejagnu/rsh.exp
Loading /usr/share/dejagnu/rsh.exp
Looking for library file ../lib/ftp.exp
Looking for library file /usr/share/dejagnu/ftp.exp
Loading /usr/share/dejagnu/ftp.exp
Looking for library file ../lib/target.exp
Looking for library file /usr/share/dejagnu/target.exp
Loading /usr/share/dejagnu/target.exp
Looking for library file ../lib/targetdb.exp
Looking for library file /usr/share/dejagnu/targetdb.exp
Loading /usr/share/dejagnu/targetdb.exp
Looking for library file ../lib/libgloss.exp
Looking for library file /usr/share/dejagnu/libgloss.exp
Loading /usr/share/dejagnu/libgloss.exp
Loading library file ../../testsuite/lib/libffi.exp
Looking for library file ../lib/dg.exp
Looking for library file /usr/share/dejagnu/dg.exp
Loading /usr/share/dejagnu/dg.exp
Looking for ../../testsuite/lib/target-libpath.exp
Found ../../testsuite/lib/target-libpath.exp
Looking for ../../testsuite/lib/wrapper.exp
Found ../../testsuite/lib/wrapper.exp
Testing libffi
Opening log files in .
Test Run By peda on Tue Mar 20 20:54:12 2012
Checking i686-pc-cygwin against i686-pc-cygwin
Native configuration is i686-pc-cygwin

                === libffi tests ===

setting trap for SIGTERM to terminated
setting trap for SIGINT to interrupted by user
setting trap for SIGQUIT to interrupted by user
setting trap for SIGSEGV to segmentation violation
dirlist is /usr/share/dejagnu/baseboards
Looking for standard board description file for build /usr/share/dejagnu/baseboards/standard.exp
Looking for board description file for build /usr/share/dejagnu/baseboards/peda-pc.exp
pushing config for build, name is peda-pc
dirlist is /usr/share/dejagnu/baseboards
Looking for standard board description file for host /usr/share/dejagnu/baseboards/standard.exp
Looking for board description file for host /usr/share/dejagnu/baseboards/peda-pc.exp
pushing config for host, name is peda-pc
Schedule of variations:
    unix

target is unix
Running target unix
Looking for tool-and-target-specific interface file /home/peda/libffi/testsuite/config/base-config.exp
Looking for tool-and-target-specific interface file /home/peda/libffi/testsuite/../config/base-config.exp
Looking for tool-and-target-specific interface file /home/peda/libffi/testsuite/../../config/base-config.exp
Looking for tool-and-target-specific interface file /home/peda/libffi/testsuite/../../../config/base-config.exp
dirlist is /usr/share/dejagnu/baseboards/peda-pc /usr/share/dejagnu/baseboards
Looking for standard board description file for target /usr/share/dejagnu/baseboards/peda-pc/standard.exp
Looking for standard board description file for target /usr/share/dejagnu/baseboards/standard.exp
Looking for board description file for target /usr/share/dejagnu/baseboards/peda-pc/unix.exp
Looking for board description file for target /usr/share/dejagnu/baseboards/unix.exp
Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target.
Looking for generic interface file for target /usr/share/dejagnu/config/unix.exp
Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
/home/peda/libffi/xgcc
/home/peda/xgcc
/home/xgcc
//xgcc
/home/peda/libffi/gcc/xgcc
/home/peda/gcc/xgcc
/home/gcc/xgcc
//gcc/xgcc
Checking "*-*-cygwin*" against "i686-pc-cygwin"
Checking "alpha*-*" against "i686-pc-cygwin"
Looking for tool-and-target-specific interface file /home/peda/libffi/testsuite/config/unix.exp
Looking for tool-and-target-specific interface file /home/peda/libffi/testsuite/config/cygwin.exp
Looking for tool-and-target-specific interface file /home/peda/libffi/testsuite/config/default.exp
Using /home/peda/libffi/testsuite/config/default.exp as tool-and-target-specific interface file.
Looking for library file ../lib/standard.exp
Looking for library file /usr/share/dejagnu/standard.exp
Loading /usr/share/dejagnu/standard.exp
pushing config for target, name is unix
Top level testsuite dirs are /home/peda/libffi/testsuite/libffi.call /home/peda/libffi/testsuite/libffi.special
Running /home/peda/libffi/testsuite/libffi.call/call.exp ...
libffi /home/peda/libffi/cyg/testsuite/..
/home/peda/libffi/gcc/libgcc.a
/home/peda/gcc/libgcc.a
/home/gcc/libgcc.a
//gcc/libgcc.a
gccdir
ld_library_path: .::/home/peda/libffi/cyg/testsuite/../.libs
libffi_include /home/peda/libffi/cyg/testsuite/../include
libffi_dir /home/peda/libffi/cyg/testsuite/../.libs
set_ld_library_path_env_vars: ld_library_path=.::/home/peda/libffi/cyg/testsuite/../.libs
Testing libffi.call/closure_fn0.c
Checking "*-*-darwin9*" against "i686-pc-cygwin"
Checking "*-*-darwin1*" against "i686-pc-cygwin"
Checking "*-*-darwin2*" against "i686-pc-cygwin"
options: {additional_flags=-O0 -W -Wall } {additional_flags=-I/home/peda/libffi/cyg/testsuite/../include -I/home/peda/libffi/testsuite/../include  -I/home/peda/libffi/cyg/testsuite/../include/..} additional_flags=-L/home/peda/libffi/cyg/testsuite/../.libs {libs= -lffi}
doing compile
Invoking the compiler as gcc /home/peda/libffi/testsuite/libffi.call/closure_fn0.c  -O0 -W -Wall  -I/home/peda/libffi/cyg/testsuite/../include -I/home/peda/libffi/testsuite/../include  -I/home/peda/libffi/cyg/testsuite/../include/.. -L/home/peda/libffi/cyg/testsuite/../.libs  -lffi    -o ./closure_fn0.exe
Executing on host: gcc /home/peda/libffi/testsuite/libffi.call/closure_fn0.c  -O0 -W -Wall  -I/home/peda/libffi/cyg/testsuite/../include -I/home/peda/libffi/testsuite/../include  -I/home/peda/libffi/cyg/testsuite/../include/.. -L/home/peda/libffi/cyg/testsuite/../.libs  -lffi    -o ./closure_fn0.exe    (timeout = 300)
pid is 7856 -7856
waitres is 7856 exp6 0 0
output is
Checking pattern "sparc-*-sunos*" with i686-pc-cygwin
Checking pattern "alpha*-*-*" with i686-pc-cygwin
Checking pattern "hppa*-*-hpux*" with i686-pc-cygwin
Checking pattern "sparc-*-sunos*" with i686-pc-cygwin
Checking pattern "alpha*-*-*" with i686-pc-cygwin
Checking pattern "hppa*-*-hpux*" with i686-pc-cygwin
loading to unix
spawning command ./closure_fn0.exe
exp7 file6
close result is child process exited abnormally
Executed ./closure_fn0.exe, status 1
/home/peda/libffi/cyg/testsuite/closure_fn0.exe: error while loading shared libraries: cygffi-6.dll: cannot open shared object file: No such file or directory
FAIL: libffi.call/closure_fn0.c execution test

*snip* lots of repeats...

So, it seems that the freshly built cygffi-6.dll can't be found
by the testsuite.  Further up, I see this line:

ld_library_path: .::/home/peda/libffi/cyg/testsuite/../.libs

Which hints at the problem.  LD_LIBRARY_PATH doesn't work on Cygwin
(it only works when you dlopen libraries, not when the Windows
loader creates the process), you have to add additional library
search dirs to PATH instead.  Or the testsuite should be coerced
into using libtool to create the executables with a direct pointer
to the libffi.la file instead of using -L... -lffi, then libtool
would create a wrapper that would fix this problem.

However, I don't feel like disecting the testsuite, so I'm helping
it limp along like this instead:

$ export PATH="/home/peda/libffi/cyg/.libs:$PATH"
$ make check
Making check in include
make[1]: Entering directory `/home/peda/libffi/cyg/include'
make[1]: Nothing to be done for `check'.
make[1]: Leaving directory `/home/peda/libffi/cyg/include'
Making check in testsuite
make[1]: Entering directory `/home/peda/libffi/cyg/testsuite'
make  check-DEJAGNU
make[2]: Entering directory `/home/peda/libffi/cyg/testsuite'
srcdir=`CDPATH="${ZSH_VERSION+.}:" && cd ../../testsuite && pwd`; export srcdir; \
EXPECT=`if [ -f ../../expect/expect ] ; then  echo ../../expect/expect ;  else echo expect ; fi`; export EXPECT; \
runtest=`if [ -f ../../../dejagnu/runtest ] ; then  echo ../../../dejagnu/runtest ;  else echo runtest; fi`; \
if /bin/sh -c "$runtest --version" > /dev/null 2>&1; then \
  exit_status=0; l='libffi'; for tool in $l; do \
    if $runtest  --tool $tool --srcdir $srcdir ; \
    then :; else exit_status=1; fi; \
  done; \
else echo "WARNING: could not find \`runtest'" 1>&2; :;\
fi; \
exit $exit_status
WARNING: Couldn't find the global config file.
Test Run By peda on Tue Mar 20 20:55:26 2012
Native configuration is i686-pc-cygwin

                === libffi tests ===

Schedule of variations:
    unix

Running target unix
Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
Using /home/peda/libffi/testsuite/config/default.exp as tool-and-target-specific interface file.
Running /home/peda/libffi/testsuite/libffi.call/call.exp ...
FAIL: libffi.call/closure_thiscall.c (test for excess errors)
WARNING: libffi.call/closure_thiscall.c compilation failed to produce executable
FAIL: libffi.call/closure_thiscall.c (test for excess errors)
WARNING: libffi.call/closure_thiscall.c compilation failed to produce executable
FAIL: libffi.call/closure_thiscall.c (test for excess errors)
WARNING: libffi.call/closure_thiscall.c compilation failed to produce executable
FAIL: libffi.call/closure_thiscall.c (test for excess errors)
WARNING: libffi.call/closure_thiscall.c compilation failed to produce executable
FAIL: libffi.call/closure_thiscall.c (test for excess errors)
WARNING: libffi.call/closure_thiscall.c compilation failed to produce executable
Running /home/peda/libffi/testsuite/libffi.special/special.exp ...

                === libffi Summary ===

# of expected passes            1764
# of unexpected failures        5
Makefile:317: recipe for target `check-DEJAGNU' failed
make[2]: *** [check-DEJAGNU] Error 1
make[2]: Leaving directory `/home/peda/libffi/cyg/testsuite'
Makefile:385: recipe for target `check-am' failed
make[1]: *** [check-am] Error 2
make[1]: Leaving directory `/home/peda/libffi/cyg/testsuite'
Makefile:1286: recipe for target `check-recursive' failed
make: *** [check-recursive] Error 1

Which looks much better (but still not perfect...)

Cheers,
Peter


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]