RejectedSoftware Forums

Sign up

Linker error 042 on logTrace

Hello,

My D program was progressing nicely, until I ´tested´ it with release mode and got a linker error.

Severity Code Description Project File Line Suppression State
Error Error 42: Symbol Undefined D4vibe4core3log162T8logTraceVAyaa63433a5c445c646d64325c77696e646f77735c62696e5c2e2e5c2e2e5c74E19315AD33F01AC918E4DA11CD373D4 C:\Data\Dev\program\

This function is:
void logTrace(string file = FILE, int line = LINE, S, T...)(S fmt, lazy T args) nothrow { log!(LogLevel.trace)(fmt, args); }

When I include the log module in my own project AND remove the body of the function:
void logTrace(string file = FILE, int line = LINE, S, T...)(S fmt, lazy T args) nothrow { }

it links fine.

My config:
Win7/64bit, Visual Studio / Visual D 0.3
DMD v2.069.2
vibe-d-0.7.26

Any solution or suggestions what to investigate next?

Re: Linker error 042 on logTrace

On Sat, 23 Jan 2016 22:05:39 GMT, Alv wrote:

Hello,

My D program was progressing nicely, until I �tested� it with release mode and got a linker error.

Severity Code Description Project File Line Suppression State
Error Error 42: Symbol Undefined D4vibe4core3log162T8logTraceVAyaa63433a5c445c646d64325c77696e646f77735c62696e5c2e2e5c2e2e5c74E19315AD33F01AC918E4DA11CD373D4 C:\Data\Dev\program\

This function is:
void logTrace(string file = FILE, int line = LINE, S, T...)(S fmt, lazy T args) nothrow { log!(LogLevel.trace)(fmt, args); }

When I include the log module in my own project AND remove the body of the function:
void logTrace(string file = FILE, int line = LINE, S, T...)(S fmt, lazy T args) nothrow { }

it links fine.

My config:
Win7/64bit, Visual Studio / Visual D 0.3
DMD v2.069.2
vibe-d-0.7.26

Any solution or suggestions what to investigate next?

This must be a DMD bug. If you can provide a test case, you should ideally file a bug report on http://issues.dlang.org.

One thing to try to work around this is to use the --combined switch when running DUB. Another is to enable the --allinst switch of DMD, using a build type customization of the "release" configuration.

Re: Linker error 042 on logTrace

On Tue, 26 Jan 2016 16:26:17 GMT, Sönke Ludwig wrote:

On Sat, 23 Jan 2016 22:05:39 GMT, Alv wrote:

Hello,

My D program was progressing nicely, until I �tested� it with release mode and got a linker error.

Severity Code Description Project File Line Suppression State
Error Error 42: Symbol Undefined D4vibe4core3log162T8logTraceVAyaa63433a5c445c646d64325c77696e646f77735c62696e5c2e2e5c2e2e5c74E19315AD33F01AC918E4DA11CD373D4 C:\Data\Dev\program\

This function is:
void logTrace(string file = FILE, int line = LINE, S, T...)(S fmt, lazy T args) nothrow { log!(LogLevel.trace)(fmt, args); }

When I include the log module in my own project AND remove the body of the function:
void logTrace(string file = FILE, int line = LINE, S, T...)(S fmt, lazy T args) nothrow { }

it links fine.

My config:
Win7/64bit, Visual Studio / Visual D 0.3
DMD v2.069.2
vibe-d-0.7.26

Any solution or suggestions what to investigate next?

This must be a DMD bug. If you can provide a test case, you should ideally file a bug report on http://issues.dlang.org.

One thing to try to work around this is to use the --combined switch when running DUB. Another is to enable the --allinst switch of DMD, using a build type customization of the "release" configuration.

I have been having this frequently since DMD 2.067 I think. It then got fixed in 2.069 and it now almost never happens, except I think when I build with dub --root=/some/other/dir. This might have just been coincidence.

In all cases, just dub build -f has always fixed it for me.

Re: Linker error 042 on logTrace

Hello, thanks for the suggestions

minimal testcase

import vibe.db.redis.redis;

int main(string[] argv)
{

auto db = new RedisClient().getDatabase(0);
db.hset("key", "field", "value");
return 0;

}

I rebuild vibe, but with no success:

1) used the --combined option; this does not change the .lib file so I guess this option was already used

2) added "dflags": ["-allinst"] to vibe's dub.json; I get an 'out of memory error' but looking at Windows resources during the build process, I have about 4GB memory left..

Next steps:

  • Use DUB for building my program,instead of Visualstudio/D
  • Switch to Linux and see if it works
  • File the bugreport as you suggested

Any advice on next steps?

Is this out of memory error I got using '-allinst' from dub or the compiler? It looks like there is memory available on the system.

Re: Linker error 042 on logTrace - SOLVED using dub

On Thu, 28 Jan 2016 11:40:14 GMT, Alv wrote:

Hello, thanks for the suggestions

minimal testcase

import vibe.db.redis.redis;

int main(string[] argv)
{

auto db = new RedisClient().getDatabase(0);
db.hset("key", "field", "value");
return 0;

}

I rebuild vibe, but with no success:

1) used the --combined option; this does not change the .lib file so I guess this option was already used

2) added "dflags": ["-allinst"] to vibe's dub.json; I get an 'out of memory error' but looking at Windows resources during the build process, I have about 4GB memory left..

Next steps:

  • Use DUB for building my program,instead of Visualstudio/D
  • Switch to Linux and see if it works
  • File the bugreport as you suggested

Any advice on next steps?

Is this out of memory error I got using '-allinst' from dub or the compiler? It looks like there is memory available on the system.

Update: using dub to build my program in release mode,
the problem is solved..