OS X Dynamic Library will not link [message #148300] |
Wed, 06 July 2005 16:23  |
Eclipse User |
|
|
|
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 #148476 is a reply to message #148308] |
Fri, 08 July 2005 14:45  |
Eclipse User |
|
|
|
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
>
|
|
|
Powered by
FUDForum. Page generated in 0.03144 seconds