Re: How to compile (Linux, Debian or Ubuntu, x86-64) FOX toolkit (snapshot) with -g and -O2 [RefPerSys]

Jeroen van der Zijp <[email protected]>
Newsgroups gmane.comp.lib.fox-toolkit.user
Organization FOX Toolkit
Message-ID <20220401113922.10221e04@leviathan>
On Fri, 1 Apr 2022 16:44:37 +0200
Basile Starynkevitch <[email protected]> wrote:

>On 01/04/2022 14:08, Basile Starynkevitch wrote:
>>
>> Hello all,
>>
>> As you probably know,  on recent Linux distributions the recent GCC 
>> <https://gcc.gnu.org/> or Clang <https://clang.llvm.org/> compilers 
>> can be invoked with both -O2 and -g (or even -g3)
>>
>> For the *RefPerSys* project (symbolic AI, open source, GPLv3+; see 
>> *http://refpersys.org/* <http://refpersys.org/> and source code on 
>> https://github.com/RefPerSys/RefPerSys ...) we are considering using 
>> FOX toolkit, but we need DWARF debugging information for several 
>> important reasons:
>>
>>
>>   * manual debugging with GDB at first.
>>   * generation (at "runtime") of C++ code compiled to some dlopen
>>     <https://man7.org/linux/man-pages/man3/dlopen.3.html>-ed plugin.
>>     The generated C++ code would depend upon some rules entered thru
>>     the FOX graphical user interface
>>   * software introspection  and runtime reflection using Ian Lance
>>     Taylor libbacktrace
>>     <https://github.com/ianlancetaylor/libbacktrace> combioned with
>>     dladdr <https://man7.org/linux/man-pages/man3/dladdr.3.html>.
>>   * Hopefully, homoiconicity
>>     <https://en.wikipedia.org/wiki/Homoiconicity> of the /RefPerSys/
>>     system and rule language
>>
>>
>> I tried several times to configure FOX source tree /fox-1.7.80/ using 
>> ./configure --enable-debug CFLAGS='-O2 -g3' CXXFLAGS='-O2 -g3' but the 
>> compilation of FOX did not show any -O flag.
>>
>> This is on Ubuntu 21.10, with g++ being GCC 11.1
>>  
>
>
>It seems (I am not sure) that using make CXXFLAGS='-O2 -g3' in FOX 
>toolkit source tree solved the problem.
>
>
>I am unhappy of that ugly way to solve  it.

Try configure --help to see the options.

For optimized compile:

   configure --enable-release --enable-native  <other options>

The --enable-native tells GCC to generate optimal code for the host;
do NOT use this option if compiling code for 3rd parties that may have
different processor than yours. [because GCC will potentially generate
AVX2, FMA3, etc. instructions and these require late-model x86 cpus to 
be able to work.

You can also use --enable-native=<cpu target>

for instance, --enable-native=ssse4.2

Would tell GCC its OK to target processors capable of SSE4.2 [you can pass
whatever -march argument would be legal].

Since its a GUI, -O3 will potentially lead to a lot of code-bloat and
may be only marginally faster, due to the fact that most speed will be
limited by drawing things on the screen, and these things are done
in libraries that your compile-options have not much effect on...

So, optimization in --enable-release is set to O2.


Best regards,


			-- JVZ











-- 
+----------------------------------------------------------------------------+
| Copyright (C) 11:30 04/ 1/2022 Jeroen van der Zijp.   All Rights Reserved. |
+----------------------------------------------------------------------------+


_______________________________________________
Foxgui-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/foxgui-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.