Skip to content
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

Cannot compile on Yakkety #507

Closed
egmontkob opened this issue Sep 27, 2016 · 12 comments
Closed

Cannot compile on Yakkety #507

egmontkob opened this issue Sep 27, 2016 · 12 comments
Labels

Comments

@egmontkob
Copy link

$ cat /etc/apt/sources.list.d/d-apt.list 
deb http://netcologne.dl.sourceforge.net/project/d-apt/ d-apt main
$ sudo apt update
[...]
All packages are up to date.

Clean checkout at current master (3fead8c).

$ dub build
Performing "debug" build using dmd for x86_64.
gtk-d:gtkd 3.3.1: target for configuration "library" is up to date.
gtk-d:gstreamer 3.3.1: target for configuration "library" is up to date.
gtk-d:gtkdgl 3.3.1: target for configuration "library" is up to date.
gtk-d:sv 3.3.1: target for configuration "library" is up to date.
gtk-d:vte 3.3.1: target for configuration "library" is up to date.
terminix ~master: building configuration "default"...
Linking...
/usr/bin/ld: .dub/build/default-debug-linux.posix-x86_64-dmd_2071-6B554447977E5F6020A73613A63EB79C/terminix.o: relocation R_X86_64_32 against symbol `_D9Exception7__ClassZ' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../.dub/packages/gtk-d-3.3.1/libvted-3.a(Pty.o): relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../.dub/packages/gtk-d-3.3.1/libvted-3.a(Pty_1_13d.o): relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not be used when making a shared object; recompile with -fPIC
[... about 9000 messages of the same kind ...]
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libphobos2.a(conv_320_6ae.o): relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
--- errorlevel 1
dmd failed with exit code 1.
@gnunn1
Copy link
Owner

gnunn1 commented Sep 27, 2016

I think this is related to compiling with PIE as there was an Ubuntu 16.10 bug open for this (ldc-developers/ldc#1618). It's also been fixed but I'm not sure if it's made it to yaketty/debian repos yet.

Does it work if you add the fPIC flag, "dflags" : [ "-fPIC" ], at line 7 after the mainSourceFile line, i.e.:

    "mainSourceFile": "source/app.d",
    "dflags" : [ "-fPIC" ],

@gnunn1 gnunn1 added the bug label Sep 27, 2016
@egmontkob
Copy link
Author

Nope, I get the same errors.

@gnunn1
Copy link
Owner

gnunn1 commented Sep 29, 2016

I'm wondering if the problem is the opposite of getting dmd to use fPIC, I suspect that the d-apt packages need to be rebuilt with -fPIC for yakkety, specifically libphobos. Since dmd uses gcc to do the linking, wouldn't it pick up Ubuntu changing to use PIE automatically?

I also tried the proposed version of LDC in the Ubuntu repositories and it has the same problem.

Not sure there's much I can do here, I see this more as a distro issue then a terminix issue.

@egmontkob
Copy link
Author

egmontkob commented Sep 29, 2016

Could easily be that the d-apt repo is not yet Yakkety-friendly.

@jpf91
Copy link

jpf91 commented Sep 30, 2016

I'm wondering if the problem is the opposite of getting dmd to use fPIC, I suspect that the d-apt packages need to be rebuilt with -fPIC for yakkety, specifically libphobos. Since dmd uses gcc to do the linking, wouldn't it pick up Ubuntu changing to use PIE automatically?

The error message complains about symbols in phobos, so the solution is indeed to recompile phobos with -fPIC and therefore debian packages wont work out of the box. Additionally it's probably also necessary to compile gtkD and all other D dependencies with -fPIC. (This is indeed caused by DMD using GCC for linking which will generate pie executables. For these executables, all static libraries need to be compiled with -fPIC)

@gnunn1
Copy link
Owner

gnunn1 commented Sep 30, 2016

Thanks @jpf91, I'm going to close this issue as it's outside the scope of Terminix.

@gnunn1 gnunn1 closed this as completed Sep 30, 2016
@egmontkob egmontkob mentioned this issue Oct 19, 2016
@egmontkob
Copy link
Author

I'm on a brand new computer now (my old one died) and I deliberately did not migrate my old setting, packages, home dir etc. So I did a clean start with Yakkety, "apt-get install dub", Terminix from git, but (as opposed to last time) no sign of "gtkd" installed or "d-apt" in my apt config, and no ~/.dub directory. As far as I understand your homepage and the output of "dub build", it should fetch gtkd automatically, right?

I get a totally different error now, maybe you have a clue what's wrong here? Thanks in advance!

$ dub build
Fetching gtk-d 3.3.1 (getting selected version)...
Placing gtk-d 3.3.1 to /home/egmont/.dub/packages/...
Performing "debug" build using gdc for x86_64.
gtk-d:gtkd 3.3.1: building configuration "library"...
gtk-d:gstreamer 3.3.1: building configuration "library"...
gtk-d:gtkdgl 3.3.1: building configuration "library"...
gtk-d:sv 3.3.1: building configuration "library"...
gtk-d:vte 3.3.1: building configuration "library"...
terminix ~master: building configuration "default"...
/usr/lib/gcc/x86_64-linux-gnu/6/include/d/std/experimental/logger/core.d:487:44: error: safe function 'std.experimental.logger.core.defaultLogFunction!cast(LogLevel)cast(ubyte)128u.defaultLogFunction!(47, "source/app.d", "app.main", "int app.main(string[] args)", "app", string, Exception).defaultLogFunction' cannot call system function 'std.experimental.logger.core.Logger.memLogFunctions!cast(LogLevel)cast(ubyte)128u.logImpl!(47, "source/app.d", "app.main", "int app.main(string[] args)", "app", string, Exception).logImpl'
                 prettyFuncName, moduleName)(args);
                                            ^
source/app.d:47:14: error: template instance std.experimental.logger.core.defaultLogFunction!cast(LogLevel)cast(ubyte)128u.defaultLogFunction!(47, "source/app.d", "app.main", "int app.main(string[] args)", "app", string, Exception) error instantiating
         error("Unexpected error occurred", e);
              ^
/usr/lib/gcc/x86_64-linux-gnu/6/include/d/std/experimental/logger/core.d:487:44: error: safe function 'std.experimental.logger.core.defaultLogFunction!cast(LogLevel)cast(ubyte)128u.defaultLogFunction!(1139, "source/gx/terminix/appwindow.d", "gx.terminix.appwindow.AppWindow.loadSession", "void gx.terminix.appwindow.AppWindow.loadSession()", "gx.terminix.appwindow", Exception).defaultLogFunction' cannot call system function 'std.experimental.logger.core.Logger.memLogFunctions!cast(LogLevel)cast(ubyte)128u.logImpl!(1139, "source/gx/terminix/appwindow.d", "gx.terminix.appwindow.AppWindow.loadSession", "void gx.terminix.appwindow.AppWindow.loadSession()", "gx.terminix.appwindow", Exception).logImpl'
                 prettyFuncName, moduleName)(args);
                                            ^
source/gx/terminix/appwindow.d:1139:22: error: template instance std.experimental.logger.core.defaultLogFunction!cast(LogLevel)cast(ubyte)128u.defaultLogFunction!(1139, "source/gx/terminix/appwindow.d", "gx.terminix.appwindow.AppWindow.loadSession", "void gx.terminix.appwindow.AppWindow.loadSession()", "gx.terminix.appwindow", Exception) error instantiating
                 error(e);
                      ^
/usr/lib/gcc/x86_64-linux-gnu/6/include/d/std/experimental/logger/core.d:487:44: error: safe function 'std.experimental.logger.core.defaultLogFunction!cast(LogLevel)cast(ubyte)128u.defaultLogFunction!(360, "source/gx/terminix/prefwindow.d", "gx.terminix.prefwindow.ShortcutPreferences.loadLocalizedShortcutLabels", "void gx.terminix.prefwindow.ShortcutPreferences.loadLocalizedShortcutLabels()", "gx.terminix.prefwindow", string, XMLException).defaultLogFunction' cannot call system function 'std.experimental.logger.core.Logger.memLogFunctions!cast(LogLevel)cast(ubyte)128u.logImpl!(360, "source/gx/terminix/prefwindow.d", "gx.terminix.prefwindow.ShortcutPreferences.loadLocalizedShortcutLabels", "void gx.terminix.prefwindow.ShortcutPreferences.loadLocalizedShortcutLabels()", "gx.terminix.prefwindow", string, XMLException).logImpl'
                 prettyFuncName, moduleName)(args);
                                            ^
source/gx/terminix/prefwindow.d:360:18: error: template instance std.experimental.logger.core.defaultLogFunction!cast(LogLevel)cast(ubyte)128u.defaultLogFunction!(360, "source/gx/terminix/prefwindow.d", "gx.terminix.prefwindow.ShortcutPreferences.loadLocalizedShortcutLabels", "void gx.terminix.prefwindow.ShortcutPreferences.loadLocalizedShortcutLabels()", "gx.terminix.prefwindow", string, XMLException) error instantiating
             error("Failed to parse shortcuts.ui", e);
                  ^
/usr/lib/gcc/x86_64-linux-gnu/6/include/d/std/experimental/logger/core.d:487:44: error: safe function 'std.experimental.logger.core.defaultLogFunction!cast(LogLevel)cast(ubyte)128u.defaultLogFunction!(1009, "source/gx/terminix/session.d", "gx.terminix.session.Session.initSession", "void gx.terminix.session.Session.initSession(JSONValue value, string filename, int width, int height, bool firstRun)", "gx.terminix.session", string, Exception).defaultLogFunction' cannot call system function 'std.experimental.logger.core.Logger.memLogFunctions!cast(LogLevel)cast(ubyte)128u.logImpl!(1009, "source/gx/terminix/session.d", "gx.terminix.session.Session.initSession", "void gx.terminix.session.Session.initSession(JSONValue value, string filename, int width, int height, bool firstRun)", "gx.terminix.session", string, Exception).logImpl'
                 prettyFuncName, moduleName)(args);
                                            ^
source/gx/terminix/session.d:1009:18: error: template instance std.experimental.logger.core.defaultLogFunction!cast(LogLevel)cast(ubyte)128u.defaultLogFunction!(1009, "source/gx/terminix/session.d", "gx.terminix.session.Session.initSession", "void gx.terminix.session.Session.initSession(JSONValue value, string filename, int width, int height, bool firstRun)", "gx.terminix.session", string, Exception) error instantiating
             error("Session could not be created due to error", e);
                  ^
source/gx/terminix/terminal/password.d:383:45: error: undefined identifier 'thisThreadID'
         trace("Main Thread ID " ~ to!string(thisThreadID));
                                             ^
source/gx/terminix/terminal/terminal.d:3038:13: error: case must be a string or an integral constant, not SETTINGS_PROFILE_TRIGGER_UPDATE_STATE_VALUE
             case SETTINGS_PROFILE_TRIGGER_UPDATE_STATE_VALUE:
             ^
source/gx/terminix/terminal/terminal.d:3041:13: error: case must be a string or an integral constant, not SETTINGS_PROFILE_TRIGGER_EXECUTE_COMMAND_VALUE
             case SETTINGS_PROFILE_TRIGGER_EXECUTE_COMMAND_VALUE:
             ^
source/gx/terminix/terminal/terminal.d:3044:13: error: case must be a string or an integral constant, not SETTINGS_PROFILE_TRIGGER_SEND_NOTIFICATION_VALUE
             case SETTINGS_PROFILE_TRIGGER_SEND_NOTIFICATION_VALUE:
             ^
source/gx/terminix/terminal/terminal.d:3047:13: error: case must be a string or an integral constant, not SETTINGS_PROFILE_TRIGGER_UPDATE_BADGE_VALUE
             case SETTINGS_PROFILE_TRIGGER_UPDATE_BADGE_VALUE:
             ^
source/gx/terminix/terminal/terminal.d:3050:13: error: case must be a string or an integral constant, not SETTINGS_PROFILE_TRIGGER_UPDATE_TITLE_VALUE
             case SETTINGS_PROFILE_TRIGGER_UPDATE_TITLE_VALUE:
             ^
source/gx/terminix/terminal/terminal.d:3053:13: error: case must be a string or an integral constant, not SETTINGS_PROFILE_TRIGGER_PLAY_BELL_VALUE
             case SETTINGS_PROFILE_TRIGGER_PLAY_BELL_VALUE:
             ^
source/gx/terminix/terminal/terminal.d:3056:13: error: case must be a string or an integral constant, not SETTINGS_PROFILE_TRIGGER_SEND_TEXT_VALUE
             case SETTINGS_PROFILE_TRIGGER_SEND_TEXT_VALUE:
             ^
source/gx/terminix/terminal/terminal.d:3059:13: error: case must be a string or an integral constant, not SETTINGS_PROFILE_TRIGGER_INSERT_PASSWORD_VALUE
             case SETTINGS_PROFILE_TRIGGER_INSERT_PASSWORD_VALUE:
             ^
gdc failed with exit code 1.

@egmontkob egmontkob changed the title Cannot compile on Yakkety beta Cannot compile on Yakkety Nov 14, 2016
@egmontkob
Copy link
Author

If I "apt-get install ldc" as well, the error becomes this:

$ dub build
Fetching gtk-d 3.3.1 (getting selected version)...
Placing gtk-d 3.3.1 to /home/egmont/.dub/packages/...
Performing "debug" build using gdc for x86_64.
gtk-d:gtkd 3.3.1: building configuration "library"...
/usr/include/d/core/stdc/stdarg.d:48:23: error: undefined identifier '__va_list_tag'
     alias __va_list = __va_list_tag;
                       ^
/usr/include/d/core/atomic.d:1529:29: error: undefined identifier 'MemoryOrder'
 HeadUnshared!(T) atomicLoad(MemoryOrder ms = MemoryOrder.seq, T)( ref const shared T val ) pure nothrow @nogc
                             ^
gdc failed with exit code 1.

@gnunn1
Copy link
Owner

gnunn1 commented Nov 14, 2016

I'm not an expert on the alternative compilers however the first stack trace is because you are using GDC which is unfortunately based on an older version of DMD and won't compile Terminix. The second track trace still seems to be using GDC, what happens if you explicitly specify LDC, it should be something like:

dub build --compiler=ldc

@ximion
Copy link
Collaborator

ximion commented Nov 14, 2016

@egmontkob If you can, just use the .deb package from Debian (you can also recompile it for Ubuntu), which uses Automake and LDC (although I would rather like to see Meson instead of Automake, or a better maintained and heavily improved Automake setup, because the current thing has several (minor) issues)

@egmontkob
Copy link
Author

@ximion Thanks, I just installed zesty's packages (which are probably exactly the same as Debian's). This is good enough for me right now, I probably won't go into the troubles of recompiling for a while.

@egmontkob
Copy link
Author

Just for the record: Tilix compiles fine on Zesty. Hooray!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants