DUB saying my Linux exe file is "not an executable file" even though DUB built it

NX via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Aug 14 01:53:30 PDT 2016


On Sunday, 14 August 2016 at 03:10:28 UTC, WhatMeWorry wrote:
> On Sunday, 14 August 2016 at 01:05:33 UTC, Basile B. wrote:
>> On Saturday, 13 August 2016 at 21:56:49 UTC, WhatMeWorry wrote:
>>>
>>> $ sudo chmod -v 777 *
>>> mode of 'HelloWindow' changed from 0644 (rw-r--r--) to 0777 
>>> (rwxrwxrwx)
>>> $ ls -al
>>> total 3016
>>> drwxr-xr-x 2 generic generic    4096 Aug 13 16:48 .
>>> drwxr-xr-x 7 generic generic    4096 Aug 12 23:14 ..
>>> -rw-r--r-- 1 generic generic 3080080 Aug 13 16:48 HelloWindow
>>>
>>>
>>> Now I'm really gobsmacked.
>>
>> Can you post the result of
>>
>>> $file HelloWindow
>>
>> ?
>
> Certainly.
>
> $file *
> HelloWindow: ELF 32-bit LSB executable, Intel 80386, version 1 
> (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for 
> GNU/Linux 2.6.32, 
> BuildID[sha1]=1ee19ed1fe36d068ad24f1a16f9990b6b7ff4438, not 
> stripped
>
>
> I'm running Ubuntu (actually Xubuntu) 16.04.1 LTS  And I've got 
> the very latest dmd and dub general releases.
>
> I might be doing something unusual that may not even be 
> allowed. I've got a USB flash drive that I'm trying to share 
> between two physical machines: one Windows and the other Linux.
>  The dub project, bin, source code etc. is on the flash drive.
> I compiled my little HelloWorld in dub to create a 
> HelloWorld.exe on my Windows machine.  This compiled and ran 
> fine.  I then moved the USB flash drive over to the Linux 
> machine and reran dub build/run to create the executable 
> HelloWorld that is now causing the trouble.  Should I not be 
> trying to share a flash drive like this?

This is the actual problem that cause trouble. Your flash drive 
is probably Fat32 or NTFS formatted rather than ext4. Since those 
file systems do not support "executable attribute", Linux will 
silently fail to give files the attribute which results in these 
sort of surprises. You may wonder why the same thing doesn't 
happen on NTFS formatted partition of your hard drive. I guess 
this is because Linux assumes internal hard drive is trustable, 
thus all files have executable attribute by default (that's what 
happens on my pc).


More information about the Digitalmars-d-learn mailing list