OS X - Development and Darwin Discussion and questions about development for Mac OS X.

creating dynamic libraries on MAC


Post Reply New Thread Subscribe

 
Thread Tools
bhatiaharsh

 
Member Since: Apr 13, 2011
Posts: 2
bhatiaharsh is on a distinguished road

bhatiaharsh is offline
Hi,

I have to create two dynamic libraries from two projects 'basic' and 'lia', where lia depends upon basic. I have created and used both successfully on linux, but when I try to compile the same on mac it creates an issue.

--------- Linux
Here are the commands that my makefile generates

g++ -m64 -Wl,-O1 -shared -o libbasic.so obj/arg.o obj/basic.o obj/cb.o obj/cb_doprnt.o obj/counter.o obj/files.o obj/getarg.o obj/isort.o obj/istaque.o obj/malloc.o obj/math2.o obj/prime.o obj/qsort.o obj/time.o obj/tokenize.o obj/uhash.o -L/usr/lib64 -lQtGui -L/usr/lib64 -L/usr/X11R6/lib64 -pthread -lpng -lfreetype -lSM -lICE -pthread -pthread -lXrender -lXrandr -lXfixes -lXcursor -lXinerama -lfontconfig -lXext -lX11 -lQtCore -lz -lm -pthread -lgthread-2.0 -lrt -lglib-2.0 -ldl -lpthread
mv -f libbasic.so ../lib.linux64/

g++ -m64 -Wl,-O1 -shared -o liblia.so obj/aux.o obj/chars.o obj/det.o obj/lia.o obj/pool.o obj/stack.o obj/test.o -L/usr/lib64 -lQtGui -L/usr/lib64 -L/usr/X11R6/lib64 -pthread -lpng -lfreetype -lSM -lICE -pthread -pthread -lXrender -lXrandr -lXfixes -lXcursor -lXinerama -lfontconfig -lXext -lX11 -lQtCore -lz -lm -pthread -lgthread-2.0 -lrt -lglib-2.0 -ldl -lpthread
mv -f liblia.so ../lib.linux64/

-------------- MAC

When I try to compile on mac, basic goes fine. But in linking of lia, it throws a linking error.

g++ -headerpad_max_install_names -single_module -dynamiclib -o liblia.dylib obj/aux.o obj/chars.o obj/det.o obj/lia.o obj/pool.o obj/stack.o obj/test.o -F/Library/Frameworks -L/Library/Frameworks -framework QtGui -framework QtCore
Undefined symbols:
"_basic_error", referenced from:
_lia_maximum in aux.o
...
_test1 in test.o
"_basic_ipower", referenced from:
_lia_ffpload in aux.o
"_basic_malloc", referenced from:
_lia_strload in aux.o
...
_lia_push in stack.o
"_basic_strip", referenced from:
_main in test.o
..... (and many more)

Thus, all the functions in 'basic' go unlinked. Could someone illuminate the difference between linux and max wrt this ? Why do i need 'basic' lib to create 'lia' lib on mac ?
QUOTE Thanks
bhatiaharsh

 
Member Since: Apr 13, 2011
Posts: 2
bhatiaharsh is on a distinguished road

bhatiaharsh is offline
Also, if I try to build these libraries as static libs, both 'basic' and 'lia' are built successfully. I dont understand how dynamic linking works on mac.
QUOTE Thanks
elhassan

 
Member Since: Jun 17, 2011
Posts: 1
elhassan is on a distinguished road

elhassan is offline
Hi

I am stuck on same point however I did not try static building, have u find a solution about dynamic building u mentioned
QUOTE Thanks

Post Reply New Thread Subscribe


« how to record audio using QTKit | AudioUnits Example Projects »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
A Switchers guide to recommended free Apps to download to your new Mac the8thark Switcher Hangout 67 03-19-2013 10:48 AM
Data Partition: Using a FAT32 Partition to exchange data between Mac and Windows XP MartinT Running Windows (or anything else) on your Mac 9 11-12-2009 02:56 AM
Running Windows on Mac rickmahmoud Running Windows (or anything else) on your Mac 7 02-16-2008 11:31 PM
Mac Users Get More ISP Choices schweb Apple Rumors and Reports 1 03-06-2003 10:57 AM

All times are GMT -4. The time now is 07:35 AM.

Powered by vBulletin
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?