Discussion:
[PATCH] Link binaries with system libraries needed by LLVM
Anatol Pomozov
10 years ago
Permalink
It is needed on Linux Arch with latest LLVM installed

Signed-off-by: Anatol Pomozov <***@gmail.com>
---
Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 28c4df6..25087d7 100644
--- a/Makefile
+++ b/Makefile
@@ -112,11 +112,12 @@ LLVM_PROGS := sparse-llvm
$(LLVM_PROGS): LD := g++
LLVM_LDFLAGS := $(shell llvm-config --ldflags)
LLVM_CFLAGS := $(shell llvm-config --cflags | sed -e "s/-DNDEBUG//g")
+LLVM_SYSTEM_LIBS := $(shell llvm-config --system-libs)
LLVM_LIBS := $(shell llvm-config --libs)
PROGRAMS += $(LLVM_PROGS)
INST_PROGRAMS += sparse-llvm sparsec
sparse-llvm.o: BASIC_CFLAGS += $(LLVM_CFLAGS)
-sparse-llvm_EXTRA_OBJS := $(LLVM_LIBS) $(LLVM_LDFLAGS)
+sparse-llvm_EXTRA_OBJS := $(LLVM_SYSTEM_LIBS) $(LLVM_LIBS) $(LLVM_LDFLAGS)
endif
endif
--
2.1.0.rc2.206.gedb03e5

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Josh Triplett
10 years ago
Permalink
Post by Anatol Pomozov
It is needed on Linux Arch with latest LLVM installed
One comment below.
...
Does llvm-config support passing multiple options, such as "llvm-config
--libs --system-libs"? If so, I'd suggest just adding --system-libs to
the call in LLVM_LIBS, rather than adding a second variable.

(It's obnoxious that llvm requires its own configuration tool rather
than using pkg-config.)

- Josh Triplett
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Anatol Pomozov
10 years ago
Permalink
Hi
...
Thanks. Yeap it is better. Will send update in a second.
Post by Josh Triplett
(It's obnoxious that llvm requires its own configuration tool rather
than using pkg-config.)
- Josh Triplett
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Anatol Pomozov
10 years ago
Permalink
It is needed on Linux Arch with latest LLVM installed

Signed-off-by: Anatol Pomozov <***@gmail.com>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 28c4df6..c0ffd04 100644
--- a/Makefile
+++ b/Makefile
@@ -112,7 +112,7 @@ LLVM_PROGS := sparse-llvm
$(LLVM_PROGS): LD := g++
LLVM_LDFLAGS := $(shell llvm-config --ldflags)
LLVM_CFLAGS := $(shell llvm-config --cflags | sed -e "s/-DNDEBUG//g")
-LLVM_LIBS := $(shell llvm-config --libs)
+LLVM_LIBS := $(shell llvm-config --libs --system-libs)
PROGRAMS += $(LLVM_PROGS)
INST_PROGRAMS += sparse-llvm sparsec
sparse-llvm.o: BASIC_CFLAGS += $(LLVM_CFLAGS)
--
2.1.0.rc2.206.gedb03e5

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Ramsay Jones
10 years ago
Permalink
...
This issue is addressed in commit d92353b4eacbac54d693edd62fb565f071e3ba86
("sparse-llvm: Fix LLVM 3.5 linker errors", 24-09-2014) in the main sparse
repo and in a follow-up commit a5bdeee9e145cc4313526f9722f80674321ab491
("Use LLVM_CONFIG instead of llvm-config in Makefile", 24-09-2014) in
Christopher's public repo on kernel.org.

Neither commit is in a released version of sparse.
Post by Josh Triplett
Does llvm-config support passing multiple options, such as "llvm-config
--libs --system-libs"? If so, I'd suggest just adding --system-libs to
the call in LLVM_LIBS, rather than adding a second variable.
An old version of llvm-config (prior to adding --system-libs) would
respond like so:

$ llvm-config --libs --system-libs
-lLLVM-3.4.2
usage: llvm-config <OPTION>... [<COMPONENT>...]

Get various configuration information needed to compile programs which use
LLVM. Typically called from 'configure' scripts. Examples:
llvm-config --cxxflags
llvm-config --ldflags
llvm-config --libs engine bcreader scalaropts

Options:
--version Print LLVM version.
--prefix Print the installation prefix.
--src-root Print the source root LLVM was built from.
--obj-root Print the object root used to build LLVM.
...
--build-mode Print build mode of LLVM tree (e.g. Debug or Release).
Typical components:
all All LLVM libraries (default).
engine Either a native JIT or a bitcode interpreter.
$ echo $?
1
$

HTH

ATB,
Ramsay Jones


--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Loading...