Help: I am unable to compile Swift with my own libraries.


(juan ariza toledano) #1

Hello everyone,

I am trying to compile Swift in Ubuntu 14.04 and I found several problems. I have been trying to compile Swift for some days using my own compiled libraries (such us libedit, python, libxml, uuid, sqlite3, libicu, libncurses, etc.) and I unable to link them properly.

When I install the libraries mentioned before from the system (using apt-get install XXX) I can perfectly compile Swift using the "build-script" with the following options:

./swift/utils/build-script --assertions --no-swift-stdlib-assertions --llbuild --swiftpm --xctest --lldb --release --foundation -- --install-swift --install-lldb --install-llbuild --install-swiftpm --install-xctest '--swift-install-components=autolink-driver;compiler;clang-builtin-headers;stdlib;swift-remote-mirror;sdk-overlay;license' --build-swift-static-stdlib --build-swift-stdlib-unittest-extra --install-destdir=/home/juan --installable-package=/home/juan/swift-compiled.tar.gz --install-foundation --reconfigure

However, I want to use my own compiled libraries. I have successfully compiled all the dependences mentioned before under /home/juan/common, so I have all the libraries under /home/juan/common/lib, the binaries under /home/juan/common/bin and the headers under /home/juan/common/include. (NOTE: I did install clang, ninja-build and cmake using "apt-get install XXX, I just compiled the libraries, not the compiling tools).

The problem is that I am unable to configure the "build-script" to use my libraries instead of the system ones, so cmake and clang are unable to find and link them and the compilation process fails. I have tried to use several options but I am still unable to get it. Here you have some of the flags I tried:

--extra-cmake-options='-DICU_UC_INCLUDE_DIR=/home/juan/common/include, -DICU_UC_LIBRARIES=/home/juancommon/lib, -DICU_I18N_INCLUDE_DIR=/home/juan/common/include/, -DICU_I18N_LIBRARIES=/home/juan/common/lib, -DPYTHON_LIBRARY=/home/juan/python/lib/libpython2.7.so, -DPYTHON_INCLUDE_DIR=/home/juan/python/include/python2.7, -DCMAKE_CXX_FLAGS=-I/home/juan/common/include, -DLIBXML2_INCLUDE_DIR=/home/juancommon/include/libxml2, -DLIBXML2_LIBRARIES=/home/juan/common/lib/libxml2.so, -DUUID_INCLUDE_DIR=/home/juan/common/include, -DUUID_LIBRARY=/home/juan/common/lib/libuuid.so, -DCMAKE_EXE_LINKER_FLAGS=-L/home/juan/common/lib’

Does anyone how I can configure the "build-script" properly? I am desperate [:disappointed:] .

I would appreciate any kind of help very much [:blush:] .

Best regards,

Juan


(Zhao Xin) #2

I think you should find out what are the differences between your tools and
tools from apt-get. Maybe some configurations or versions do not feed the
needs. That will be huge work as there are a lot of things may concern. I
think you should follow the error as the lead first, which you didn't
provide here.

Zhaoxin

···

On Tue, Aug 9, 2016 at 5:36 PM, juan ariza toledano via swift-users < swift-users@swift.org> wrote:

Hello everyone,

I am trying to compile Swift in Ubuntu 14.04 and I found several
problems. I have been trying to compile Swift for some days using my own
compiled libraries (such us libedit, python, libxml, uuid, sqlite3, libicu,
libncurses, etc.) and I unable to link them properly.

When I install the libraries mentioned before from the system (using
apt-get install XXX) I can perfectly compile Swift using the "build-script"
with the following options:

*./swift/utils/build-script --assertions --no-swift-stdlib-assertions
--llbuild --swiftpm --xctest --lldb --release --foundation --
--install-swift --install-lldb --install-llbuild --install-swiftpm
--install-xctest
'--swift-install-components=autolink-driver;compiler;clang-builtin-headers;stdlib;swift-remote-mirror;sdk-overlay;license'
--build-swift-static-stdlib --build-swift-stdlib-unittest-extra
--install-destdir=/home/juan
--installable-package=/home/juan/swift-compiled.tar.gz --install-foundation
--reconfigure*

However, I want to use my own compiled libraries. I have successfully
compiled all the dependences mentioned before under */home/juan/common*,
so I have all the libraries under /home/juan/common/lib, the binaries under
*/home/juan/common/bin* and the headers under */home/juan/common/include.
* (NOTE: I did install clang, ninja-build and cmake using "apt-get
install XXX, I just compiled the libraries, not the compiling tools).

The problem is that I am unable to configure the "*build-script*" to use
my libraries instead of the system ones, so cmake and clang are unable to
find and link them and the compilation process fails. I have tried to use
several options but I am still unable to get it. Here you have some of the
flags I tried:

*--extra-cmake-options='-DICU_UC_INCLUDE_DIR=/home/juan/common/include,
-DICU_UC_LIBRARIES=/home/juancommon/lib,
-DICU_I18N_INCLUDE_DIR=/home/juan/common/include/,
-DICU_I18N_LIBRARIES=/home/juan/common/lib,
-DPYTHON_LIBRARY=/home/juan/python/lib/libpython2.7.so
<http://libpython2.7.so>,
-DPYTHON_INCLUDE_DIR=/home/juan/python/include/python2.7,
-DCMAKE_CXX_FLAGS=-I/home/juan/common/include,
-DLIBXML2_INCLUDE_DIR=/home/juancommon/include/libxml2,
-DLIBXML2_LIBRARIES=/home/juan/common/lib/libxml2.so,
-DUUID_INCLUDE_DIR=/home/juan/common/include,
-DUUID_LIBRARY=/home/juan/common/lib/libuuid.so,
-DCMAKE_EXE_LINKER_FLAGS=-L/home/juan/common/lib’*

Does anyone how I can configure the "build-script" properly? I am
desperate [image: :disappointed:].

I would appreciate any kind of help very much [image: :blush:].

Best regards,

Juan

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users