Hello,
I've received a weird request this morning. Someone in my group want to
send a programmed developped here to a potential sponsor. We can't give
them our source code, and we can't give them an executable because its
linked with libraries we can't redistribute.
the sponsor has all the required libraries, one of which is in C++. Our
code is also C++.
The plan would be to compile our code and make a library out of it
(libfoo.a), then provide a small makefile that would take libfoo and
link it with the required 3rd party libraries, and whatever required
system library.
The trouble is, they don't have SunWorkshop over there, and our code
(and the 3rd party library) is compiled with it.
If it was all C, we could use the linker (ld) to link it all together,
but for some reason it doesn't work:
ld -o a.out libfoo.a -lcommercialLib1 -lcommercialLib2 -lnsl \
-lsocket -lm
doesn't work, it generates a 2KB executable.
If I use the same command line, but use CC instead of ld, I get a 9MB
executable that works.
Is there any way to make this work ?
--
Christophe Dupre
System Administrator, Scientific Computation Research Center
Rensselaer Polytechnic Institute
Troy, NY USA
Phone: (518) 276-2578 - Fax: (518) 276-4886
|
|
0
|
|
|
|
Reply
|
Christophe
|
9/4/2003 8:43:23 PM |
|
Christophe Dupre <duprec@scorec.rpi.edu> writes:
> The trouble is, they don't have SunWorkshop over there, and our code
> (and the 3rd party library) is compiled with it.
They could get a free trial license
--
Chris Morgan
"Post posting of policy changes by the boss will result in
real rule revisions that are irreversible"
- anonymous correspondent
|
|
0
|
|
|
|
Reply
|
Chris
|
9/4/2003 9:02:26 PM
|
|
On Thu, 4 Sep 2003, Christophe Dupre wrote:
> Hello,
> I've received a weird request this morning. Someone in my group want to
> send a programmed developped here to a potential sponsor. We can't give
> them our source code, and we can't give them an executable because its
> linked with libraries we can't redistribute.
>
> the sponsor has all the required libraries, one of which is in C++. Our
> code is also C++.
In that case, I don't see the problem. Just use dynamic
linking, and away you go. Send you sponsor your binary
(plus any of your own libs), and it should work.
If I compile "Hello World" here, I can send you the resulting
binary without also giving you a copy of my libc, can't I?
--
Rich Teer, SCNA, SCSA
President,
Rite Online Inc.
Voice: +1 (250) 979-1638
URL: http://www.rite-online.net
|
|
0
|
|
|
|
Reply
|
Rich
|
9/4/2003 9:24:46 PM
|
|
Rich Teer wrote:
> On Thu, 4 Sep 2003, Christophe Dupre wrote:
>
>
>>Hello,
>>I've received a weird request this morning. Someone in my group want to
>>send a programmed developped here to a potential sponsor. We can't give
>>them our source code, and we can't give them an executable because its
>>linked with libraries we can't redistribute.
>>
>>the sponsor has all the required libraries, one of which is in C++. Our
>>code is also C++.
>
>
> In that case, I don't see the problem. Just use dynamic
> linking, and away you go. Send you sponsor your binary
> (plus any of your own libs), and it should work.
>
> If I compile "Hello World" here, I can send you the resulting
> binary without also giving you a copy of my libc, can't I?
>
If it was that simple... The C++ library is only available as a static
library. :-(
--
--
Christophe Dupre
System Administrator, Scientific Computation Research Center
Rensselaer Polytechnic Institute
Troy, NY USA
Phone: (518) 276-2578 - Fax: (518) 276-4886
|
|
0
|
|
|
|
Reply
|
Christophe
|
9/5/2003 12:53:29 PM
|
|
Christophe Dupre <duprec@scorec.rpi.edu> writes:
>If it was that simple... The C++ library is only available as a static
>library. :-(
Surely you mean "only avaiable as a dynamic library"?
(The dynamic library ships with Solaris)
Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.
|
|
0
|
|
|
|
Reply
|
Casper
|
9/5/2003 3:01:16 PM
|
|
On Fri, 5 Sep 2003, Christophe Dupre wrote:
> If it was that simple... The C++ library is only available as a static
> library. :-(
Ah. Time to hassle the library vendor for a dynamic version,
then. Why one would only want a static library is beyond me.
--
Rich Teer, SCNA, SCSA
President,
Rite Online Inc.
Voice: +1 (250) 979-1638
URL: http://www.rite-online.net
|
|
0
|
|
|
|
Reply
|
Rich
|
9/5/2003 3:58:29 PM
|
|
Christophe Dupre <duprec@scorec.rpi.edu> writes:
> ld -o a.out libfoo.a -lcommercialLib1 -lcommercialLib2 -lnsl \
> -lsocket -lm
>
> doesn't work, it generates a 2KB executable.
>
> If I use the same command line, but use CC instead of ld, I get a 9MB
> executable that works.
Use CC -v to see what else is linked in. Possibly you could
create an incomplete executable foo.o using ld -r instead of
creating libfoo.a (or use -z allextract).
Markus
|
|
0
|
|
|
|
Reply
|
mgyger
|
9/5/2003 4:22:14 PM
|
|
"Christophe Dupre" <duprec@scorec.rpi.edu> wrote:
> > In that case, I don't see the problem. Just use dynamic
> > linking, and away you go. Send you sponsor your binary
> > (plus any of your own libs), and it should work.
> >
> > If I compile "Hello World" here, I can send you the resulting
> > binary without also giving you a copy of my libc, can't I?
> >
> If it was that simple... The C++ library is only available as a static
> library. :-(
As far as the Solaris libraries go, the shared C++
libraries are shipped with Solaris. You might have to add
-lCrun and/or -lCstd to your link line, as
CC -G will not automatically add these to the link line.
See the documentation on how to create shared libraries
http://docs.sun.com/source/817-0926/Building.Libs.html
Thomas
|
|
0
|
|
|
|
Reply
|
Thomas
|
9/5/2003 5:36:31 PM
|
|
|
7 Replies
133 Views
(page loaded in 0.109 seconds)
Similiar Articles: Linking error in calling sbrk() function - comp.lang.c++.moderated ...> platform (Red Hat 4.1.2-44) using g++ compiler ... if it is an oversight, but you are compiling without the the -c ... declared, but not defined - comp.lang.c Linking error ... Matlab R2010b x64 ignores .mexw64 files ?! - comp.soft-sys.matlab ...It is not the *usual* compilation/linking/cannot find compiler problem! ... ... Both > compile and link without problems, and .mexw64 files appear ... Size of "Hello world" - comp.lang.c++Hello World without symbols are pretty small ... similar results of any concurrent C++ compiler. Oh? C ... functions used (unless static is linking is used). So in C or ... Deploying a stand-alone GUI to an end user without matlab ...... libmatrixp -T link:lib for a machine with a C++ compiler. Unfortunately, my machine only has the C compiler ... as backup compiler and they available for everyone without ... Compiler warnings assoc. with 'fileno' being deprecated on Windows ...See below for my warning messages: c:\ace-5.7\ace_wrappers\ace\os ... ace\os_ns_stdio.h > > > DOES THE PROBLEM AFFECT: > COMPILATION? Yes > LINKING? f95 to windows dll - comp.lang.fortran... to compiling the Windows dll without having to spend an arm and/or leg on a compiler? ... On 18 nov, 03:22, Clark <c...@uswest ... In that case compiling and linking with ... removing /save fortran compiler option - comp.lang.fortran ...... want to stay with our current compiler until we get everything > to working without ... for Watcom F77/32 Compile and Link ... folks had done some work on the C compiler ... Need to link shared objects after changing source code but not the ...... into several shared object libs. several programs link ... But if your compiler flags somehow affect interface (for ... when it was linked then the program will execute without ... Error: "syntax error: got (, expecting Newline" - comp.lang.c++ ...Hi friends i tried to compile following programs and link it, i got an ... But without more information (compiler, etc.), it's impossible to tell. BTW: it is not usual in C++ ... Need a FORTRAN compiler for Win7 (or XP) - comp.lang.fortran ...... 1/61"), mainframe FIV essentially without ... to procrastinate the decision until "link time", which could allow the compiler ... This is the easy way to download C Compiler for ... /c (Compile Without Linking) (C++) - Microsoft Corporation .../c (Compile Without Linking) ... the automatic call to LINK. Compiling with /c creates ... environment uses the /c option by default. To set this compiler option ... /c (Compile Without Linking) (C++) - Microsoft Corporation .../c (Compile Without Linking) ... created in the development environment uses the /c option by default. To set this compiler ... 7/28/2012 3:53:38 AM
|