ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am recently having problems with the compilation of my C++ source files with make.
The modifications to the source files are recognized and, hence, the sources get re-compiled successfully in a certain machine while the modifications can not be recognized at all on another machine, and the old object files are kept being used to create the binaries.
git is used for version control. In our configuration, even though the machines where software development takes place can pull from each other, one server machine is used as a centric repository from which everybody pulls.
I am suspecting that, after pulling from git, somehow, Linux file permissions do not allow the developer to compile the source successfully.
I am recently having problems with the compilation of my C++ source files with make.
The modifications to the source files are recognized and, hence, the sources get re-compiled successfully in a certain machine while the modifications can not be recognized at all on another machine, and the old object files are kept being used to create the binaries.
git is used for version control. In our configuration, even though the machines where software development takes place can pull from each other, one server machine is used as a centric repository from which everybody pulls.
I am suspecting that, after pulling from git, somehow, Linux file permissions do not allow the developer to compile the source successfully.
Any ideas are appreciated.
Thanks.
does file modification times that are recorded on the file system changes?
Hi All,
I am suspecting that, after pulling from git, somehow, Linux file permissions do not allow the developer to compile the source successfully.
(GNU) Make doesn't really care about file permissions, but only about modification times when determining if an object file or executable should be rebuilt. If you were facing a file permission issue, make would have complained with an error :-)
As I'm thinking that the project which you're working on is a bit bigger(?), you should possibly try to minimize the makefile for a reproducable test case and then use the -d option for make to get some debugging options, for the case you can't determine if the modification time changed as ozanbaba suggested ...
you aren't mixing files from windows as well are you?
of course, we could guess all day - or maybe,
perhaps you could share with us the error messages you get?
Last edited by bigearsbilly; 01-05-2010 at 02:05 PM.
I am recently having problems with the compilation of my C++ source files with make.
The modifications to the source files are recognized and, hence, the sources get re-compiled successfully in a certain machine while the modifications can not be recognized at all on another machine, and the old object files are kept being used to create the binaries.
git is used for version control. In our configuration, even though the machines where software development takes place can pull from each other, one server machine is used as a centric repository from which everybody pulls.
I am suspecting that, after pulling from git, somehow, Linux file permissions do not allow the developer to compile the source successfully.
Any ideas are appreciated.
Thanks.
We want to help, but you have given us almost no helpful information. Git should have nothing to do with this, because the git repository should be own by the person compiling, and the compiler only needs read access to the source code to be able to create the object files. Unless, for some freaky reason, the git repository is also tracking object files, which is highly unlikely.
Does this repository just use a Makefile (not Autotools?) It could be that the Makefile was written badly, with improper dependency configuration or something like that. But since you didn't post it... who knows.
Also might help to know what kind of system is having the problems.
Git should have nothing to do with this, because the git repository should be own by the person compiling, and the compiler only needs read access to the source code to be able to create the object files. Unless, for some freaky reason, the git repository is also tracking object files, which is highly unlikely.
This problem was originally reported by another person. Now, she says that everything began to compile as expected. I have no idea why it suddenly began to work as expected ...
Since I am new to git, all "freaky" reasons are possible.
Quote:
Does this repository just use a Makefile (not Autotools?) It could be that the Makefile was written badly, with improper dependency configuration or something like that. But since you didn't post it... who knows.
It just uses a Makefile.
Quote:
Also might help to know what kind of system is having the problems.
Ubuntu 9.10
I read somewhere else that "This sort of problem often happens when the clocks of the various systems are out of sync. Thus, all the systems should be configured to sync their clock with ntp." ?
Can you please provide some info in terms of your comments, http links, books, etc. about the guidelines to write flawless Makefiles ?
Thanks.
Well, its not anything real deep. Mainly what I was thinking about was making sure you have all your targets and dependencies lined up correctly, so that everything that is supposed to rebuild actually does. If you don't know what that means, then I'd suggest a beginner's tutorial.
If you actually want to write perfect Makefiles, my suggestion is: don't. Use a build system. Build systems write the Makefiles for you (or use methods other than Makefiles). I use "Autotools" personally, but I have also used "Cmake", and I've heard of another one called "Scons".
Well, its not anything real deep. Mainly what I was thinking about was making sure you have all your targets and dependencies lined up correctly, so that everything that is supposed to rebuild actually does. If you don't know what that means, then I'd suggest a beginner's tutorial.
If you actually want to write perfect Makefiles, my suggestion is: don't. Use a build system. Build systems write the Makefiles for you (or use methods other than Makefiles). I use "Autotools" personally, but I have also used "Cmake", and I've heard of another one called "Scons".
If I 'touch' all files, 'make' SEEMS to detect the timestamp changes for all touched files, and re-build the object files. However, I can not see the changes in program output.
Here are my Makefiles:
Makefile (I call 'make' for this file):
Code:
all:
make -f Makefile_Ses
make -f Makefile_Repo
make -f Makefile_Code
clean:
make -f Makefile_Ses clean
make -f Makefile_Repo clean
make -f Makefile_Code clean
For example, when I modify PrsBase.cpp, which is built in Makefile_Code, I CAN observe from the output of 'make' that the modifications to PrsBase.cpp are detected, and PrsBase.cpp is re-built. However, when I execute the application which loads libh.so plugin, which is built in Makefile_Code, I can not see the expected output from PrsBase.cpp. Somehow, the changes do not go into libh.so in the line "gcc $(LFLAGS),-soname,$(LIB_ST).1 -o $(LIB_ST).1.0 $(OBJ_FILES) -L$(LIB_DIR) -L../../common/lib -L../../conf/configLib/lib $(LIBS)" in Makefile_Code.
So, then it looks like a possible Makefile problem. When you invoke the Makefile, do you see the commandline that builds the object library? Does it run cleanly (no errors or warning messages emitted)?
Another possibility is a linking loader issue. The line you pointed out only rebuilds a shared object library. Does the runtime executable actually load that new version of the library, or does the new library need to be copied to somewhere that the linking loader will be able to find it? LD_LIBRARY_PATH or ldconfig may be needed to get the new version correctly loaded.
--- rod.
Another possibility is a linking loader issue. The line you pointed out only rebuilds a shared object library. Does the runtime executable actually load that new version of the library, or does the new library need to be copied to somewhere that the linking loader will be able to find it? LD_LIBRARY_PATH or ldconfig may be needed to get the new version correctly loaded.
--- rod.
I finally resolved the problem.
First of all, the problem had nothing to do with Makefiles.
The machine where these source files are compiled using 'make' had two separate users on it both of whom were developing software for the same project.
In our case, all binaries are invoked via a shell script with root priviliges, which, right at the beginning, checks /etc/ld.so.conf file to see if $HOME/project_folder/plugin_libs line exists. If not, it adds it into /etc/ld.so.conf, and run 'ldconfig'.
Since first user had already added $HOME/project_folder/plugin_libs line to ld.so.conf when the second user checks the existence of $HOME/project_folder/plugin_libs line with a different $HOME value, another $HOME/project_folder/plugin_libs line with a different $HOME value
is added to ld.so.conf.
Since the first appearing line in ld.so.conf has presedence over the the line coming after it, the plugins from the other user's project folder kept being loaded - the modified ones were ignored.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.