Recent

Author Topic: [SOLVED] Fresh OS X El Capitan - Lazarus 1.6 RC2 and fpc 3.0.0 problem  (Read 4897 times)

Shebuka

  • Sr. Member
  • ****
  • Posts: 427
Hi coding m8s!
I've recently upgraded my iMac to SSD with fresh and clean El Capitan installation. On the "old" system I was using Lazarus trunk svn and fpc 2.6.4. Then I've installed all latest developer tools and started testing if all is still working. Sadly Lazarus 1.6 RC2 with fpc 3.0.0 and fpcsrc 3.0.0 is not working as supposed... My projects are complaining about few things:

1:
Code: Pascal  [Select][+][-]
  1. copy(s, 2, length(s));
Error: illegal expression

solved with:
Code: Pascal  [Select][+][-]
  1. s := copy(s, 2, length(s));
yes, it was an actual bug in the code... but why on the old system it was ok and now it's an error?

going forward 2:
(preemption, i'm using lNet on my network stack, this is my utility function that gets me the ip of the host i'm trying to contact)
Code: Pascal  [Select][+][-]
  1. var
  2.   s: longint;
  3.   l: Integer;
  4.   lsa: TLSocketAddress;
  5.   sa: psockaddr;
  6.   sl: TSocklen;
  7. begin
  8.   result := '';
  9.  
  10.   FillAddressInfo(lsa, AF_INET, address, Port);
  11.  
  12.   s := fpSocket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
  13.   sa := psockaddr(@lsa.IPv4);
  14.   sl := Sizeof(lsa.IPv4);
  15.  
  16.   l := fpConnect(s, sa, sl);
  17.   l := LSocketError();
  18.   if IsBlockError(l) then
  19.     if l <> 0 then
  20.     begin
  21.       result := '0.0.0.0';
  22.       exit;
  23.     end;
  24.  
  25.   lsa.IPv4.sin_addr.s_addr := 0;
  26.   l := Sizeof(lsa);
  27.   fpgetsockname(s, @lsa, @l);
  28.  
  29.   result := NetAddrToStr(lsa.IPv4.addr);       <--- Error here
  30.   CloseSocket(s);
  31.  
Error: identifier idents no member "addr" (on line 29)

solved with:
Code: Pascal  [Select][+][-]
  1. result := NetAddrToStr(lsa.IPv4.sin_addr.s_addr);

Last one took a bit to digg out and after all that digging this is what came out:
* Units StrUtils, DateUtils and Sockets can't be found by Lazarus, are there some replacement units?;
* If I comment one of units that Lazarus can't find I get a train full of errors;
* dateutils.inc is not included by anyone in fpcsrc, and there is no dateutils.pas/pp/p, do Lazarus look inside .inc sources for units?;
* The above units are also missing in 3.0.0 makefile http://svn.freepascal.org/svn/fpc/trunk/rtl/darwin/Makefile.fpc while there were present in 2.6.4;
* Why lNet is shipped as part of fpcsrc, doesn't this create some confusion when I put my customized lNet inside Lazarus components folder?;
* sockaddr_in record, that is the IPv4 of TLSocketAddress inside socketsh.inc, was changed?.

Can you help me solve all or part of my issues?
« Last Edit: February 17, 2016, 03:54:58 pm by Shebuka »

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1058
Re: Fresh OS X El Capitan - Lazarus 1.6 RC2 and fpc 3.0.0 problem
« Reply #1 on: February 11, 2016, 10:40:20 am »
1:
Code: Pascal  [Select][+][-]
  1. copy(s, 2, length(s));
Error: illegal expression

solved with:
Code: Pascal  [Select][+][-]
  1. s := copy(s, 2, length(s));
yes, it was an actual bug in the code... but why on the old system it was ok and now it's an error?
Fixed compiler bug, it seems.

Quote
Last one took a bit to digg out and after all that digging this is what came out:
* Units StrUtils, DateUtils and Sockets can't be found by Lazarus, are there some replacement units?;
These units are still included with FPC 3.0, and should be found.

Quote
* If I comment one of units that Lazarus can't find I get a train full of errors;
* dateutils.inc is not included by anyone in fpcsrc, and there is no dateutils.pas/pp/p, do Lazarus look inside .inc sources for units?;
This suggests that you have added the FPC source directories to the unit search path. Never do that.

Quote
* The above units are also missing in 3.0.0 makefile http://svn.freepascal.org/svn/fpc/trunk/rtl/darwin/Makefile.fpc while there were present in 2.6.4;
They have been moved to http://svn.freepascal.org/svn/fpc/trunk/packages/rtl-objpas/, and are shipped as such with FPC 3.0.

Quote
* Why lNet is shipped as part of fpcsrc, doesn't this create some confusion when I put my customized lNet inside Lazarus components folder?;
lnet is used by fppkg (http://wiki.freepascal.org/fppkg ). Over time, the plan is indeed to remove it from fpcsrc. You customised lnet should override the default one, because your copy's unit path will be passed explicitly to the compiler and hence be found first.

Quote
* sockaddr_in record, that is the IPv4 of TLSocketAddress inside socketsh.inc, was changed?.
That seems to be a change that is missing documentation at http://wiki.freepascal.org/User_Changes_3.0

Shebuka

  • Sr. Member
  • ****
  • Posts: 427
Re: Fresh OS X El Capitan - Lazarus 1.6 RC2 and fpc 3.0.0 problem
« Reply #2 on: February 11, 2016, 11:33:46 am »
Hi Jonas,
thank you for replying.

Quote
Quote
Last one took a bit to digg out and after all that digging this is what came out:
* Units StrUtils, DateUtils and Sockets can't be found by Lazarus, are there some replacement units?;
These units are still included with FPC 3.0, and should be found.

Quote
* If I comment one of units that Lazarus can't find I get a train full of errors;
* dateutils.inc is not included by anyone in fpcsrc, and there is no dateutils.pas/pp/p, do Lazarus look inside .inc sources for units?;
This suggests that you have added the FPC source directories to the unit search path. Never do that.
This is a fresh installation from scratch of the system, no TimeMachine/CarbonCopy/whatever restore. I've installed fpcsrc, fpc, lazarus, copied a backup of gdb executable to proper directory, opened lazarus, added all the components i use in my project, made a rebuild of lazarus, opened my project.

This are my project build options:
Code: Text  [Select][+][-]
  1. -MObjFPC
  2. -Schi
  3. -CX
  4. -O3
  5. -Xs
  6. -XX
  7. -k-framework
  8. -kCarbon
  9. -k-framework
  10. -kOpenGL
  11. -k-dylib_file
  12. -k/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib
  13. -l
  14. -vewnhibq
  15. -vm5024
  16. -Fi../../dcu/i386-darwin
  17. -Fu../../src/Application/MacClient
  18. -Fu../../src/Unit/MacClient
  19. -Fu../../src/Unit/MacComponents
  20. -Fu/Developer/lazarus/components/virtualbuttontree/lib/i386-darwin
  21. -Fu/Developer/lazarus/components/bgracontrols/lib/i386-darwin/3.0.0
  22. -Fu/Developer/lazarus/components/virtualtreeview/lib/i386-darwin-carbon
  23. -Fu/Developer/lazarus/components/ideintf/units/i386-darwin/carbon
  24. -Fu/Developer/lazarus/components/uniqueinstance/lib/i386-darwin-carbon
  25. -Fu/Developer/lazarus/components/richmemo/lib/i386-darwin
  26. -Fu/Developer/lazarus/components/lclextensions-0.5/lib/i386-darwin-carbon
  27. -Fu/Developer/lazarus/components/lazcontrols/lib/i386-darwin/carbon
  28. -Fu/Developer/lazarus/components/bgrabitmap/lib/i386-darwin/3.0.0
  29. -Fu/Developer/lazarus/lcl/units/i386-darwin/carbon
  30. -Fu/Developer/lazarus/lcl/units/i386-darwin
  31. -Fu/Developer/lazarus/components/lazutils/lib/i386-darwin
  32. -Fu/Developer/lazarus/components/csvdocument/lib/i386-darwin
  33. -Fu/Developer/lazarus/components/lnet/lazaruspackage/lib/i386-darwin
  34. -Fu/Developer/lazarus/packager/units/i386-darwin
  35. -Fu.
  36. -FU../../dcu/i386-darwin
  37. -dLCL
  38. -dLCLcarbon
  39. -k-macosx_version_min
  40. -k10.6
  41. -XR/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1058
Re: Fresh OS X El Capitan - Lazarus 1.6 RC2 and fpc 3.0.0 problem
« Reply #3 on: February 15, 2016, 08:41:28 am »
Try compiling with -vtu to see where the compiler is looking for units and source files, and which files it finds (and does not find).

Shebuka

  • Sr. Member
  • ****
  • Posts: 427
Re: Fresh OS X El Capitan - Lazarus 1.6 RC2 and fpc 3.0.0 problem
« Reply #4 on: February 17, 2016, 03:47:09 pm »
I found the root of the problem. It's fpcdefines.xml that was copied from the old config. Lazarus has recognized that there is a new fpc 3.0.0 version and created new FPCConfigs entries, but didn't reindexed FPCSources from the new the fpcsrc 3.0.0 (maybe because the actual path was the same?)... bug or intended?
« Last Edit: February 17, 2016, 03:54:30 pm by Shebuka »

 

TinyPortal © 2005-2018