Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » OS X Dynamic Library will not link
OS X Dynamic Library will not link [message #148300] Wed, 06 July 2005 20:23 Go to next message
Mike Jackson is currently offline Mike JacksonFriend
Messages: 23
Registered: July 2009
Junior Member
I am trying to build a dynamic library from existing source code
checked out from CVS. We have an existing Makefile which I moved to the
side as it doesn't really work that well and chose to use a "Managed
C++ Makefile" project. The code seems to compile ok but fails on the
linking stage.
I can use my own makefile (the one I moved to the side) and the code
compiles and links just fine. Since I am a bit new to C++ I am not sure
if the problem is in the compiling stage and that is causing the errors
in the linking stage, or the problem really is in the linking stage.

Here is the final Compile step:

Building file: ../Adaptors/ProgressBarUpdate.cpp
Invoking: GCC C++ Compiler
g++ -D_DEBUG -D_COMPILING_USUL -I/Users/mjackson/Library/Eclipse/ -O0
-g -c -arch ppc -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks
-Wreturn-type -Wunused-variable -fmessage-length=0 -ffix-and-continue
-mtune=G4 -oAdaptors/ProgressBarUpdate.o
.../Adaptors/ProgressBarUpdate.cpp
Finished building: ../Adaptors/ProgressBarUpdate.cpp

and then the link step:

Building target: Usul.dylib
Invoking: MacOS X C++ Linker
g++ -Wl,-dylib -o Usul.dylib ./Types/Types.o ./Threads/Mutex.o
../System/Host.o ./System/LastError.o ./System/Memory.o
../System/Screen.o ./System/Socket.o ./State/Busy.o
../Shared/Preferences.o ./Resources/CancelButton.o
../Resources/EventQueue.o ./Resources/ProgressBar.o
../Resources/ReportErrors.o ./Resources/StatusBar.o
../Resources/TextWindow.o ./ID/GUID.o ./File/Temp.o ./Errors/Stack.o
../Documents/Document.o ./Documents/Manager.o ./DLL/Library.o
../DLL/Loader.o ./Components/Manager.o ./Components/Object.o
../Components/Registry.o ./CommandLine/Arguments.o ./Base/Referenced.o
../Base/Typed.o ./Adaptors/ProgressBarUpdate.o
/usr/bin/ld: /usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../crt1.o
LC_LOAD_DYLINKER load command in object file (should not be in an input
file to the link editor for the output file type MH_DYLIB)
collect2: ld returned 1 exit status
make: *** [Usul.dylib] Error 1
make: Target `all' not remade because of errors.
Build complete for project Usul

Here is the same thing, but from my own makefile:

[Usul]:Compiling Adaptors/ProgressBarUpdate.cpp into
Darwin/Adaptors/ProgressBarUpdate.o
g++ -g -D_DEBUG -D_COMPILING_USUL -x c++ -arch ppc -pipe
-Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type
-Wunused-variable -fmessage-length=0 -ffix-and-continue -mtune=G4
-I../ -c Adaptors/ProgressBarUpdate.cpp -o
Darwin/Adaptors/ProgressBarUpdate.o

and the Link Step:

g++ -dynamiclib -install_name libUsul.dylib -g
Darwin/Adaptors/ProgressBarUpdate.o Darwin/Base/Referenced.o
Darwin/Base/Typed.o Darwin/CommandLine/Arguments.o
Darwin/Components/Manager.o Darwin/Components/Object.o
Darwin/Components/Registry.o Darwin/DLL/Library.o Darwin/DLL/Loader.o
Darwin/Documents/Document.o Darwin/Documents/Manager.o
Darwin/Errors/Stack.o Darwin/File/Temp.o Darwin/ID/GUID.o
Darwin/Resources/CancelButton.o Darwin/Resources/EventQueue.o
Darwin/Resources/ProgressBar.o Darwin/Resources/ReportErrors.o
Darwin/Resources/StatusBar.o Darwin/Resources/TextWindow.o
Darwin/Shared/Preferences.o Darwin/State/Busy.o Darwin/System/Host.o
Darwin/System/LastError.o Darwin/System/Memory.o Darwin/System/Screen.o
Darwin/System/Socket.o Darwin/Threads/Mutex.o Darwin/Types/Types.o -o
Darwin/libUsul.dylib

Yes there are differences, but I am not really sure which one might be
causing the problems. Anyone have any ideas? Would like to switch to
Eclipse and be done with Xcode.

Mike Jackson
Re: OS X Dynamic Library will not link [message #148308 is a reply to message #148300] Wed, 06 July 2005 20:43 Go to previous messageGo to next message
Mike Jackson is currently offline Mike JacksonFriend
Messages: 23
Registered: July 2009
Junior Member
On 2005-07-06 16:23:41 -0400, Mike Jackson <maillist@bluequartz.net> said:

> I am trying to build a dynamic library from existing source code
> checked out from CVS. We have an existing Makefile which I moved to the
> side as it doesn't really work that well and chose to use a "Managed
> C++ Makefile" project. The code seems to compile ok but fails on the
> linking stage.
> I can use my own makefile (the one I moved to the side) and the code
> compiles and links just fine. Since I am a bit new to C++ I am not sure
> if the problem is in the compiling stage and that is causing the errors
> in the linking stage, or the problem really is in the linking stage.
>
> Here is the final Compile step:
>
> Building file: ../Adaptors/ProgressBarUpdate.cpp
> Invoking: GCC C++ Compiler
> g++ -D_DEBUG -D_COMPILING_USUL -I/Users/mjackson/Library/Eclipse/ -O0
> -g -c -arch ppc -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks
> -Wreturn-type -Wunused-variable -fmessage-length=0 -ffix-and-continue
> -mtune=G4 -oAdaptors/ProgressBarUpdate.o
> ../Adaptors/ProgressBarUpdate.cpp
> Finished building: ../Adaptors/ProgressBarUpdate.cpp
>
> and then the link step:
>
> Building target: Usul.dylib
> Invoking: MacOS X C++ Linker
> g++ -Wl,-dylib -o Usul.dylib ./Types/Types.o ./Threads/Mutex.o
> ./System/Host.o ./System/LastError.o ./System/Memory.o
> ./System/Screen.o ./System/Socket.o ./State/Busy.o
> ./Shared/Preferences.o ./Resources/CancelButton.o
> ./Resources/EventQueue.o ./Resources/ProgressBar.o
> ./Resources/ReportErrors.o ./Resources/StatusBar.o
> ./Resources/TextWindow.o ./ID/GUID.o ./File/Temp.o ./Errors/Stack.o
> ./Documents/Document.o ./Documents/Manager.o ./DLL/Library.o
> ./DLL/Loader.o ./Components/Manager.o ./Components/Object.o
> ./Components/Registry.o ./CommandLine/Arguments.o ./Base/Referenced.o
> ./Base/Typed.o ./Adaptors/ProgressBarUpdate.o
> /usr/bin/ld: /usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../crt1.o
> LC_LOAD_DYLINKER load command in object file (should not be in an input
> file to the link editor for the output file type MH_DYLIB)
> collect2: ld returned 1 exit status
> make: *** [Usul.dylib] Error 1
> make: Target `all' not remade because of errors.
> Build complete for project Usul
>
> Here is the same thing, but from my own makefile:
>
> [Usul]:Compiling Adaptors/ProgressBarUpdate.cpp into
> Darwin/Adaptors/ProgressBarUpdate.o
> g++ -g -D_DEBUG -D_COMPILING_USUL -x c++ -arch ppc -pipe
> -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type
> -Wunused-variable -fmessage-length=0 -ffix-and-continue -mtune=G4
> -I../ -c Adaptors/ProgressBarUpdate.cpp -o
> Darwin/Adaptors/ProgressBarUpdate.o
>
> and the Link Step:
>
> g++ -dynamiclib -install_name libUsul.dylib -g
> Darwin/Adaptors/ProgressBarUpdate.o Darwin/Base/Referenced.o
> Darwin/Base/Typed.o Darwin/CommandLine/Arguments.o
> Darwin/Components/Manager.o Darwin/Components/Object.o
> Darwin/Components/Registry.o Darwin/DLL/Library.o Darwin/DLL/Loader.o
> Darwin/Documents/Document.o Darwin/Documents/Manager.o
> Darwin/Errors/Stack.o Darwin/File/Temp.o Darwin/ID/GUID.o
> Darwin/Resources/CancelButton.o Darwin/Resources/EventQueue.o
> Darwin/Resources/ProgressBar.o Darwin/Resources/ReportErrors.o
> Darwin/Resources/StatusBar.o Darwin/Resources/TextWindow.o
> Darwin/Shared/Preferences.o Darwin/State/Busy.o Darwin/System/Host.o
> Darwin/System/LastError.o Darwin/System/Memory.o Darwin/System/Screen.o
> Darwin/System/Socket.o Darwin/Threads/Mutex.o Darwin/Types/Types.o -o
> Darwin/libUsul.dylib
>
> Yes there are differences, but I am not really sure which one might be
> causing the problems. Anyone have any ideas? Would like to switch to
> Eclipse and be done with Xcode.
>
> Mike Jackson

Replying to my own post, the linker on OS X 10.4.1 using GCC 4.0.0
(Apple Computer, Inc. build 5026) does not seem to like the default
setting of -Wl,dylib for a shared library. If I uncheck the box for
those flags and put in "-dynamiclib" as a linker flag then the library
links just fine.
Is this a bug in the default config for the OS X version of CDT or
something else that I am missing?

Mike Jackson
Re: OS X Dynamic Library will not link [message #148476 is a reply to message #148308] Fri, 08 July 2005 18:45 Go to previous message
Eclipse UserFriend
Originally posted by: gwatson.lanl.gov

Probably a bug. Please open a bug report on it.

Greg

Mike Jackson wrote:
> On 2005-07-06 16:23:41 -0400, Mike Jackson <maillist@bluequartz.net> said:
>
>> I am trying to build a dynamic library from existing source code
>> checked out from CVS. We have an existing Makefile which I moved to
>> the side as it doesn't really work that well and chose to use a
>> "Managed C++ Makefile" project. The code seems to compile ok but fails
>> on the linking stage.
>> I can use my own makefile (the one I moved to the side) and the code
>> compiles and links just fine. Since I am a bit new to C++ I am not
>> sure if the problem is in the compiling stage and that is causing the
>> errors in the linking stage, or the problem really is in the linking
>> stage.
>>
>> Here is the final Compile step:
>>
>> Building file: ../Adaptors/ProgressBarUpdate.cpp
>> Invoking: GCC C++ Compiler
>> g++ -D_DEBUG -D_COMPILING_USUL -I/Users/mjackson/Library/Eclipse/ -O0
>> -g -c -arch ppc -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks
>> -Wreturn-type -Wunused-variable -fmessage-length=0 -ffix-and-continue
>> -mtune=G4 -oAdaptors/ProgressBarUpdate.o
>> ../Adaptors/ProgressBarUpdate.cpp
>> Finished building: ../Adaptors/ProgressBarUpdate.cpp
>>
>> and then the link step:
>>
>> Building target: Usul.dylib
>> Invoking: MacOS X C++ Linker
>> g++ -Wl,-dylib -o Usul.dylib ./Types/Types.o ./Threads/Mutex.o
>> ./System/Host.o ./System/LastError.o ./System/Memory.o
>> ./System/Screen.o ./System/Socket.o ./State/Busy.o
>> ./Shared/Preferences.o ./Resources/CancelButton.o
>> ./Resources/EventQueue.o ./Resources/ProgressBar.o
>> ./Resources/ReportErrors.o ./Resources/StatusBar.o
>> ./Resources/TextWindow.o ./ID/GUID.o ./File/Temp.o ./Errors/Stack.o
>> ./Documents/Document.o ./Documents/Manager.o ./DLL/Library.o
>> ./DLL/Loader.o ./Components/Manager.o ./Components/Object.o
>> ./Components/Registry.o ./CommandLine/Arguments.o ./Base/Referenced.o
>> ./Base/Typed.o ./Adaptors/ProgressBarUpdate.o
>> /usr/bin/ld: /usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../crt1.o
>> LC_LOAD_DYLINKER load command in object file (should not be in an
>> input file to the link editor for the output file type MH_DYLIB)
>> collect2: ld returned 1 exit status
>> make: *** [Usul.dylib] Error 1
>> make: Target `all' not remade because of errors.
>> Build complete for project Usul
>>
>> Here is the same thing, but from my own makefile:
>>
>> [Usul]:Compiling Adaptors/ProgressBarUpdate.cpp into
>> Darwin/Adaptors/ProgressBarUpdate.o
>> g++ -g -D_DEBUG -D_COMPILING_USUL -x c++ -arch ppc -pipe
>> -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type
>> -Wunused-variable -fmessage-length=0 -ffix-and-continue -mtune=G4
>> -I../ -c Adaptors/ProgressBarUpdate.cpp -o
>> Darwin/Adaptors/ProgressBarUpdate.o
>>
>> and the Link Step:
>>
>> g++ -dynamiclib -install_name libUsul.dylib -g
>> Darwin/Adaptors/ProgressBarUpdate.o Darwin/Base/Referenced.o
>> Darwin/Base/Typed.o Darwin/CommandLine/Arguments.o
>> Darwin/Components/Manager.o Darwin/Components/Object.o
>> Darwin/Components/Registry.o Darwin/DLL/Library.o Darwin/DLL/Loader.o
>> Darwin/Documents/Document.o Darwin/Documents/Manager.o
>> Darwin/Errors/Stack.o Darwin/File/Temp.o Darwin/ID/GUID.o
>> Darwin/Resources/CancelButton.o Darwin/Resources/EventQueue.o
>> Darwin/Resources/ProgressBar.o Darwin/Resources/ReportErrors.o
>> Darwin/Resources/StatusBar.o Darwin/Resources/TextWindow.o
>> Darwin/Shared/Preferences.o Darwin/State/Busy.o Darwin/System/Host.o
>> Darwin/System/LastError.o Darwin/System/Memory.o
>> Darwin/System/Screen.o Darwin/System/Socket.o Darwin/Threads/Mutex.o
>> Darwin/Types/Types.o -o Darwin/libUsul.dylib
>>
>> Yes there are differences, but I am not really sure which one might be
>> causing the problems. Anyone have any ideas? Would like to switch to
>> Eclipse and be done with Xcode.
>>
>> Mike Jackson
>
>
> Replying to my own post, the linker on OS X 10.4.1 using GCC 4.0.0
> (Apple Computer, Inc. build 5026) does not seem to like the default
> setting of -Wl,dylib for a shared library. If I uncheck the box for
> those flags and put in "-dynamiclib" as a linker flag then the library
> links just fine.
> Is this a bug in the default config for the OS X version of CDT or
> something else that I am missing?
>
> Mike Jackson
>
Previous Topic:Can CDT3.0 plugin to the Eclipse 3.1?
Next Topic:Problem with CDT3.0: The CPU is not supported by selected debugger.
Goto Forum:
  


Current Time: Sat Jul 27 16:51:15 GMT 2024

Powered by FUDForum. Page generated in 5.03387 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top