New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--embedsrc does not work on macos #10263

dandevelo opened this Issue Jan 10, 2019 · 0 comments


None yet
2 participants
Copy link

dandevelo commented Jan 10, 2019

Passing --embedsrc does not embed the Nim source in the generated C file on macos

Command line

nim c --embedsrc --compileonly --nimcache:src main.nim

Sample main.nim file

for i in 0..10:
    echo "Hello World" & $i

Generated C file

N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
	TFrame FR_; FR_.len = 0;
	nimfr_("main", "main.nim");
		NI res;
		nimln_(2158, "system.nim");
		res = ((NI) 0);
			nimln_(2159, "system.nim");
			while (1) {
				tyArray_nHXaesL0DJZHyVS07ARPRA T4_;
				NimStringDesc* T5_;
				NimStringDesc* T6_;
				NI TM_V45tF8B8NBcxFcjfe7lhBw_3;
				if (!(res <= ((NI) 10))) goto LA3;
				nimln_(1, "main.nim");
				i_5MfTn17iFUWVmcPtWcY4nQ = res;
				nimln_(2, "main.nim");
				nimZeroMem((void*)T4_, sizeof(tyArray_nHXaesL0DJZHyVS07ARPRA));
				T5_ = (NimStringDesc*)0;
				T6_ = (NimStringDesc*)0;
				T6_ = nimIntToStr(i_5MfTn17iFUWVmcPtWcY4nQ);
				T5_ = rawNewString((T6_ ? T6_->Sup.len : 0) + 11);
appendString(T5_, ((NimStringDesc*) &TM_V45tF8B8NBcxFcjfe7lhBw_2));
appendString(T5_, T6_);
				T4_[0] = T5_;
				echoBinSafe(T4_, 1);
				nimln_(2161, "system.nim");
				TM_V45tF8B8NBcxFcjfe7lhBw_3 = addInt(res, ((NI) 1));
				res = (NI)(TM_V45tF8B8NBcxFcjfe7lhBw_3);
			} LA3: ;

The generated C file contains some lines starting with // but missing the actual Nim source code

Expected Output

The output should contain original Nim source code as comments

Additional Information

$ nim -v
Nim Compiler Version 0.19.9 [MacOSX: amd64]
Compiled at 2019-01-10
Copyright (c) 2006-2018 by Andreas Rumpf

git hash: ab425d793af1a5c0b221bfbeab382b4781479c63
active boot switches: -d:release

@zevv zevv referenced this issue Jan 18, 2019


Fixed --embedsrc #10368

@Araq Araq closed this in #10368 Jan 23, 2019

Araq added a commit that referenced this issue Jan 23, 2019

narimiran added a commit that referenced this issue Jan 23, 2019

Fixes #10263; [backport]
(cherry picked from commit efa4b9a)

ThomasTJdev added a commit to ThomasTJdev/Nim that referenced this issue Jan 27, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment