Peter Rosin wrote:
Den 2010-09-18 00:04 skrev Roumen Petrov:
Hi Peter,
Peter Rosin wrote:
Hi!
need_lib_prefix.at currently fails with MSVC.
Hmm probably test fail as shared library is build without -no-undefined flag.
Did libtool MSC allow creation of shared libraries without -no-undefined ?
On windows platforms (msc, gcc(mingw*)) may be the test require some PATH
magics.
(as example like func_fix_path from static.at test)
You are barking up the wrong tree, since:
1. The test passes on MinGW and Cygwin with gcc, if wouldn't do that if
-no-undefined was the cause of the fail.
2. The patch in the old quoted message makes the test pass on MSVC, which
it wouldn't do if -no-undefined was the cause of the fail.
"PATH magic" is not relevant if -no-undefined is not passed, since everything
should be static in that case (no dlls created).
But the libtool command contain -rpath so the test build shared and
static libraries .
1) linux native build:
$ cd .../testsuite.dir/086
$ strace -f ./main 2>&1 | grep foo
open("XXXX/.libs/tls/i686/libfoo1.so", O_RDONLY) = -1 ENOENT (No such
file or directory)
open("XXXX/.libs/tls/libfoo1.so", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("XXXX/.libs/i686/libfoo1.so", O_RDONLY) = -1 ENOENT (No such file
or directory)
open("XXXX/.libs/libfoo1.so", O_RDONLY) = 3
open("XXXX/.libs/libfoo2.so", O_RDONLY) = 3
write(1, "libfoo1: 2\nlibfoo2: 3\n", 22libfoo1: 2
libfoo2: 3
$ ls .../testsuite.dir/086/.libs/
foo1.la@ foo1.lai foo1.o foo2.o libfoo1.a libfoo1.so* libfoo2.a
libfoo2.la@ libfoo2.lai libfoo2.so* lt-main* main* mainS.o
Result test pass. Both static and shared libraries are created. The
executable load shared.
2) In cross-build env. verbose more:
....
libtool: link: ( cd ".libs" && rm -f "foo1.la" && ln -s "../foo1.la"
"foo1.la" )
/XXXXX/need_lib_prefix.at:165: $LIBTOOL --mode=link $CC -module
-avoid-version $CFLAGS $LDFLAGS -o libfoo2.la foo2.lo -rpath $instdir/lib
stderr:
libtool: link: warning: undefined symbols not allowed in
i386-pc-mingw32msvc shared libraries
....
$ ls .libs/
foo1.la@ foo1.lai foo1.o foo2.o libfoo1.a libfoo2.a libfoo2.la@
libfoo2.lai lt-main.c main.exe* main.exeS.o main_ltshwrapper
Result the test pass. Shared libraries are not created.
I'm not convinced that test is correct for windows platforms.
3) In cross-build env. and test patched with -no-undefined :
$ ls .libs/
foo1.la@ foo1.o libfoo1.a libfoo1.dll.a libfoo2.dll*
libfoo2.la@ lt-main.c main.exeS.o
foo1.lai foo2.o libfoo1.dll* libfoo2.a libfoo2.dll.a
libfoo2.lai main.exe* main_ltshwrapper
Result test skipped = failed.
3.1)
$ cd .../testsuite.dir/086/.libs/
$ ./main.exe
libfoo2: 3
function `f' not found: Procedure not found
error during preloading.
$ strace -f ./main.exe 2>&1 | grep foo
[pid 353] stat64("XXXX/086/.libs/libfoo1.dll", {st_mode=S_IFREG|0755,
st_size=809650, ...}) = 0
[pid 353] stat64("XXXX/086/.libs/libfoo1.dll", {st_mode=S_IFREG|0755,
st_size=809650, ...}) = 0
[pid 353] stat64("XXXX/086/.libs/libfoo1.dll", {st_mode=S_IFREG|0755,
st_size=809650, ...}) = 0
[pid 353] stat64("XXXX/086/.libs/libfoo1.dll", {st_mode=S_IFREG|0755,
st_size=809650, ...}) = 0
[pid 353] stat64("XXXX/086/.libs/libfoo1.dll", {st_mode=S_IFREG|0755,
st_size=809650, ...}) = 0
[pid 338] open("XXXX/086/.libs/libfoo1.dll",
O_RDONLY|O_NONBLOCK|O_LARGEFILE) = 78
[pid 353] stat64("XXXX/086/.libs/libfoo1.dll", {st_mode=S_IFREG|0755,
st_size=809650, ...}) = 0
[pid 353] open("XXXX/086/.libs/libfoo1.dll", O_RDONLY) = 9
[pid 353] open("/opt/wine/1.3.1/lib/wine/libfoo1.dll.so", O_RDONLY) =
-1 ENOENT (No such file or directory)
[pid 353] open("/opt/wine/1.3.1/lib/wine/libfoo1.dll.so",
O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
[pid 353] stat64("XXXX/086/.libs/libfoo2.dll", {st_mode=S_IFREG|0755,
st_size=809656, ...}) = 0
[pid 353] stat64("XXXX/086/.libs/libfoo2.dll", {st_mode=S_IFREG|0755,
st_size=809656, ...}) = 0
[pid 353] stat64("XXXX/086/.libs/libfoo2.dll", {st_mode=S_IFREG|0755,
st_size=809656, ...}) = 0
[pid 353] stat64("XXXX/086/.libs/libfoo2.dll", {st_mode=S_IFREG|0755,
st_size=809656, ...}) = 0
[pid 353] stat64("XXXX/086/.libs/libfoo2.dll", {st_mode=S_IFREG|0755,
st_size=809656, ...}) = 0
[pid 338] open("XXXX/086/.libs/libfoo2.dll",
O_RDONLY|O_NONBLOCK|O_LARGEFILE) = 79
[pid 353] stat64("XXXX/086/.libs/libfoo2.dll", {st_mode=S_IFREG|0755,
st_size=809656, ...}) = 0
[pid 353] open("XXXX/086/.libs/libfoo2.dll", O_RDONLY) = 9
[pid 353] open("/opt/wine/1.3.1/lib/wine/libfoo2.dll.so", O_RDONLY) =
-1 ENOENT (No such file or directory)
[pid 353] open("/opt/wine/1.3.1/lib/wine/libfoo2.dll.so",
O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
[pid 353] stat64("XXXX/086/.libs/libfoo1.dll", {st_mode=S_IFREG|0755,
st_size=809650, ...}) = 0
[pid 353] stat64("XXXX/086/.libs/libfoo1.dll", {st_mode=S_IFREG|0755,
st_size=809650, ...}) = 0
[pid 353] stat64("XXXX/086/.libs/libfoo2.dll", {st_mode=S_IFREG|0755,
st_size=809656, ...}) = 0
[pid 353] stat64("XXXX/086/.libs/libfoo2.dll", {st_mode=S_IFREG|0755,
st_size=809656, ...}) = 0
[pid 353] write(8, "libfoo2: 3\r\n", 12libfoo2: 3
3.2)
$ cd .../testsuite.dir/086/.libs/
$ .libs/main.exe
libfoo1: 2
libfoo2: 3
3.3)
The emulated environment is modified manually as PATH is updated to list
test directory with shared libraries:
A copy of final executable is run in directory outside listed in PATH.
Result is same as wrapper script:
------
libfoo2: 3
function `f' not found: Procedure not found
error during preloading.
------
Cheers,
Peter
Roumen