View Issue Details

IDProjectCategoryView StatusLast Update
0004239unrealinstallingpublic2014-07-06 16:01
ReporterQIXOZL Assigned Totmcarthur  
PrioritynormalSeverityblockReproducibilityalways
Status resolvedResolutionfixed 
Platformx86OSFreeBSDOS Version9.2
Product Version3.2.10.1 
Fixed in Version3.2.10.4 
Summary0004239: Undefined symbols in modules with clang
DescriptionFreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610
Target: x86_64-unknown-freebsd9.2

compilations goes through however the modules seem to have undefined symbols. for example:

* unrealircd.conf:3: loadmodule src/modules/commands.so: failed to load: tmp/4C5068E0.commands.so: Undefined symbol "me"
* unrealircd.conf:4: loadmodule src/modules/cloak.so: failed to load: tmp/4633C79D.cloak.so: Undefined symbol "iConf"
Steps To Reproducecompiled using:

./configure --with-showlistmodes --enable-ssl --enable-ziplinks --with-listen=5 --with-dpath=/root/Unreal3.2.10.1 --with-spath=/root/Unreal3.2.10.1/src/ircd --with-nick-history=250 --with-sendq=3000000 --with-bufferpool=18 --with-permissions=0600 --with-fd-setsize=1024 --enable-dynamic-linking
TagsNo tags attached.
Attached Files
configure.patch (721 bytes)
configure.ac.patch (785 bytes)
3rd party modules

Activities

rfrederick

2013-11-21 21:25

reporter   ~0017842

The issue looks to lie with the fact that Clang/LLVM uses the C99 standard by default, but UnrealIRCd contains code (namely functions declared as 'inline' in this case) that rely on the compiler using the GNU89 standard.

I've attached a couple of patches that cause the -std=gnu89 option to be explicitly passed to the compiler and also explicitly specify that the -export-dynamic option should be passed to the linker.

QIXOZL

2013-11-23 23:09

reporter   ~0017845

thanks that seems to work

syzop

2014-01-12 10:24

administrator   ~0017871

Last edited: 2014-01-12 10:24

would this patch disable any C99 features? granted, we use very few.. 'like checking if C99 variable length arrays are supported' to name one.

rfrederick

2014-01-12 18:01

reporter   ~0017890

It does look like, in the case of C99 variable length array support, that the patch does disable C99 features. From the configure output:

checking if C99 variable length arrays are supported... no

syzop

2014-04-14 21:02

administrator   ~0018134

I've updated the category & severity.

binki: I heard you were maybe looking into this? let me know what you think..

syzop

2014-04-20 10:26

administrator   ~0018136

This needs to be fixed in 3.2.10.3.

binki? :P
(e-mail notification was not working before)

syzop

2014-05-31 22:01

administrator   ~0018154

Just noticed this hasn't been fixed in 3.2.10.3 because there hasn't been any movement on this bug. Pitty.. sorry.

rcnewman3

2014-06-03 21:47

reporter   ~0018170

Can someone point me in the direction of what I can do with the attached files(configure.patch and/or configure.ac.patch) so that I can get the modules to compile correctly under FreeBSD?

rfrederick

2014-06-03 21:51

reporter   ~0018171

Both of these patches were recently committed to the FreeBSD ports tree in lieu of this bug being fixed. See http://svnweb.freebsd.org/ports?view=revision&revision=355584

tmcarthur

2014-06-05 16:59

reporter   ~0018181

This will also impact other *BSD variants including Mac OS X. We probably should fix it for 3.4 if not 3.2

rcnewman3

2014-06-05 18:29

reporter   ~0018185

I did figure out the changes described in the two files (configure.patch and configure.ac.patch), I then ran ./Config again and completed a make. But the undefined symbols issue persisted. I look forward to when this bug is resolved.

QIXOZL

2014-06-05 23:18

reporter   ~0018186

worked fine for me on freebsd 9.x. which os did you try it on?

rcnewman3

2014-06-05 23:24

reporter   ~0018187

I'm running FreeBSD 10.0-RELEASE #0 r260789.

rcnewman3

2014-06-06 16:54

reporter   ~0018188

I ran through the install process again. Upon reviewing my previous actions, I was patching Unreal3.2.10 and getting the same error with the modules having undefined symbols. Upon switching back to the 3.2.10.3 release and applying the changes in both of the patch files, the undefined symbol error was resolved. I have moved on to the next error in my config file. Thank you for your assistance.

syzop

2014-06-08 10:28

administrator   ~0018189

Last edited: 2014-06-08 10:31

tmcarthur, you looking into this? I don't want to force the compiler to use C89 for everyone, and preferably for nobody :p.

I've no FreeBSD box so I can't check.

rfrederick says it's due to inline, but in the report I read unresolved symbols for variables like me and iConf. Part of the patch uses a different method to pass -export-dynamic to the linker, does that fix most of the issues? After fixing that how many errors are still left?

For 3.4.x we should fix export-dynamic if it isn't passed on correctly (didn't verify), and don't force C89 but rather fix the code if possible.
For 3.2.x it depends on how invasive the code change are, otherwise simply force C89 if using clang (only!).

Thanks!

I'll put out a 3.2.10.4 if this is fixed.

Klintrup

2014-06-18 13:04

reporter   ~0018199

syzop if you need a shell account on a FreeBSD 10.0-RELEASE machine to fix this, feel free to contact me

QIXOZL

2014-06-28 06:08

reporter   ~0018204

jeez setting up a vm takes how long? 10 minutes? 15? :-P
not to mention that a unix developer should have at least one bsd at hand anyway.

as for the actual matter, this problem is caused by relying on gcc/gnu specific stuff which of course always is a bad idea. details and several solutions can be found there: http://clang.llvm.org/compatibility.html#inline

tmcarthur

2014-07-05 18:35

reporter   ~0018207

syszop, yeah, this is my priority now that the modes are modularized, I'll test on FreeBSD and OS X, both of which rely on clang - I use clang for the most part at my day job, so I'm pretty familiar with it.

Thanks,
Travis

tmcarthur

2014-07-05 20:53

reporter   ~0018208

Passing -Wl for export-dynamic seems to correct problem on FreeBSD 10 and OS X 10.9, so will commit that and close - the warnings for inlines I'm not super concerned about at this point - we have numerous other errors under clang (and gcc) due to how we do some of our hook function pointers that we probably want to correct at some time (though not a high priority).

tmcarthur

2014-07-05 20:57

reporter   ~0018209

Oh wait - did find one additional issue - correcting then committing my mistake :P

tmcarthur

2014-07-05 22:17

reporter   ~0018210

Done - will do additional testing when we release alpha, but quick smoke testing shows this appears fixed on 3.4 for OS X and FreeBSD.

syzop

2014-07-06 16:01

administrator   ~0018211

Backported to 3.2.x (untested).
http://hg.unrealircd.com/hg/unreal/rev/1070c09c1dc2
Changelog:
Fix compile errors when building with clang instead of gcc, which is more
and more becoming the default nowadays such as on FreeBSD.
Reported by QIXOZL (0004239). Backported the patch from Heero.

Issue History

Date Modified Username Field Change
2013-10-03 08:31 QIXOZL New Issue
2013-11-21 21:18 rfrederick File Added: configure.patch
2013-11-21 21:18 rfrederick File Added: configure.ac.patch
2013-11-21 21:25 rfrederick Note Added: 0017842
2013-11-23 23:09 QIXOZL Note Added: 0017845
2014-01-12 10:24 syzop Note Added: 0017871
2014-01-12 10:24 syzop Note Edited: 0017871
2014-01-12 11:22 syzop Severity minor => major
2014-01-12 18:01 rfrederick Note Added: 0017890
2014-03-14 01:14 peterkingalexander Issue cloned: 0004262
2014-04-14 21:02 syzop Note Added: 0018134
2014-04-14 21:02 syzop Severity major => block
2014-04-14 21:02 syzop Category module => installing
2014-04-14 21:02 syzop Status new => confirmed
2014-04-20 10:26 syzop Note Added: 0018136
2014-05-31 22:01 syzop Note Added: 0018154
2014-06-03 21:47 rcnewman3 Note Added: 0018170
2014-06-03 21:51 rfrederick Note Added: 0018171
2014-06-05 16:59 tmcarthur Note Added: 0018181
2014-06-05 18:29 rcnewman3 Note Added: 0018185
2014-06-05 23:18 QIXOZL Note Added: 0018186
2014-06-05 23:24 rcnewman3 Note Added: 0018187
2014-06-06 07:02 tmcarthur Assigned To => tmcarthur
2014-06-06 07:02 tmcarthur Status confirmed => assigned
2014-06-06 16:54 rcnewman3 Note Added: 0018188
2014-06-08 10:28 syzop Note Added: 0018189
2014-06-08 10:31 syzop Note Edited: 0018189
2014-06-18 13:04 Klintrup Note Added: 0018199
2014-06-28 06:08 QIXOZL Note Added: 0018204
2014-07-05 18:35 tmcarthur Note Added: 0018207
2014-07-05 20:53 tmcarthur Note Added: 0018208
2014-07-05 20:57 tmcarthur Note Added: 0018209
2014-07-05 22:17 tmcarthur Note Added: 0018210
2014-07-05 22:17 tmcarthur Status assigned => resolved
2014-07-05 22:17 tmcarthur Fixed in Version => 3.4-alpha1
2014-07-05 22:17 tmcarthur Resolution open => fixed
2014-07-06 16:01 syzop Note Added: 0018211
2014-07-06 16:01 syzop Fixed in Version 3.4-alpha1 => 3.2.10.4