Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2013-05

$LINKLIB or $LINK in Lazarus/FPC on Mac OSX

8 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author

Hello:

I am new to the list, I have posted on the forum, but I don't really know where the center of gravity is for this FPC/Lazarus Community, so I will post on the mailing lists as well. And then I do not know if the Mac List is well subscribed or just the general fpc-pascal list is better
subscribed.

I am trying to compile C code with Xcode into a static library or static object files. I already have a mylib.a file ready to link if I could just figure out the $LINKLIB syntax of dot.a library files.

I want to use either $LINKLIB or $LINK compiler directives to tell freepascal/lazarus to link the code STATICALLY into my binary.

The $LINK would require an object file, so I would need to dig around xcode to find out there the bloody thing puts the intermediate object files (Maybe Mach-O?)

What I am trying to avoid is linking to a dylib dynamically. Only static linking for some portions of the code.

Thanks for any feedback,

md

Reply by email

Unknown author

Anybody have any success with the included units for CoreFoundation on Mac OSX.

I was trying to use CFSetGetCount( ) function call, it is clearly defined in CFSet.pas
and yet the linker error is:

Identifier Not Found "CFSetGetCount"

But magically, the constants from CFBase.pas compile OK, so it must be the compiler directives at the top of CFSET.pas that are preventing that code from getting included and visible by the compiler.

#################################
program testcfset;
uses
   CFBase, CFSet ;
var
  fcnt : single ;
  ret : integer ;
begin
  fcnt := kCFCoreFoundationVersionNumber10_2 ;
  ret := CFSetGetCount(nil) ;
end.

{ Compiler messages Below:
testcfset.lpr(6,2) Note: Local variable "fcnt" is assigned but never used testcfset.lpr(7,2) Note: Local variable "ret" is assigned but never used ld: symbol(s) not found for architecture i386
Undefined symbols for architecture i386:
"_CFSetGetCount", referenced from:
_PASCALMAIN in testcfset.o
ld: symbol(s) not found for architecture i386
An error occurred while linking
testcfset.lpr(10,2) Error: Error while linking
testcfset.lpr(10,2) Fatal: There were 1 errors compiling module, stopping }
##################################

On another project before I built the test project, I saw these errors:

ld : symbol(s) not found for architecture i386.

Undefined symbols for architecture i386:
"_CFSetGetCount" referenced from : (my code mangled name)

Anybody have a clue how to force the compiler to see and use CFSet.ppu from inside /usr/local/lib/fpc/2.6.2/

My machine in Mac Mini 2010 with OSX Lion and XCode 4.6.2 Apr 15 with command line tools of same date.

I am working under Lazarus 1.08. All the PPU files are where they should be.

Somebody from the Mac Guru crowd have any comments

Thanks,

md

Reply by email

Unknown author
to Unknown author

I thought of a trick to get around this.

Using XCode, I can build a static library to get me access to the functions that I need.

But that is not really the point, I would like my freepascal environment to be correct
and to be able to use the functions contained in interface files like cfset.pas.

Any comment

Cheers,

md

Show quoted text 69 lines
Anybody have any success with the included units for CoreFoundation on Mac OSX. I was trying to use CFSetGetCount( ) function call, it is clearly defined in CFSet.pas and yet the linker error is: Identifier Not Found "CFSetGetCount" But magically, the constants from CFBase.pas compile OK, so it must be the compiler directives at the top of CFSET.pas that are preventing that code from getting included and visible by the compiler. ################################# program testcfset; uses CFBase, CFSet ; var fcnt : single ; ret : integer ; begin fcnt := kCFCoreFoundationVersionNumber10_2 ; ret := CFSetGetCount(nil) ; end. { Compiler messages Below: testcfset.lpr(6,2) Note: Local variable "fcnt" is assigned but never used testcfset.lpr(7,2) Note: Local variable "ret" is assigned but never used ld: symbol(s) not found for architecture i386 Undefined symbols for architecture i386: "_CFSetGetCount", referenced from: _PASCALMAIN in testcfset.o ld: symbol(s) not found for architecture i386 An error occurred while linking testcfset.lpr(10,2) Error: Error while linking testcfset.lpr(10,2) Fatal: There were 1 errors compiling module, stopping } ################################## On another project before I built the test project, I saw these errors: ld : symbol(s) not found for architecture i386. Undefined symbols for architecture i386: "_CFSetGetCount" referenced from : (my code mangled name) Anybody have a clue how to force the compiler to see and use CFSet.ppu from inside /usr/local/lib/fpc/2.6.2/ My machine in Mac Mini 2010 with OSX Lion and XCode 4.6.2 Apr 15 with command line tools of same date. I am working under Lazarus 1.08. All the PPU files are where they should be. Somebody from the Mac Guru crowd have any comments Thanks, md _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Unknown author
to Unknown author

Well, that trick did not work so well.

I was forced to finally copy the system library to a common development directory
and renaming CoreFoundation -> libCoreFoundation.a and copying the function call
out of CFSet.pas into my own pascal unit file.

Only then did I get the linker to work correctly and finish constructing the binary.

This of course says nothing about all that interface code sitting down in /usr/local/xxx/CFSet.pas, which is part
of the core foundation.

So again, any comments this week from the freepascal team, that would be great.

Cheers,

md

Show quoted text 94 lines
I thought of a trick to get around this. Using XCode, I can build a static library to get me access to the functions that I need. But that is not really the point, I would like my freepascal environment to be correct and to be able to use the functions contained in interface files like cfset.pas. Any comment Cheers, md On 5/4/2013 10:20 PM, wrote: > Anybody have any success with the included units for > CoreFoundation on Mac OSX. > > > > I was trying to use CFSetGetCount( ) function call, it is clearly > defined in CFSet.pas > and yet the linker error is: > > Identifier Not Found "CFSetGetCount" > > But magically, the constants from CFBase.pas compile OK, so it must > be the compiler directives at the top of CFSET.pas that are preventing > that code from getting included and visible by the compiler. > > ################################# > program testcfset; > > uses > CFBase, CFSet ; > var > fcnt : single ; > ret : integer ; > begin > fcnt := kCFCoreFoundationVersionNumber10_2 ; > ret := CFSetGetCount(nil) ; > end. > > { Compiler messages Below: > testcfset.lpr(6,2) Note: Local variable "fcnt" is assigned but never > used > testcfset.lpr(7,2) Note: Local variable "ret" is assigned but never used > ld: symbol(s) not found for architecture i386 > Undefined symbols for architecture i386: > "_CFSetGetCount", referenced from: > _PASCALMAIN in testcfset.o > ld: symbol(s) not found for architecture i386 > An error occurred while linking > testcfset.lpr(10,2) Error: Error while linking > testcfset.lpr(10,2) Fatal: There were 1 errors compiling module, > stopping > } > ################################## > > On another project before I built the test project, > I saw these errors: > > ld : symbol(s) not found for architecture i386. > > Undefined symbols for architecture i386: > "_CFSetGetCount" referenced from : (my code mangled name) > > Anybody have a clue how to force the compiler to see and use CFSet.ppu > from inside /usr/local/lib/fpc/2.6.2/ > > My machine in Mac Mini 2010 with OSX Lion and XCode 4.6.2 Apr 15 with > command line tools of same date. > > I am working under Lazarus 1.08. All the PPU files are where they > should be. > > Somebody from the Mac Guru crowd have any comments > > Thanks, > > md > > > _______________________________________________ > fpc-pascal maillist > http://lists.freepascal.org/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Unknown author
to Unknown author: I thought of a trick to get around this. Using XCode, I can build a static library to get…

Inside Lazarus 1.08/FPC 2.6.2, I cannot find where the console output is sent
while on Mac OSX Lion.

There is a debugger output window, but there does not seem to be a console output window while
debugging a program.

Where does writeln( ) output go?

If I run the program from the terminal, then I see the console output, but not so during debugging.

Any ideas?

Cheers,

md

Reply by email

Martin
to Unknown author
Show quoted text 12 lines
Inside Lazarus 1.08/FPC 2.6.2, I cannot find where the console output is sent while on Mac OSX Lion. There is a debugger output window, but there does not seem to be a console output window while debugging a program. Where does writeln( ) output go? If I run the program from the terminal, then I see the console output, but not so during debugging.

See this page. http://wiki.lazarus.freepascal.org/Debugger_Console_App

You can either redirect to a file, or to the pty of a terminal (which you have to open)

You can also set the pty in the global options (read the note on 0.9.31)

Unfortunately, still no one knows how to create a virtual tty on MAC. So it was not yet possible to add a proper way for the IDE to capture the output.

Reply by email

Unknown author
to Martin

Martin:

Thanks for this.

Fortunately, everything I want to do on command line will happen in Linux.

All the MAC OSX stuff is GUI with Lazarus.

Who ever created Lazarus is a total GOD!.

Delphi 7 for Windows.
Lazarus/FPC for Linux and MacOSX !!!

Hell, I am even writing a replication engine for MariaDB (mysql) in Freepascal.

Thank you for all!

md

Martin wrote 29 lines
On 05/05/2013 22:45, wrote: > Inside Lazarus 1.08/FPC 2.6.2, I cannot find where the console output > is sent > while on Mac OSX Lion. > > There is a debugger output window, but there does not seem to be a > console output window while > debugging a program. > > Where does writeln( ) output go? > > If I run the program from the terminal, then I see the console > output, but not so during debugging. See this page. http://wiki.lazarus.freepascal.org/Debugger_Console_App You can either redirect to a file, or to the pty of a terminal (which you have to open) You can also set the pty in the global options (read the note on 0.9.31) Unfortunately, still no one knows how to create a virtual tty on MAC. So it was not yet possible to add a proper way for the IDE to capture the output. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email