question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[bug] Makefile won't build successfully

See original GitHub issue

Environment Details (include every applicable attribute)

  • Operating System+version: Ubuntu 20.04
  • Compiler+version: g++ 9.3.0
  • Conan version: 1.38.0
  • Python version: 3.8.10

Steps to reproduce (Include if Applicable)

Follow the official Doc to build with Makefile generator. https://docs.conan.io/en/latest/integrations/build_system/make.html

conanfile.txt

[requires]
poco/1.9.4

[generators]
make

Makefile

 #----------------------------------------
 #     Prepare flags from make generator
 #----------------------------------------

 include conanbuildinfo.mak
 $(call CONAN_BASIC_SETUP)

 #----------------------------------------
 #     Make variables for a sample App
 #----------------------------------------

 SRCS          = main.cpp
 OBJS          = main.o
 EXE_FILENAME  = main

 #----------------------------------------
 #     Make Rules
 #----------------------------------------

 .PHONY                  :   exe
 exe                     :   $(EXE_FILENAME)

 $(EXE_FILENAME)         :   $(OBJS)
	g++ $(OBJS) $(CXXFLAGS) $(LDFLAGS) $(LDLIBS) -o $(EXE_FILENAME)

 %.o                     :   $(SRCS)
	g++ -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@

Code

#include "Poco/MD5Engine.h"
#include "Poco/DigestStream.h"

#include <iostream>


int main(int argc, char** argv)
{
    Poco::MD5Engine md5;
    Poco::DigestOutputStream ds(md5);
    ds << "abcdefghijklmnopqrstuvwxyz";
    ds.close();
    std::cout << Poco::DigestEngine::digestToHex(md5.digest()) << std::endl;
    return 0;
}

Steps

  1. conan install .
  2. make exe

Logs (Executed commands with output) (Include/Attach if Applicable)

image

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
memshardedcommented, Jul 19, 2021

I have been checking previous Conan versions down to Conan 1.20.

Apparently, the magic of $(call CONAN_BASIC_SETUP) was never implemented in this generator, only in the MakeToolchain in https://github.com/conan-io/conan/pull/7430, and then, the documentation was incorrectly changed.

So I’d suggest:

  • Fixing the docs of the legacy Makefile generator to reflect this
  • As the docs already have a note to move to the new Autotools integration, that is fine.
  • If necessary to work with the legacy Makefile generator, the way to go would be to add the necessary CONAN_ variables from the generated .mak file into the Makefile itself (this generator was always intended for this usage, completely explicit).
0reactions
ibmboy19commented, Jul 19, 2021

Thanks @memsharded ! Have modified Makefile according to the old doc, and it works now!

https://raw.githubusercontent.com/conan-io/docs/release/1.19.0/integrations/build_system/make.rst

Read more comments on GitHub >

github_iconTop Results From Across the Web

Makefile won't compile correctly - Stack Overflow
1 Answer 1 ... It looks like you're using Linux, so use -pthread instead of -lpthread , and make sure to add it...
Read more >
Confusing error, won't build
Any idea why I'm getting this when I try to do a build on a .C file? (Yes I'm a newbie to this...
Read more >
Cannot create a C++ Makefile project - Visual Studio Feedback
After installing successfully, reopen vs. Create C++ empty project successfully, then add c++ makefile project successfully. Build this project successfully.
Read more >
Can't compile a Release build · Issue #542 - GitHub
looks like that you're trying to build in a filesystem that isn't write enabled by the user. Double check your write permissions just...
Read more >
Errors compiling with STMCubeIDE likely because module ...
We were able to successfully compile the firmware this way using the IAR IDE, ... make: *** [makefile:43: 6steps_STEVAL-SPIN3204-2019-11-12.elf] Error 1.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found