[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Mingw-cross-env-list] Linking statically
From: |
Daniel Stonier |
Subject: |
[Mingw-cross-env-list] Linking statically |
Date: |
Wed, 26 Jan 2011 11:38:44 +0900 |
Hi all,
I may be missing something here as its the first time Ive tried much
in the way of static linking and have some confusion about static
linking in the mingw cross environment - specifically with regards to
generated .la files.
EXAMPLE:
I've cross-compiled three libraries, libapr, libaprutil and liblog4cxx
with the mingw cross compiler. They have successfully installed both
.a and .la files in the mingw cross environment.
TEST PROGRAM:
#include <iostream>
#include <log4cxx/logger.h>
int main() {
std::cout << "dude" << std::endl;
log4cxx::LoggerPtr my_logger = log4cxx::Logger::getLogger("DudeLogger");
return 0;
}
COMPILE COMMAND:
> i686-pc-mingw32-g++ -o dude.exe main.o -llog4cxx
This fails with undefined references everywhere. Now if I add in all
the underlying static libs, it works.
> i686-pc-mingw32-g++ -o dude.exe main.o -llog4cxx -laprutil-1 -lapr-1 -lexpat
> -liconv -lrpcrt4 -lshell32 -lws2_32 -ladvapi32 -lkernel32 -lmsvcrt
No problem. My question is, wasn't libtool supposed to use the .la
files to automatically find and reference these underlying libs? Is
there a syntax to get it to do so?
Cheers,
Daniel Stonier.
- [Mingw-cross-env-list] Linking statically,
Daniel Stonier <=