Sponsored Content
Top Forums Programming Static and Shared Library in Makefile Post 302453301 by jadsys on Tuesday 14th of September 2010 07:45:50 PM
Old 09-14-2010
Static and Shared Library in Makefile

I am having a devil of a time with a very simple make file. The program needs two shared and one static library. If I link the shared libraries only like below the mysql test app works

------------------------------------------------------------------------------------------------------------------------
Code:
CXX := g++
CXXFLAGS := -I/usr/include/mysql -I /usr/include/mysql++
LDFLAGS := -L /usr/lib64 -lmysqlclient -lmysqlpp -L /usr/lib64/mysql
 EXECUTABLE := DigArchive

all: $(EXECUTABLE)

-----------------------------------------------------------------------------------------------
If I try to bring in the static library as shown below, I suddenly get an error:
/usr/bin/ld: cannot find -lmysqlpp

------------------------------------------------------------------------------------------------
Code:
CXX := g++
CXXFLAGS := -I/usr/include/mysql -I /usr/include/mysql++
LDFLAGS := -L /usr/lib64 -lmysqlclient -lmysqlpp -L /usr/lib64/mysql -static -L./ -lRmtDirTree
EXECUTABLE := DigArchive

all: $(EXECUTABLE)

-----------------------------------------------------------------------------------------------

The static library is in the same folder as the program. I must be doing something wrong with the command structure.
BTW: Having the same issue trying to use scons to do this

Any ideas?

Last edited by pludi; 09-15-2010 at 07:59 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to change a Makefile from building static library to shared library?

Hi: I have a library that it only offers Makefile for building static library. It built libxxx.a file. How do I in any way build a shared library? (either changin the Makefile or direct script or command to build shared library) Thanks. (1 Reply)
Discussion started by: cpthk
1 Replies

2. Programming

Makefile shared library g++

I'm having trouble with my makefile, I'm trying to code a shared library to be used by another program *EDIT* Found the solution: CC = g++ MODULES= readconfig.o ReadConfigLib.o OBJECTS= RCLOBJECTS= ReadConfigLib.cpp readconfig.cpp configDefinitions.h readconfig.h ReadConfigLib.h... (0 Replies)
Discussion started by: james2432
0 Replies

3. Programming

Adding a Static Library (libtimer.a) to the Makefile

Hi, The following is my Makefile, I wanted to add a staic library named libtimer.a. I'm using the following Makefile. Please let me know how to add this static library: Makefile:- It produces "usbserial" executable. Thanks, S (1 Reply)
Discussion started by: suryaemlinux
1 Replies

4. Linux

Could static library include static library?

I have some static library(libxxx.a libyyy.a). And I want to generate my library(libzzz.a), libzzz.a will use libxxx.a and libyyy.a I wan't my application only use libzzz.a, (means libzzz.a had include libxxx.a, libyyy.a), how can I do that? Thank you. example: I have zzz.c. I do ... (4 Replies)
Discussion started by: freemagic
4 Replies

5. Programming

Even the Static cURL Library Isn't Static

I'm writing a program which uses curl to be run on Linux PCs which will be used by a number of different users. I cannot make the users all install curl on their individual machines, so I have tried to link curl in statically, rather than using libcurl.so. I downloaded the source and created a... (8 Replies)
Discussion started by: BrandonShw
8 Replies

6. UNIX for Dummies Questions & Answers

Shared static library

Hello Please what does mean shared static library and LD-Preload? Thank you (3 Replies)
Discussion started by: chercheur857
3 Replies

7. Programming

Shared library with acces to shared memory.

Hello. I am new to this forum and I would like to ask for advice about low level POSIX programming. I have to implement a POSIX compliant C shared library. A file will have some variables and the shared library will have some functions which need those variables. There is one special... (5 Replies)
Discussion started by: iamjag
5 Replies

8. AIX

Add shared members from library to same library in a different directory

I'm trying to install libiconv to AIX 7.1 from an rpm off of the perzl site. The rpm appears to install but I get this error message. add shr4.o shared members from /usr/lib/libiconv.a to /opt/freeware/lib/libiconv.a add shr.o shared members from /usr/lib/libiconv.a to ... (5 Replies)
Discussion started by: kneemoe
5 Replies

9. Shell Programming and Scripting

Help understanding makefile: static pattern rules

Hi all, I'm reading the GNU Make book I cannot understand the following syntax from the book. objects = foo.o bar.o all : $(objects) $(objects) : %.o : %.c $(CC) -c $(CFLAGS) $< -o $@ If I run: make, I get the output: cc -c foo.c cc -o foo foo.o I think I... (3 Replies)
Discussion started by: santiagorf
3 Replies

10. Programming

Need help changing a makefile to static linking

Hi all, I'm having a hard time compiling a plugin (softhddevice) for the video disk recorder software (vdr). Unfortunately the last official version of the plugin was published back in 2013 and even worse it has to be compiled against ffmpeg. The last working version of ffmpeg was 2.8.x,... (0 Replies)
Discussion started by: ACorner
0 Replies
iodbc-config(1) 					       iODBC Driver Manager						   iodbc-config(1)

NAME
iodbc-config - script to get information about the installed version of iODBC SYNOPSIS
iodbc-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs] [--static-libs] [--libtool-libs] [--odbcini] [--odbcin- stini] DESCRIPTION
iodbc-config is a tool that is used to configure to determine the compiler and linker flags that should be used to compile and link pro- grams that use iODBC. OPTIONS
iodbc-config accepts the following options: --version Print the currently installed version of iODBC on the standard output. --cflags Print the compiler flags that are necessary to compile an iODBC program. --libs Print the linker flags that are necessary to link an iODBC program using dynamic libraries (if supported). --static-libs Print the linker flags that are necessary to link an iODBC program using static libraries. --libtool-libs Print the linker flags that are necessary to link an iODBC program in a libtool environment. --odbcini Print the path of the system wide odbc.ini file. --odbcinstini Print the path of the system wide odbcinst.ini file. --prefix[=PREFIX] If specified, use PREFIX instead of the installation prefix that iODBC was built with when computing the output for the --cflags and --libs options. This option is also used for the exec prefix if --exec-prefix was not specified. This option must be specified before any --libs or --cflags options. If PREFIX is not specified, the --prefix flag shows where iODBC is currently installed. --exec-prefix=PREFIX If specified, use PREFIX instead of the installation exec prefix that iODBC was built with when computing the output for the --cflags and --libs options. This option must be specified before any --libs or --cflags options. EXAMPLES
To compile a program that calls the iODBC API, make sure the iodbc-config program can be found in the PATH environment variable, before using the following Makefile fragment: CFLAGS=`iodbc-config --cflags` LDLIBS=`iodbc-config --libs` iodbctest: iodbctest.c cc $(CFLAGS) -o iodbctest iodbctest.c $(LDLIBS) COPYRIGHT
Copyright (C) 1996-2004 by OpenLink Software AUTHOR
iODBC Administrator <iodbc@openlinksw.com> 3.52.6 16 June 2004 iodbc-config(1)
All times are GMT -4. The time now is 02:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy