472,792 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,792 software developers and data experts.

How to link a library statically in a binary

I have Sun WorkShop 6 update 1 C++ 5.2 2000/09/11 compiler running on
SunOS 5.7 Generic_106541-08 sun4u sparc SUNW,Ultra-60 machine.

i am using /opt/SUNWspro/bin//CC for building C++ code.
I want to link a shared library libxyz.so to my binary satically, so
that i may not need that at run time.
i used -staticlib=xyz but its not working . Its saying that
CC: Warning: illegal option xyz ignored

I included the path in PATH and LD_LIBRARY_PATH both but still the
problem didnt get solved.
Please suggest that what to use in thatis case.

Jul 12 '06 #1
1 2293
an********@gmail.com wrote in news:1152706777.973306.129780@
75g2000cwc.googlegroups.com:
I have Sun WorkShop 6 update 1 C++ 5.2 2000/09/11 compiler running on
SunOS 5.7 Generic_106541-08 sun4u sparc SUNW,Ultra-60 machine.

i am using /opt/SUNWspro/bin//CC for building C++ code.
I want to link a shared library libxyz.so to my binary satically, so
that i may not need that at run time.
i used -staticlib=xyz but its not working . Its saying that
CC: Warning: illegal option xyz ignored

I included the path in PATH and LD_LIBRARY_PATH both but still the
problem didnt get solved.
Please suggest that what to use in thatis case.

On my system (probably another Workshop version) there
are options "-B dynamic -dy" or "-B static -dn". For static
linking you need a file libxyz.a, not libxyz.so.
For both options "-B static" and "-dn" the manpage contains
a warning that some system libraries (i.e. libc) are available
as shared libraries only. So you should switch back to
dynamic linking at the end of your command line and allow
the linker to use the shared system libraries.
Hope this helps.

Regards,

Dirk

PS: Your question is more a candidate for a
"programming on Solaris"-related newsgroup than for a newsgroup
about general C (not C++, no system/compiler specific) problems.
--
Dirk Krause
Please do not respond to the e-mail address shown in the newsreader.
Use the web form below instead. Thanks.
http://www.fh-schmalkalden.de/url.ph...lect_wert/3023
Jul 12 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: BekTek | last post by:
When I build boost libs, I realized that there is static link at runtime.. What does that mean? I thought static linking is done at compile time. Am I wrong?
2
by: sam | last post by:
Hi, After compiled and linked with a third-party C++ library ACE in FreeBSD 5.4, apart from copying my program over, I found that I also need to copy the libace..so.5.4.1 file to the target...
43
by: Steven T. Hatton | last post by:
Now that I have a better grasp of the scope and capabilities of the C++ Standard Library, I understand that products such as Qt actually provide much of the same functionality through their own...
1
by: David Douthitt | last post by:
I have a binary statically linked application that was compiled against Red Hat 7.3 (presumably glibc 2.2.5). The application SegFaults when run in a Red Hat Advanced Server environment - with...
2
by: Angel Lopez | last post by:
I am quite a beginner in C. I am writting an application on my debian linux computer that uses some imagemagick library functions. I can link them and compile (with cc) in my computer but when I...
2
by: Egbert Nierop \(MVP for IIS\) | last post by:
Hi, I use the llib library from adler and compiled it myself. First I build the lib configuration, then I included zlib.h in stdafx.h and I added a lib reference...
2
by: noleander | last post by:
I'm trying to call the Microsoft image-processing function AlphaBlend() in my Visual C++ application. My software compiles okay, but gets a link error (details below) that says it cannot find the...
4
by: danip | last post by:
Hi, Is it possible to add a VC++ 6 library ot a VC++ 8 application ? if yes how ? is it possible to link a DLL ? how ? -- Dani
2
by: Chameleon | last post by:
My project uses many libraries like libjpeg, libpng and more. With all of these libraries linked statically and with many .cpp files of my project, a big binary executable is predictable. I'm...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.