digitalmars.D.learn - object.d: Error: module object is in file 'object.d' which cannot be read
- Ishan Thilina (15/15) Mar 27 2011 When I give "dmd untitled.d" command in my ubuntu maverick 64 bit laptop...
- Trass3r (5/8) Mar 27 2011 As you can see dmd.conf uses relative paths.
- Ishan Thilina (9/14) Mar 27 2011 I did as you have said. Now a new error comes :-/.
- Trass3r (1/5) Mar 27 2011 Could it be you also deleted the dmd.conf in the local dmd/linux/bin?
- spir (21/36) Mar 27 2011 First, please always post the piece of code that provokes an error. If i...
- Jacob Carlborg (6/49) Mar 27 2011 The error
- spir (8/23) Mar 27 2011 PS: I tried to compile an empty module called "object.d". This gives me ...
- Jacob Carlborg (10/25) Mar 27 2011 You can try and installing DMD with my tool, DVM:
- Ishan Thilina (8/8) Mar 27 2011 @Jacob:
- Jonathan M Davis (9/10) Mar 27 2011 Perhaps druntime got messed up then. Is
- Jacob Carlborg (7/14) Mar 27 2011 You don't have libz installed? Oh, you're running 64bit, you need to
- Jonathan M Davis (20/33) Mar 27 2011 Probably alpha. I believe that it mostly works, but there are still plen...
- Jacob Carlborg (24/57) Mar 28 2011 What I meant with "installing" is that he shouldn't expect to be able to...
- Ishan Thilina (36/36) Mar 28 2011 @Jonathan:
- spir (16/41) Mar 28 2011 I have no idea why and where your issues in using D with dmd come from. ...
- Jacob Carlborg (9/45) Mar 29 2011 To run 32bit applications on a 64bit machine you need 32bit compatible
- David Nadlinger (6/13) Mar 29 2011 Your dmd.conf doesn't have the correct include path for Phobos. If you
- Kenneth Dallmann (16/24) Sep 13 2021 I had the exact same problem, very frustrating. I believe I
- max haughton (3/20) Sep 13 2021 Please try to avoid resurrecting very old threads if you can.
When I give "dmd untitled.d" command in my ubuntu maverick 64 bit laptop I get the following error. " object.d: Error: module object is in file 'object.d' which cannot be read import path[0] = /etc/../../src/phobos import path[1] = /etc/../../src/druntime/import " I tried all morning to solve this problem, tried every google result I could find. Checked the mail archive to solve this problem. But I still couldn't get rid of that error.I anybody can help me, it would be a great help. I followed the steps in http://www.digitalmars.com/d/2.0/dmd-linux.html .I first used the command "cp dmd2/linux/bin/dmd.conf /etc " . Then I gave "sudo apt-get install gcc-multilib g++-multilib libc6-i386 libc6-dev-i386" command. Thank you :)
Mar 27 2011
object.d: Error: module object is in file 'object.d' which cannot be read import path[0] = /etc/../../src/phobos import path[1] = /etc/../../src/druntime/importAs you can see dmd.conf uses relative paths. That guide needs an overhaul. The easiest way is to copy the contents of the zip archive into some local dmd directory and add dmd/linux/bin to your PATH. (i.e. remove your etc/dmd.conf for now)
Mar 27 2011
Trass3r wrote:As you can see dmd.conf uses relative paths. That guide needs an overhaul. The easiest way is to copy the contents of the zip archive into some local dmd directory and add dmd/linux/bin to your PATH. (i.e. remove your etc/dmd.conf for now)I did as you have said. Now a new error comes :-/. "object.d: Error: module object is in file 'object.d' which cannot be read Specify path to file 'object.d' with -I switch " Spir: I think you have not understood what my problem is. I'm not trying to solve a problem with my source code. I'm having an issue in which I can'ct compile code( I have compiled them using dmd in windows and they can be compiled in linux using GCD)
Mar 27 2011
"object.d: Error: module object is in file 'object.d' which cannot be read Specify path to file 'object.d' with -I switch "Could it be you also deleted the dmd.conf in the local dmd/linux/bin?
Mar 27 2011
On 03/27/2011 12:28 PM, Ishan Thilina wrote:When I give "dmd untitled.d" command in my ubuntu maverick 64 bit laptop I get the following error. " object.d: Error: module object is in file 'object.d' which cannot be read import path[0] = /etc/../../src/phobos import path[1] = /etc/../../src/druntime/import " I tried all morning to solve this problem, tried every google result I could find. Checked the mail archive to solve this problem. But I still couldn't get rid of that error.I anybody can help me, it would be a great help. I followed the steps in http://www.digitalmars.com/d/2.0/dmd-linux.html .I first used the command "cp dmd2/linux/bin/dmd.conf /etc " . Then I gave "sudo apt-get install gcc-multilib g++-multilib libc6-i386 libc6-dev-i386" command. Thank you :)First, please always post the piece of code that provokes an error. If it's a big or complicated thing, then try to reduce it to the smallest and simplest bit possible. Usually, doing this will let you find the source of the problem ;-) Second, this kind of error is caused by wrong import path (yes, the error message could mention "import"). Typically, when one writes eg: import range; instead of import std.range; But your case is strange. Do you know object.d is the core of D's std lib, which defines about all what you absolutely need to use when programming in D? One does not need to import it, this is automatical. Also, the message says the error happens in object.d itself, which is very un-probable. I thus suspect you named one of your own modules "object.d", which breaks the import mechanics (for D's standard object.d and possibly for other stdlib/phobos modules). This may be considered as a bug. denis -- _________________ vita es estrany spir.wikidot.com
Mar 27 2011
On 2011-03-27 14:55, spir wrote:On 03/27/2011 12:28 PM, Ishan Thilina wrote:The error "object.d: Error: module object is in file 'object.d' which cannot be read" usually happens when DMD can't find the sources or phobos. -- /Jacob CarlborgWhen I give "dmd untitled.d" command in my ubuntu maverick 64 bit laptop I get the following error. " object.d: Error: module object is in file 'object.d' which cannot be read import path[0] = /etc/../../src/phobos import path[1] = /etc/../../src/druntime/import " I tried all morning to solve this problem, tried every google result I could find. Checked the mail archive to solve this problem. But I still couldn't get rid of that error.I anybody can help me, it would be a great help. I followed the steps in http://www.digitalmars.com/d/2.0/dmd-linux.html .I first used the command "cp dmd2/linux/bin/dmd.conf /etc " . Then I gave "sudo apt-get install gcc-multilib g++-multilib libc6-i386 libc6-dev-i386" command. Thank you :)First, please always post the piece of code that provokes an error. If it's a big or complicated thing, then try to reduce it to the smallest and simplest bit possible. Usually, doing this will let you find the source of the problem ;-) Second, this kind of error is caused by wrong import path (yes, the error message could mention "import"). Typically, when one writes eg: import range; instead of import std.range; But your case is strange. Do you know object.d is the core of D's std lib, which defines about all what you absolutely need to use when programming in D? One does not need to import it, this is automatical. Also, the message says the error happens in object.d itself, which is very un-probable. I thus suspect you named one of your own modules "object.d", which breaks the import mechanics (for D's standard object.d and possibly for other stdlib/phobos modules). This may be considered as a bug. denis
Mar 27 2011
On 03/27/2011 12:28 PM, Ishan Thilina wrote:When I give "dmd untitled.d" command in my ubuntu maverick 64 bit laptop I get the following error. " object.d: Error: module object is in file 'object.d' which cannot be read import path[0] = /etc/../../src/phobos import path[1] = /etc/../../src/druntime/import " I tried all morning to solve this problem, tried every google result I could find. Checked the mail archive to solve this problem. But I still couldn't get rid of that error.I anybody can help me, it would be a great help. I followed the steps in http://www.digitalmars.com/d/2.0/dmd-linux.html .I first used the command "cp dmd2/linux/bin/dmd.conf /etc " . Then I gave "sudo apt-get install gcc-multilib g++-multilib libc6-i386 libc6-dev-i386" command. Thank you :)PS: I tried to compile an empty module called "object.d". This gives me pages & pages & pages of "undefined x" errors ;-) denis -- _________________ vita es estrany spir.wikidot.com
Mar 27 2011
On 2011-03-27 12:28, Ishan Thilina wrote:When I give "dmd untitled.d" command in my ubuntu maverick 64 bit laptop I get the following error. " object.d: Error: module object is in file 'object.d' which cannot be read import path[0] = /etc/../../src/phobos import path[1] = /etc/../../src/druntime/import " I tried all morning to solve this problem, tried every google result I could find. Checked the mail archive to solve this problem. But I still couldn't get rid of that error.I anybody can help me, it would be a great help. I followed the steps in http://www.digitalmars.com/d/2.0/dmd-linux.html .I first used the command "cp dmd2/linux/bin/dmd.conf /etc " . Then I gave "sudo apt-get install gcc-multilib g++-multilib libc6-i386 libc6-dev-i386" command. Thank you :)You can try and installing DMD with my tool, DVM: https://bitbucket.org/doob/dvm . It makes it easy to install and switch between different versions of DMD. Just run: wget -O dvm https://bitbucket.org/doob/dvm/downloads/dvm-0.1.1-linux && chmod +x dvm && ./dvm install dvm dvm install 2.052 dvm use 2.052 -- /Jacob Carlborg
Mar 27 2011
Jacob: An error comes when the " ./dvm install dvm" command is given. " ./dvm: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory " Trass3r: No, dmd.conf in the dmd2/linux/bin is there safely
Mar 27 2011
On 2011-03-27 12:24, Ishan Thilina wrote:No, dmd.conf in the dmd2/linux/bin is there safelyPerhaps druntime got messed up then. Is dmd2/src/druntime/import/object.di there? Or did you ever mess with your dmd.conf? If you're using the default and you've left files in place without trying to do stuff like move libraries to /usr/lib, then it should work just fine. If you messed with dmd.conf or you moved the standard libraries or source around without changing your dmd.conf, then it's not going to be able to find the source or libraries. - Jonathan M Davis
Mar 27 2011
On 2011-03-27 21:24, Ishan Thilina wrote:Jacob: An error comes when the " ./dvm install dvm" command is given. " ./dvm: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directoryYou don't have libz installed? Oh, you're running 64bit, you need to install 32bit libraries. I also forgot to mention that DVM currently only installs the 32bit version of DMD. The 64bit version is quite new, don't know if it's experimental, alpha or beta.Trass3r: No, dmd.conf in the dmd2/linux/bin is there safely-- /Jacob Carlborg
Mar 27 2011
On 2011-03-27 13:20, Jacob Carlborg wrote:On 2011-03-27 21:24, Ishan Thilina wrote:Probably alpha. I believe that it mostly works, but there are still plenty of bugs to find, I'm sure. However, depending on what you mean by "installing" the compiler, there is no 32-bit vs 64-bit version. Only the libraries differ. There is only a 32-bit binary for the compiler, and you pass it -m64 if you want it to compile 64-bit binaries. So, if your tool deals with the compiler only, then 32-bit vs 64-bit is currently a moot point. On the other hand, if it deals with the standard libraries too (as it probably does), then 32-bit vs 64-bit _is_ an issue, but it isn't an issue for the compiler itself. And unless you're not using the standard dmd.conf as part of switching compilers, there would already be a difference in the library layout once 64-bit compilation was introduced, since the 32-bit Phobos was moved from dmd2/linux/lib to dmd2/linux/lib32 (with the 64-bit version in dmd2/linux/lib64). And if you made the lib32 change, then having it work with 64-bit is likely trivial. And if you didn't make such a change, you're going to have to eventually. Personally, I don't see tha alpha quality of the 64-bit code generation to be a reason not to support it. It's been released. But then again, I don't use your tool at all and find no need for it, so it's not like I'm one of your users. - Jonathan M DavisJacob: An error comes when the " ./dvm install dvm" command is given. " ./dvm: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directoryYou don't have libz installed? Oh, you're running 64bit, you need to install 32bit libraries. I also forgot to mention that DVM currently only installs the 32bit version of DMD. The 64bit version is quite new, don't know if it's experimental, alpha or beta.
Mar 27 2011
On 2011-03-27 23:05, Jonathan M Davis wrote:On 2011-03-27 13:20, Jacob Carlborg wrote:What I meant with "installing" is that he shouldn't expect to be able to produce 64bit binaries with a DMD installed with my tool. I have changed the tool to handle the lib -> lib32/lib64 change. It is a trivial change to make the 64bit installation possible. The reason I have made that change yet is a couple of reasons: * I was planning to refactor the whole tool into a library and a tool using that library. I was planning to wait with all the new functionality until after the refactoring was done. * I'm not 100% how I want the default behavior to be. When the 64bit is mature enough that will probably be the default when running on a 64bit machine and otherwise 32bit. I will also provide an option to installed the non-native library as well. The question is, what should be the default behavior now on a 64bit machine, 32bit or 64bit? Yes, I do have a custom dmd.conf. No reason to put the "bin" folder in an extra folder just because that's the layout in the zip file. I guess you're right, that I shouldn't blame the current status of the 64bit code generation as a reason not to support installing it. Just thought it was easier to explain it that way the more complete explanation I gave here. I do know that the compiler can produce both 32 and 64bit binaries and the only difference is the standard library. -- /Jacob CarlborgOn 2011-03-27 21:24, Ishan Thilina wrote:Probably alpha. I believe that it mostly works, but there are still plenty of bugs to find, I'm sure. However, depending on what you mean by "installing" the compiler, there is no 32-bit vs 64-bit version. Only the libraries differ. There is only a 32-bit binary for the compiler, and you pass it -m64 if you want it to compile 64-bit binaries. So, if your tool deals with the compiler only, then 32-bit vs 64-bit is currently a moot point. On the other hand, if it deals with the standard libraries too (as it probably does), then 32-bit vs 64-bit _is_ an issue, but it isn't an issue for the compiler itself. And unless you're not using the standard dmd.conf as part of switching compilers, there would already be a difference in the library layout once 64-bit compilation was introduced, since the 32-bit Phobos was moved from dmd2/linux/lib to dmd2/linux/lib32 (with the 64-bit version in dmd2/linux/lib64). And if you made the lib32 change, then having it work with 64-bit is likely trivial. And if you didn't make such a change, you're going to have to eventually. Personally, I don't see tha alpha quality of the 64-bit code generation to be a reason not to support it. It's been released. But then again, I don't use your tool at all and find no need for it, so it's not like I'm one of your users. - Jonathan M DavisJacob: An error comes when the " ./dvm install dvm" command is given. " ./dvm: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directoryYou don't have libz installed? Oh, you're running 64bit, you need to install 32bit libraries. I also forgot to mention that DVM currently only installs the 32bit version of DMD. The 64bit version is quite new, don't know if it's experimental, alpha or beta.
Mar 28 2011
Jonathan: Yeah I checked. It's there :s. I dont know what has gone wrong, but I'm using the default settings . I have GDC installed too. Can this have any connection with this problem( just a wild guess ) ? Jacob: I wasn't sure about which libraries you were talking about. The only lib set I left out was ia32-libs. So I installed it too.That didn't solve the problem. So I tried to install the deb file by force. "sudo dpkg -i --force-architecture dmd***.dmd" now I get a whole lot more errors :s. " ishan ishan-Ubu-I1464:~/Geany Projects$ dmd untitle.d /usr/include/d/dmd/phobos/object.d(51): C-style function pointer and pointer to array syntax is deprecated. Use 'function' to declare function pointers /usr/include/d/dmd/phobos/std/format.d(672): no identifier for declarator inout(fakevalue) /usr/include/d/dmd/phobos/std/c/stdlib.d(43): C-style function pointer and pointer to array syntax is deprecated. Use 'function' to declare function pointers /usr/include/d/dmd/phobos/std/c/stdlib.d(59): C-style function pointer and pointer to array syntax is deprecated. Use 'function' to declare function pointers /usr/include/d/dmd/phobos/std/c/linux/linux.d(558): C-style function pointer and pointer to array syntax is deprecated. Use 'function' to declare function pointers /usr/include/d/dmd/phobos/std/c/linux/linux.d(574): C-style function pointer and pointer to array syntax is deprecated. Use 'function' to declare function pointers " I'm trying to compile the following simple code. As you can see it should work without any problem. " import std.stdio; int main() { writefln("Hello world"); return 0; } " "
Mar 28 2011
On 03/28/2011 04:49 PM, Ishan Thilina wrote:now I get a whole lot more errors :s. " ishan ishan-Ubu-I1464:~/Geany Projects$ dmd untitle.d /usr/include/d/dmd/phobos/object.d(51): C-style function pointer and pointer to array syntax is deprecated. Use 'function' to declare function pointers /usr/include/d/dmd/phobos/std/format.d(672): no identifier for declarator inout(fakevalue) /usr/include/d/dmd/phobos/std/c/stdlib.d(43): C-style function pointer and pointer to array syntax is deprecated. Use 'function' to declare function pointers /usr/include/d/dmd/phobos/std/c/stdlib.d(59): C-style function pointer and pointer to array syntax is deprecated. Use 'function' to declare function pointers /usr/include/d/dmd/phobos/std/c/linux/linux.d(558): C-style function pointer and pointer to array syntax is deprecated. Use 'function' to declare function pointers /usr/include/d/dmd/phobos/std/c/linux/linux.d(574): C-style function pointer and pointer to array syntax is deprecated. Use 'function' to declare function pointers " I'm trying to compile the following simple code. As you can see it should work without any problem. " import std.stdio; int main() { writefln("Hello world"); return 0; }I have no idea why and where your issues in using D with dmd come from. AFAIK, it just works out of the box if you use release versions. Just 2 notes about the piece of code: First, you often do not need in D a program result code (int). Second, writefln, as opposed to writeln, expects a format string as first argument. void main () { writeln("Hello, world!"); auto userName = "Otto"; writefln("Hello, %s!", userName); } Denis -- _________________ vita es estrany spir.wikidot.com
Mar 28 2011
On 2011-03-28 16:49, Ishan Thilina wrote:Jonathan: Yeah I checked. It's there :s. I dont know what has gone wrong, but I'm using the default settings . I have GDC installed too. Can this have any connection with this problem( just a wild guess ) ? Jacob: I wasn't sure about which libraries you were talking about. The only lib set I left out was ia32-libs. So I installed it too.That didn't solve the problem. So I tried to install the deb file by force.To run 32bit applications on a 64bit machine you need 32bit compatible runtime libraries, regardless if you run my installation tool or dmd (dmd is a 32bit tool even thought it can produce 64bit binaries). I don't know what exact runtime libraries are needed but for my tool you need the regular runtime libraries you would need running any kind of 32bit application and 32bit version of libz."sudo dpkg -i --force-architecture dmd***.dmd" now I get a whole lot more errors :s. " ishan ishan-Ubu-I1464:~/Geany Projects$ dmd untitle.d /usr/include/d/dmd/phobos/object.d(51): C-style function pointer and pointer to array syntax is deprecated. Use 'function' to declare function pointers /usr/include/d/dmd/phobos/std/format.d(672): no identifier for declarator inout(fakevalue) /usr/include/d/dmd/phobos/std/c/stdlib.d(43): C-style function pointer and pointer to array syntax is deprecated. Use 'function' to declare function pointers /usr/include/d/dmd/phobos/std/c/stdlib.d(59): C-style function pointer and pointer to array syntax is deprecated. Use 'function' to declare function pointers /usr/include/d/dmd/phobos/std/c/linux/linux.d(558): C-style function pointer and pointer to array syntax is deprecated. Use 'function' to declare function pointers /usr/include/d/dmd/phobos/std/c/linux/linux.d(574): C-style function pointer and pointer to array syntax is deprecated. Use 'function' to declare function pointers " I'm trying to compile the following simple code. As you can see it should work without any problem. " import std.stdio; int main() { writefln("Hello world"); return 0; } " "-- /Jacob Carlborg
Mar 29 2011
On 3/27/11 12:28 PM, Ishan Thilina wrote:When I give "dmd untitled.d" command in my ubuntu maverick 64 bit laptop I get the following error. " object.d: Error: module object is in file 'object.d' which cannot be read import path[0] = /etc/../../src/phobos import path[1] = /etc/../../src/druntime/import "Your dmd.conf doesn't have the correct include path for Phobos. If you post it here, along with the location of the Phobos sources (the directory that contains object.di) on your system, we might be able to give you a detailed description of how to resolve this issue. David
Mar 29 2011
On Sunday, 27 March 2011 at 10:28:00 UTC, Ishan Thilina wrote:When I give "dmd untitled.d" command in my ubuntu maverick 64 bit laptop I get the following error. " object.d: Error: module object is in file 'object.d' which cannot be read import path[0] = /etc/../../src/phobos import path[1] = /etc/../../src/druntime/import "I had the exact same problem, very frustrating. I believe I solved the issue, it was a simple error. When you are installing D, on Windows, it asks you to download MSVC, if it isn't already present. Basically you are missing some form of dependency, which could be different based on which compiler you are using. On my Windows machine I fixed the issue by downloading the Microsoft Visual IDE and then from there I hit a button within that application to download the C compiler, MSVC. After I did that I reinstalled D and it works now. Thank you
Sep 13 2021
On Tuesday, 14 September 2021 at 03:31:17 UTC, Kenneth Dallmann wrote:On Sunday, 27 March 2011 at 10:28:00 UTC, Ishan Thilina wrote:Please try to avoid resurrecting very old threads if you can.[...]I had the exact same problem, very frustrating. I believe I solved the issue, it was a simple error. When you are installing D, on Windows, it asks you to download MSVC, if it isn't already present. Basically you are missing some form of dependency, which could be different based on which compiler you are using. On my Windows machine I fixed the issue by downloading the Microsoft Visual IDE and then from there I hit a button within that application to download the C compiler, MSVC. After I did that I reinstalled D and it works now. Thank you
Sep 13 2021