Lazarus Faq/ja

From Free Pascal wiki
Jump to navigationJump to search

العربية (ar) Deutsch (de) English (en) español (es) français (fr) magyar (hu) italiano (it) 日本語 (ja) 한국어 (ko) português (pt) русский (ru) slovenčina (sk) 中文(中国大陆)‎ (zh_CN) 中文(台灣)‎ (zh_TW)

日本語版メニュー
メインページ - Lazarus Documentation日本語版 - 翻訳ノート - 日本語障害情報

このFAQはwww.freepascal.orgからWikiにコピーされたので、保守、拡張しやすくなっています。

一般的なこと

どうしたらもっと他のFAQを見つけることができますか?

オフィシャルWEBサイトを見てください. 他のFAQが同様にあるかもしれません。

どうして出来たバイナリがこんなに大きいの?

バイナリはgdg(GNU Debugger)で使うための多くのデバッグ情報を含んでいるために大きくなります。

コンパイラには実行ファイルから、デバッグインフォメーションを除去するためのオプション(-Xs)があります。しかしながら、2.0.2と、以前のバージョンでは、コンパイラーのバグによって、これは正しく動きません。しかし、開発版ではすでにこのバグは修正されています。

また、デバッグシンボルを除去するために、"strip"というプログラムを利用することができます。Lazarusディレクトリの下の、lazarus\pp\bin\i386-win32\にあります。 コマンドラインで、 "strip --strip-all <実行ファイルパス>" とタイプするだけです。

もし、プログラムをもっと小さくしたいときは、UPX も試してみてください。UPXは実行ファイルの良い圧縮ツールです。圧縮を復元するためのメモリのオーバーヘッドはありません。Pentium 133で ~10MB/sec程度の高速な復元をおこないます。 upxを使うには、コマンドラインから、"upx <実行ファイルパス>" とタイプするだけです。

stripとupxをLazarusをおこなうと、単純なGUIプログラムは

  • ~ 700kb on Linux
  • ~ 420kb on Windows

になります。

もっと詳細な回答は、fpc:Size Mattersにあります。


The binaries are big because they include a lot of debug information necessary for using gdb (GNU Debugger).

The compiler has an option to remove the debug information from the executable (-Xs), but due to a bug in the compiler (version 2.0.2 and earlier), this doesn't work correctly. It has been fixed in the development version of the compiler.

You can use a program called "strip" to remove the debug symbols from the executable file. It is located under lazarus dir lazarus\pp\bin\i386-win32\.

Just type "strip --strip-all <your executable file with path>" on the command line.

If you want to make your program even smaller, you should try UPX too. UPX is a very good exe compressor. It includes no memory overhead due to in-place decompression. It also has a very fast decompression (~10 MB/sec on an Pentium 133).

To use upx just type "upx <your executable file with path>" on the command line.

after using both strip and upx a simple GUI Lazarus program gets:

  • ~ 700kb on Linux
  • ~ 420kb on Windows

A more detailed answer is given on fpc:Size Matters.

どうしてリンクがWindowsでは遅いのでしょうか?

一般的に、Windowsでのリンクは他のプラットホームでのリンクよりも時間がかかります。それは、Free Pascalで使われているGNU リンカが、Windowsでは動作が遅いからです。

テストとして、Lazarus 0.9.12ではLCLがスマートリンクされてリリースされていました。これで、以前のリリースとくらべ実行ファイルはstripとupxのあとで30%小さくなりました。しかし、この影響でリンク作業が複雑になり、他のGNU リンカの問題がでてきました。この問題についての調査はFile size and smartlinking/jaにあります。

この問題はWindowsのみで発生しています。そして、比較的古いか、メモリの少ないコンピュータ(1GHz以下、128MB以下)で顕著に現れます。内臓リンカも開発中なので、この問題を解決してくれるでしょう。しかし、準備できるまでにまだ時間がかかります。

しかし、現実的にこの問題を解決するにはどうしたらよいでしょうか。2つの選択肢があります。


  1. smart linkingをOffにしてください。Lazarusでは、 メニューで、Project -> Compiler Options -> Linking tabでチェックボックスをOffにするだけでは不十分です。Otherタブのcustom optionsで "-XS" を指定してください。アプリケーションをコンパイルすれば、スマートリンクされなくなります。
  2. LCLを再コンパイルしてください。メニューから"Tools" -> "Configure Build Lazarus"を選択します。LCLをclean+buildを指定し、その他のすべてを Noneに指定し、"Ok"を押します。そのあと、メニューから"Tools" -> "Build Lazarus"を選択してください。これでLCLはスマートリンクされなくなり、コンパイルが高速になります。しかし、実行ファイルサイズも大きくなります。

Just recompile your LCL. Open Lazarus. Go on the menu "Tools" -> "Configure Build Lazarus". Set LCL to clean+build and everything else to None and click "Ok". Now go on "Tools" -> "Build Lazarus". Now your LCL is no longer smartlinked and the compilation should be much faster, but your exes will be bigger too.


Generally speaking, compilation on Windows takes more time then other platforms because the GNU Linker utilized by Free Pascal is slow on this platform.

Also, as a test, Lazarus 0.9.12 was released with Smartlinked LCL. This means that executables are now about 30% smaller after strip and upx when compared to previous releases. This also means that the linking is much more complicated now and other GNU Linker problems appeared. A study about this is located here: File size and smartlinking

This problem only affects Windows, and is only bad on relatively old computers (less then 1Ghz) and computers with little RAM (128MB or less).

A internal linker is being developed. It should solve this, but will still take some time to be ready.

But how to solve this in the mean time? You have two options:

  1. Turn of smart linking. Unfortunately Lazarus unchecking the checkbox in Project -> Compiler Options -> Linking tab, is not enough. You must also add "-XS" to the custom options on the Other tab. If you compile your application, it will not use smartlinking.
  2. Just recompile your LCL. Open Lazarus. Go on the menu "Tools" -> "Configure Build Lazarus". Set LCL to clean+build and everything else to None and click "Ok". Now go on "Tools" -> "Build Lazarus". Now your LCL is no longer smartlinked and the compilation should be much faster, but your exes will be bigger too.

ppc386.cfg や fpc.cfgは必要でしょうか?

fpc.cfgのみ必要です。コンパイラがライブラリを見つけるための方法が書いてあります。

You only need fpc.cfg. This way the compiler knows where to find the libraries.

どうしたらLazarusをコンパイルできますか?

たとえば次のようにしてください。

$ cd lazarus
$ make clean all

Do something like this:

$ cd lazarus
$ make clean all

どのようにしたら、LCLをベースとした上に他のプロジェクトをビルドできますか?

もしアプリケーション作成にIDEを使えない場合、次の行をfpc.cfgの最後に入れてください。

  1. Add Lazarus libs
 -Fu/your.lazarus.root/lcl/units
 -Fu/your.lazarus.root/lcl/units/{YourToolKit}
 -Fu/your.lazarus.root/components/units
 -Fu/your.lazarus.root/components/units/{YourToolKit}
{YourToolKit} のところは、 GTK, Gnome , Win32 が入ります。

そして、下記を実行してください。

ppc386 your.project.pp


If you can't use the IDE to build your applications, add the following lines to the end of your fpc.cfg

  1. Add Lazarus libs
 -Fu/your.lazarus.root/lcl/units
 -Fu/your.lazarus.root/lcl/units/{YourToolKit}
 -Fu/your.lazarus.root/components/units
 -Fu/your.lazarus.root/components/units/{YourToolKit}
Where {YourToolKit} may be GTK, Gnome or Win32 and run:
ppc386 your.project.pp

どのバージョンのFPC(FreePascalCompiler)が必要ですか?

FPC Version 2.0.2 が推奨バージョンです。しかしながら、svn version の fpc 2.0.3 and 2.1.x.も使えます。

FPC Version 2.0.2 has been released, and that is the recommended version. You can also use the svn version of fpc 2.0.3 and 2.1.x.

Lazarusのコンパイルができません。

  1. コンパイラが正しいバージョンか、確認してください。
  2. fpcのライブラリが同じバージョンかどうか確認してください。
  3. fpc.cfgがあるかどうか、そして、古いppc386.cfgがないかどうか、確認してください。
  4. OS依存のFAQを確認してください。
  1. Check if the compiler has the correct version
  2. Check if the (fpc)libraries are from the same version.
  3. Check if you have a fpc.cfg and no old ppc386.cfg
  4. Check also the OS-dependent FAQs

プロジェクトをコンパイルしようとするとエラーがでます

"Cannot find Unit interfaces". これはどうしたら解決できますか?

このコンパイル済みのユニットは{LazarusDir}\lcl\units\{TargetCPU}-{TargetOS}\{LCLWidgetSet}\interfaces.ppuにあります。これが、ただ一つそこにあることを確認してください。もし、色んなバージョンのinterfaces.ppuがあると、たとえば、lclの検索パスのディレクトリに入っていたりすると、間違ったコンフィグレーションになっている可能性が高いです。全てのinterfaces.ppuを削除して、上記のディレクトリのみのものだけにしてください。

もし、これまで使ってきたwidgetsetと違うwidgetsetを選択した場合、そのwidgetset用にLCLをビルドする必要があります。

もし、このとおりになっていて、このエラーが発生した場合、コンパイルしているプロジェクト、利用しているLazarusIDE、とは異なったコンパイラの / rtlを使っています。この場合、次の事を試してください。

  • LCL(もしくは、完全にLazarusを)を環境オプション内で選択しているコンパイラでリビルドします。リビルドは、Tools -> Build Lazarus で行えます。 これを行う前に、Tools -> Configure Build Lazarusで、現在の設定を確認してください。
  • 環境オプションでコンパイラを、Lazarusをコンパイルしたものに変更してください。環境オプションで、Lazarusのパスが正しいかどうか、FPCのソースディレクトリが正しいかどうか、注意深く見てください。コンパイラコンフィグレーションファイルであるfpc.cfgがただ1つのバージョンのものがあるかどうか、確認してください。これは、Unixシステムでは、/etc/か、同じディレクトリに、Windowsシステムでは、fpcコンパイラと同じディレクトリにあります。

コンパイラを新しいバージョンにアップデートした場合、古いコピーが、しばしばこっそり残っています。これらは、ユーザーのホームディレクトリや、新しいコンパイラと同じディレクトリにあるかもしれません。これらを消去してください。

This compiled unit can be found in {LazarusDir}\lcl\units\{TargetCPU}-{TargetOS}\{LCLWidgetSet}\interfaces.ppu.

Make sure, it is only there. If you have multiple versions of interfaces.ppu, then you have probably have a wrong configuration (for instance you added a lcl directory to a search path). Remove all interfaces.ppu, but the one in the directory above.

If you selected a different widgetset than you used to build lazarus, you need to build the LCL for this widgetset.

If it is there, but you get this error, you are using a different compiler / rtl for compiling your project than you used for compiling your Lazarus IDE. You can do one of the following

  • Rebuild the LCL (or Lazarus completely) with the compiler selected in the Environmnent Options. You can this with Tools -> Build Lazarus. Before doing this, check the current settings in Tools -> Configure Build Lazarus.
  • Change the compiler in the Environment Options to the one you used to compile Lazarus. Look carefully also in the Environment Options to see if you are using the correct paths for the Lazarus Directory and the FPC sources directory. Check that there is only one version of the compiler configuration file fpc.cfg - it should reside in /etc/ for Linux/Unix systems or in the same directory as the fpc compiler for Windows systems. Rogue copies often creep in if you have updated your compiler to a new version; they may be found in your home directory or in the same directory as the one in which you built your new compiler. DELETE THESE!!

When I try to compile delphi projects under lazarus, I have an error

at the line :{$R *.DFM} How can I solve this problem ?

Lazarus (or better Linux) doesn't know about resources, so you can't use them in the way Delphi/win32 does. However Lazarus uses a method pretty compatible with this. You can still use your Delphi layouts (.dfm files) if you use the following steps:

  • You need a textual version of the .dfm files. D5 and higher are doing this as default. If you have older files: ALT-F12 to see the layout as text and paste/copy. When you have a text .dfm file, just copy it to a .lfm file.
  • Create a file with lazres (in lazarus/tools) lazres yourform.lrs yourform.lfm
  • Add the following initialization section to
     initialization
     {$I yourform.lrs}

Please keep in mind that not all properties in the dfm are supported yet by lazarus, so you might get a crash.

'Identifier not found LazarusResources'.

When creating a form Lazarus automaticaly add some extra units to the uses section of your form unit. During the conversion of a delphi unit to a Lazarus unit this does not happen. So you need to add LResources to the Uses section of your form unit.

When accessing events of objects e.g. the onclick event of a button I get the following error. ERROR unit not found: stdCtrls

Make sure, in the Project -> Project Inspector, that your project depends on the package 'LCL' and that you have installed the FPC sources.

Lazarus is the IDE and the visual components library LCL. All other stuff, like IO, Database, FCL and RTL are provided by FPC. The IDE needs the paths to all sources.

The FPC source path can be set via: Environment -> General Options -> Files -> FPC source path

How to embed a small file in the executable, without the need of a separate file? How to embed a resource?

For example:

/your/lazarus/path/tools/lazres sound.lrs sound1.wav sound2.wav ...

will create sound.lrs from sound1.wav and sound2.wav.

Then include it *behind* the form lrs file:

...
initialization
{$i unit1.lrs} // this is main resource file (first)
{$i sound.lrs} // user defined resource file

end.

In your program you can then use:

Sound1AsString:=LazarusResources.Find('sound1').Value;

どうしたらデバッグ出力を見る事ができますか?

LCLにはデバッグ出力に書くためのLCLProc手続きがあります。

  • DebugLn: は引数に1つの文字列しか受け取れませんが、WriteLnと同じように動作します。* DbgOut: は引数に1つの文字列しか受け取れませんが、Writeと同じように動作します。

(*訳注:PascalではWrite,WriteLnは可変引数を取る稀有な関数である。)

普通の環境では、出力はstdoutに対して行われます。しかし、stdoutが閉じている場合(たとえば、{$AppType Gui}のアプリケーションであったり、Windowsで -WGオプションが指定されてコンパイルされている場合など)、出力されません。

デバッグ出力は、そのような時でもファイルに出力されます。LCLProcユニットはinitialization部で、'--debug-log=<file>'というコマンドラインパラメータをチェックします。もし、これがあれば、デバッグ出力を<file>にします。

この--debug-logコマンドラインパラメータがない場合、環境変数 xxx_debuglogが存在するかどうか確認します。xxxは、拡張子のないプログラムファイル名です。lazarusの場合は、lazarus_debuglogです。もし、このような環境変数がある場合、デバッグ出力のためのファイルを使います。たとえば、

 set lazarus_debuglog=c:\lazarus\debug.txt

としたとしましょう。 デバッグ出力は、c:\lazarus\debug.txtに行われます。

この実装は、lclproc内で行われ、全てのアプリケーションはlclprocを使うため、この出力手法を使うことができます。 Lazarusをデバッグする場合 : Windowsでもっとも効果的な方法です。もし、出力をコンソールに出したい場合、lazarus.ppに{$APPTYPE console}を加えてください。そして、Lazarusをリビルドしてください。


The LCL has in the LCLProc procedure to write debug output:

  • DebugLn: works about the same as WriteLn, but accepts only strings.
  • DbgOut: works about the same as Write, but accepts only strings.

In normal circumstances the output is written to stdout. If stdout is closed, (for example when the application is {$AppType Gui} or compiled with -WG on windows), no output is written.

Debug output can also be written to file. The LCLProc unit checks in its initialization the command line parameters for '--debug-log=<file>'. If it finds it sends debug output to <file>.

If it doesn't find a --debug-log command line parameter, it looks if an environment variable xxx_debuglog exists, where xxx is the program file name without extension. For lazarus this would be lazarus_debuglog. If such an environment variable exists, it uses that as file to write debug output to. Example: if you do:

set lazarus_debuglog=c:\lazarus\debug.txt

debug output will be written to c:\lazarus\debug.txt.

Since this is implemented in lclproc, every application using lclproc, can use this output facility.

Debuging Lazarus
Most usefull for windows: If you want output on a console, add {$APPTYPE console} to lazarus.pp ; Then rebuild Lazarus.

Lazarusで使っている色んなファイル拡張子にはどんな意味がありますか?

Lazarus Tutorial#The Lazarus filesで例としていくつかの拡張子について説明しています。 ここでは簡潔に示します。

*.lpi
Lazarus Project Information ファイル (XML形式; プロジェクト固有の設定情報を持っています)
*.lpr
Lazarus Program file; メインのプログラムとなるパスカルのソースです。
*.lfm
Lazarus Form file; フォーム上の全てのオブジェクトの情報を持っています。 (Lazarus固有のフォーマットです。アクションは対応する*.pas ファイル内に記述されます)
*.pas or *.pp
Unit with Pascal code (一般的にフォームは対応する*.lfmファイルにあります。)
*.lrs
Lazarus Resource file (これは生成されたファイルです。Windowsのリソースファイルと混同しないでください。).
このファイルは、lazres tool (ディレクトリLazarus/Toolsにある)で、コマンドラインを使って生成されます。
 lazres myfile.lrs myfile.lfm
*.ppu
Compiled unit
*.lpk
Lazarus package information file. (XML形式; パッケージ固有の設定情報を持っています)


*.lpi
Lazarus Project Information file (stored in XML; contains project-specific settings)
*.lpr
Lazarus Program file; contains Pascal source of main program
*.lfm
Lazarus Form file; contains configuration information for all objects on a form (stored in a Lazarus-specific format; the actions are described by Pascal source code in a corresponding *.pas file)
*.pas or *.pp
Unit with Pascal code (typically for a form stored in a corresponding *.lfm file)
*.lrs
Lazarus Resource file (this is a generated file; not to be confused with a Windows resource file).
This file can be created with lazres tool (in directory Lazarus/Tools) using commandline: lazres myfile.lrs myfile.lfm
*.ppu
Compiled unit
*.lpk
Lazarus package information file. (stored in XML; contains package-specific settings)

lazarusを修正したり、改良しました。どのようにしたら公式Lazarusソースに、自分の変更を加えることができますか?

パッチを作成して、開発者グループに送ってください。詳細は、Creating A Patchを見てください。

Create a patch and send it to the developers. For details see Creating A Patch.

定義はどこにありますか?

仮想キーコード定数

仮想キーコード定数は、LCLTypeに定義されています。仮想キーコード定数を使うユニットのuses内にLCLTypeを加えてください。 Virtual key constants are defined in LCLType. Add LCLtype to your uses.

Using the IDE

How can I use "identifier completion"?

You can invoke identifier completion by pressing [ctrl][space]. Under the menu item Environment -> Editor Options -> Code Tools -> Automatic Features you can set how quick this should happen automatically.

Linux

How can I debug on Linux without the IDE?

First of all you need a debugger. gdb is the standard debugger under linux and there are several GUI-frontends available. One common frontend is ddd, which is part of most common distributions. To compile lazarus/lcl with debug-information you should then use the following commands to start a debug session:

 $ make clean; make OPT=-dDEBUG
 $ ddd lazarus

Be warned however, that ddd is not as comfortable as e.g. the Lazarus debugger. Specially if it comes to view the contents of a variable you have to take into account that ddd/gdb are case sensitive whereas Pascal is case-insensitive. Therefore you have to type all variable names in uppercase to see their contents. For more information take a look into the fpc-manuals.

I can debug now but ddd does not find my sources or complains that they contain no code. Whats that?

This is a path-related problem with either gdb or ddd. You can aviod this by

  • Use the "Change directory" command from the ddd menu and choose the directory where the sources are located. The drawback of this method is that you now can't use the source of the program you started with (e.g. lazarus). Thus it may be neccessary to change the directory multiple times.
  • In ddd goto [Edit] [gdb-settings] and set the search-path
  • Create a $(HOME)/.gdbinit file like:
     directory /your/path/to/lazarus
     directory /your/path/to/lazarus/lcl
     directory /your/path/to/lazarus/lcl/include

I receive an error during the linking that states /usr/bin/ld can't find -l<some lib>

Package Based Distributions
You need to install the package that provides the lib<somelib>.so or lib<somelib>.a files. Dynamic libs under linux have the extension .so, while static libs have the extension .a. On some Linux distro's you have installed the package (rpm, deb) <packagename> which provides <some lib>, but you also need the development package (rpm, deb), normally called <packagename>-dev, which contains the .a (static lib) and/or the .so (dynamic lib).
Source Based Distributions and Manual Compilation (LFS)
Make sure that there is a lib<somelib>.a in the path, and that it contains the right version. To let the linker find the dynamic library, create a symlink called lib<some lib>.so to lib<some lib><version>-x,y.so if necessary (and/or for static lib; lib<some lib>.a to lib<some lib><version>-x,y.a).
FreeBSD
As source based distro's, and also make sure you have -Fl/usr/local/lib in your fpc.cfg and/or Lazarus library path. Keep in mind that GTK1.2 has "gtk12" as package name under FreeBSD. (same for glib)
NetBSD
As source based distro's, and also make sure you have -Fl/usr/pkg/lib in your fpc.cfg and/or Lazarus library path

How can I convert a kylix 2 project into a lazarus project?

Nearly the same way as converting a Kylix project into a Delphi/VCL project.

The LCL (Lazarus Component Library) tries to be compatible to Delphis VCL. Kylix CLX tries to be QT compatible. Here are some general hints:

  • Rename all used CLX Q-units like QForms, QControls, QGraphics, ... into their VCL counterparts: Forms, Controls, Graphics, ...
  • Add LResources to the uses section of every form source
  • Rename or copy all .xfm files to .lfm files.
  • Rename or copy .dpr file to .lpr file.
  • Add "Interfaces" to the uses section in the .lpr file.
  • Remove {$R *.res} directive
  • Remove {$R *.xfm} directive
  • Add {$mode objfpc}{$H+} or {$mode delphi}{$H+} directive to .pas and .lpr files
  • Add an initialization section to the end of each form source and add an include directive for the .lrs file (lazarus resource file):
 initialization
   {$I unit1.lrs}
The .lrs files can be created via the lazres tool in: (lazarusdir)/tools/lazres.
For example: ./lazres unit1.lrs unit1.lfm
  • Fix the differences. The LCL does not yet support every property of the VCL and the CLX is not fully VCL compatible.

When compiling lazarus the compiler can not find a unit. e.g.: gtkint.pp(17,16) Fatal: Can't find unit GLIB

1. Check a clean rebuild: do a 'make clean all'

2. Check if the compiler has the correct version (2.0.0 or higher)

3. Check if the compiler is using the right config file. The normal installation creates /etc/fpc.cfg. But fpc also searches for ~/.ppc386.cfg, ~/.fpc.cfg, /etc/ppc386.cfg and it uses only the first it finds.

Hint: You can see which config file is used with 'ppc386 -vt bogus'
Remove any ppc386.cfg as it is really obsolete.

4. Check if the config file (/etc/fpc.cfg) contains the right paths to your fpc libs. There must be three lines like this:

   -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget
   -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/rtl
   -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/*
The first part of these paths (/usr/lib/fpc) depends on your system. On some systems this can be for example /usr/local/lib/fpc/... .
Hint: You can see your searchpaths with 'ppc386 -vt bogus'

5. Check that the config file (/etc/fpc.cfg) does not contain search paths to the lcl source files (.pp, .pas):

 forbidden: -Fu(lazarus_source_directory)/lcl
 forbidden: -Fu(lazarus_source_directory)/lcl/interfaces/gtk
If you want to add the lcl for all your fpc projects, make sure that the two paths look like the following and are placed after the above fpc lib paths:
 -Fu(lazarus_source_directory)/lcl/units/$fpctarget
 -Fu(lazarus_source_directory)/lcl/units/$fpctarget/gtk

6. Check if the missing unit (glib.ppu) exists in your fpc lib directory. For example the gtk.ppu can be found in /usr/lib/fpc/$version/units/i386-linux/gtk/. If it does not exists, the fpc lib is corrupt and should be reinstalled.

7. Check if the sources are in a NFS mounted directory. In some cases the NFS updates created files incorrectly. Please, try to move the sources into a non NFS directory and compile there.

I have installed the binary version, but when compiling a simple project, lazarus gives: Fatal: Can't find unit CONTROLS

Probably you are using a newer fpc package, than that used for building the lazarus binaries. The best solution is to download the sources and compile lazarus manually. You can download the source snapshot or get the source via svn:

 $ bash
 $ svn checkout http://svn.freepascal.org/svn/lazarus/trunk lazarus
 $ cd lazarus
 $ make clean all

Make sure that lazarus get the new source directory: Environment->General Options->Files->Lazarus Directory Top

Lazarus compiles, but linking fails with: libgdk-pixbuf not found

Either install the gdk-pixbuf library for gtk1.x or disable the use:

Where to find the gdk-pixbuf library:

RPMs: http://rpmfind.net/linux/rpm2html/search.php?query=gdk-pixbuf&submit=Search+...&system=&arch=

Debian packages: libgdk-pixbuf-dev

Sources: ftp://ftp.gnome.org/pub/gnome/unstable/sources/gdk-pixbuf/


How to disable the use in lazarus: In Tools->Configure "Build Lazarus" add the option '-dNoGdkPixBufLib' or at command line: "make clean all OPT=-dNoGdkPixBufLib".

I have SuSE and I get /usr/bin/ld: cannot find -lgtk Error: Error while linking

SuSE installs the gtk devel libs under /opt/gnome/lib (or /opt/gnome/lib64 for 64 bits), which is not in the standard lib path. Simply add it to your /etc/fpc.cfg. (-Fl/opt/gnome/lib).

Lazarus crashes with runtime error 211 after I installed a component

After I installed a component, Lazarus crashes with the following message:

Threading has been used before cthreads was initialized.
Make cthreads one of the first units in your uses clause.
Runtime error 211 at $0066E188

How can I fix this?

Your freshly installed component is using threads. Fpc on *nix doesn't automatically include threading support, but it must be intialized. This initialization is done in the cthreads unit. Every application using the component needs to add this unit to the uses clause of the main program. Lazarus itself is no exception. This can be done in two ways:

1) Change the source of ide/lazarus.pp: add the cthreads as first unit to the uses clause, so that is looks like this:

uses
  //cmem,
  cthreads, 
  {$IFDEF IDE_MEM_CHECK}
...

and rebuild lazarus.

2) In order to avoid modifying lazarus.pp file, a fpc compiler option could be used. Once package that uses threads has been compiled, open menu Tools->Configure "build Lazarus". Configure "build Lazarus" dialog will be shown, in field "Options:" type -Facthreads and then press "OK" button. The next step is to install the package. Lazarus will be built with option -Facthreads which means that it will treat main program as if unit cthreads where first in uses clause.

Hint: Maybe your old (non-crashing) lazarus executable is stored as lazarus.old in the same directory as the crashing lazarus executable.

When I run a program with threads I get runtime error 232

The complete error message is:

This binary has no thread support compiled in.
Recompile the application with a thread-driver in the program uses
clause before other units using thread.
Runtime error 232

Solution: Add cthreads as first unit to the uses clause of your main program, usually the .lpr-file.

I have Ubuntu Breezy and my fonts in Lazarus IDE look too big

If Lazarus is compiled with Gtk1.2, the settings in Gnome Preferences/Font don't have any effect as they are related to Gtk2. You could try this solution: Create a file named .gtkrc.mine in your home directory (if it's not already there) and add these lines to it:

style "default-text" {
       fontset = "-*-arial-medium-r-normal--*-100-*-*-*-*-iso8859-1,\
                  -*-helvetica-medium-r-normal--*-100-*-*-*-*-*-*"
}

class "GtkWidget" style "default-text"

I have Ubuntu and I cannot compile for Gtk2 due to missing libraries

Ubuntu has a problem with not creating all the symbolic links that you'll need even when the libraries are installed. Make sure that all missing libraries when trying to link for Gtk2 have their appropriate links. For instance, you might need to do:

cd /usr/lib
sudo ln -s libgdk-x11-2.0.so.0 libgtk-x11-2.0.so

Make sure that the [whatever].so symbolic links are created and point to the actual libraries.

How can I compile a program for Gtk2?

At the moment, the Gtk2 compiled IDE is a little unstable, but you can compile software for Gtk2 using the Gtk1 IDE.

To start with recompile LCL for Gtk2. Go to the menu "Tools"->"Configure Build Lazarus" and set LCL to clean+build and everything else to none.

Now click Ok and go to the menu "Tools"->"Build Lazarus"

Now you can compile your software with Gtk2 going on the Compiler options and changing the widgetset to Gtk2.

Windows

When I cycle the compiler, I get:The name specified is not recognized as an internal or external command, operable program or batch file.>& was unexpected at this time.

In the compiler dir exists an OS2 scriptfile named make.cmd. NT sees this also as a script file, so remove it since on NT we don't need it.

When I cycle the compiler, I get: make[3]: ./ppc1.exe: Command not found

I don't know why but somehow make has lost its path. Try to cycle with a basedir set like: make cycle BASEDIR=your_fpc_source_dir_herecompiler

When I try to make Lazarus I get:

make.exe: * * * interfaces: No such file or directory (ENOENT). Stop.make.exe: * * * [interfaces_all] Error 2

You need to upgrade your make.

makefile:27: *** You need the GNU utils package to use this Makefile. Stop.

Make sure you didn't install FPC in a path with spaces in the name. The Makefile doesn't support it.


どうしたらlazarusのように、自分が作ったプログラムをXP風の見栄えにできますか?

myprogram.exeというプログラムの場合は、myprogram.exe.manifestというファイルを作成し、次をコピーペーストしてください。


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity processorArchitecture="*" version="1.0.0.0" type="win32" name="myprogram"/>
<description>programom</description>
<dependency>
  <dependentAssembly>
   <assemblyIdentity
     type="win32"
     name="Microsoft.Windows.Common-Controls"
     version="6.0.0.0"
     publicKeyToken="6595b64144ccf1df"
     language="*"
     processorArchitecture="*" />
  </dependentAssembly>
  </dependency>
</assembly>

ほらね、XP風でしょ?

WindowsでLazarusで作ったプログラムを実行させるとDOS窓で開始してしまいます

コマンドラインのコンパイラを使っている場合は-WGオプション(=Windows GUI)を指定してください。 LazarusIDEの場合は、Project menu -> Compiler Options -> Linking -> target OS Specific optionsで、コンパイラオプションダイアログでWindows GUIをチェックしてください。

Specify the -WG argument (Windows GUI) on the command line of the compiler or in the Lazarus IDE check the Windows GUI check box on the compiler options dialog box (Project menu -> Compiler Options -> Linking -> target OS Specific options.

Contributors and Comments

This page has been converted from the epikwiki version.