https://bugs.kde.org/show_bug.cgi?id=441849

            Bug ID: 441849
           Summary: libkdexoauth2 fails to build because of newly enabled
                    C99 standard: "duplicate symbol: atof" & similar
           Product: libkgapi
           Version: GIT
          Platform: Ubuntu Packages
                OS: Linux
            Status: REPORTED
          Severity: major
          Priority: NOR
         Component: General
          Assignee: dvra...@kde.org
          Reporter: kf...@kde.org
  Target Milestone: ---

SUMMARY


STEPS TO REPRODUCE
1. Build libkgapi as usual


OBSERVED RESULT

Receiving linker errors like this (and more):

```
ld: error: duplicate symbol: atof
>>> defined at stdlib-float.h:27 
>>> (/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:27)
>>>            src/saslplugin/CMakeFiles/kdexoauth2.dir/xoauth2plugin.c.o:(atof)
>>> defined at stdlib-float.h:27 
>>> (/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:27)
>>>            
>>> src/saslplugin/CMakeFiles/kdexoauth2.dir/xoauth2plugin_init.c.o:(.text+0xB0)

ld: error: duplicate symbol: atoi
>>> defined at stdlib.h:363 (/usr/include/stdlib.h:363)
>>>            src/saslplugin/CMakeFiles/kdexoauth2.dir/xoauth2plugin.c.o:(atoi)
>>> defined at stdlib.h:363 (/usr/include/stdlib.h:363)
>>>            
>>> src/saslplugin/CMakeFiles/kdexoauth2.dir/xoauth2plugin_init.c.o:(.text+0x0)
```


EXPECTED RESULT

Builds fine


SOFTWARE/OS VERSIONS

Linux/KDE Plasma: Ubuntu 21.04, Ubuntu clang version 12.0.0-3ubuntu1~21.04.1
KDE Frameworks Version: Git master (395837d750077d96ea48f4bb59fdf0b015301298)
Qt Version: Qt 5.15


ADDITIONAL INFORMATION

Culprit is the following commit:

```
commit d38505e653965b709f941b12a0271f93c98cc584 (HEAD)
Author: Laurent Montel <mon...@kde.org>
Date:   Sat Aug 14 13:49:16 2021 +0200

    GIT_SILENT: time to increase version
```

This sets the CMake variable KDE_COMPILERSETTINGS_LEVEL to 5.85.0 and with this
uses newer compiler flags. Specifically, it now uses -std=c99 instead of
-std=gnu90.

C99 changes the meaning of `extern inline`
(https://stackoverflow.com/questions/216510/what-does-extern-inline-do). In our
case that has the effect that some headers from glibc are treated differently,
i.e. functions like `atof` are actually defined and exported in the object
files including the header defining `atof` and friends. More information about
this issue https://gcc.gnu.org/legacy-ml/gcc/2006-11/msg00011.html).

Normally this should not be the case; I think the underlying issue is that
libkgapi is using a generated config.h (./src/saslplugin/config.h) which is
incompatible under C99.


Possible work-arounds right now:

* Revert d38505e653965b709f941b12a0271f93c98cc584 OR
* Apply the following patch:

```
this fixes it as well for me: ```diff --git a/src/saslplugin/config.h
b/src/saslplugin/config.h
index 73550fb..005a955 100644
--- a/src/saslplugin/config.h
+++ b/src/saslplugin/config.h
@@ -482,7 +482,6 @@ struct iovec {

 #ifndef HAVE___ATTRIBUTE__
 /* Can't use attributes... */
-#define __attribute__(foo)
 #endif

 #define SASL_PATH_ENV_VAR "SASL_PATH"```
```


The proper solution would be to generate the config.h at build time (committing
generated headers from configure checks is usually a bad idea to begin with).

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to