Re: [LEDE-DEV] [Jool-list] It seems to me like the build system ignores EXTRA_FLAGS?

2016-12-01 Thread Dan Lüdtke
Hi guys,

you are totally right. I had the -largp in the wrong place the whole time.
I found that the easiest way to work around the issue is to patch the 
Makefile.am files when they are getting pulled in by the build system. See 
patch below.

In the meantime, Jo came up with a fixed Makefile that does not need patches of 
upstream Makefile.am files. I tested it and it builds fine. Thank you very 
much! So I threw away the patches and use the proper Makefile now.

Building works, tests on the target platform have been successful as well. I 
opened a pull request where we can discuss any other issues that need to get 
sorted out before merging.

Thanks for you help and the super-fast responses!

Dan

Pull Request is here: https://github.com/openwrt/packages/pull/3604

> On Thu, Dec 1, 2016 at 9:34 AM, Alberto Leiva  wrote:
>> 
>> Not sure if "x86_64-openwrt-linux-musl-gcc" implies that you're using gcc,
>> but at least in stock gcc, order matters. If you're going to force -largp,
>> do so at the end, along with the other libraries.


> On 1 Dec 2016, at 10:20, John Szakmeister  wrote:
> 
> I can't help you with the actual issues, but you don't have -largp in
> the correct location.  It need probably needs to come before the last
> few libraries, but after the jool-related ones (at the very least the
> ones that depend on it).  Linkers link in the order given, so at the
> point you've placed it, nothing depends on argp and therefore nothing
> is used from it.


--- a/usr/stateful/Makefile.am  2016-10-07 20:17:00.0 +0200
+++ b/usr/stateful/Makefile.am  2016-12-01 13:40:23.034974511 +0100
@@ -25,7 +25,7 @@
../common/target/pool6.c \
../common/target/session.c
 
-jool_LDADD = ${LIBNLGENL3_LIBS}
+jool_LDADD = -largp ${LIBNLGENL3_LIBS}
 jool_CFLAGS = -Wall -O2
 jool_CFLAGS += -I${srcdir}/../../include
 jool_CFLAGS += ${LIBNLGENL3_CFLAGS} ${JOOL_FLAGS}
--- a/usr/stateless/Makefile.am 2016-10-07 20:17:00.0 +0200
+++ b/usr/stateless/Makefile.am 2016-12-01 13:40:01.034717994 +0100
@@ -25,7 +25,7 @@
../common/target/pool6.c \
../common/target/session.c
 
-jool_siit_LDADD = ${LIBNLGENL3_LIBS}
+jool_siit_LDADD = -largp ${LIBNLGENL3_LIBS}
 jool_siit_CFLAGS = -Wall -O2
 jool_siit_CFLAGS += -I${srcdir}/../../include
 jool_siit_CFLAGS += ${LIBNLGENL3_CFLAGS} ${JOOL_FLAGS}
___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [Jool-list] It seems to me like the build system ignores EXTRA_FLAGS?

2016-12-01 Thread Dan Lüdtke
I created a pull request on github for this one. 

> On 30 Nov 2016, at 23:31, Alberto Leiva  wrote:
> 
> Yes, from your build log, it does look like it ignores EXTRA_FLAGS. Autoconf 
> is the one normally supposed to take care of the -ls. Don't know if 
> you've tried this: Open usr/configure.ac and add
> 
> AC_SEARCH_LIBS([argp_parse], [argp])
> [...]
> You might want to send a pull request if it works.


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [Jool-list] It seems to me like the build system ignores EXTRA_FLAGS?

2016-12-01 Thread Jo-Philipp Wich
Hi Dan,

the following Makefile builds successfully for me on Musl toolchain:
https://gist.github.com/jow-/79255a0361a099e572f8f76e86d5be8d

I think the main issue was that you included package-defaults.mk and
kernel-defaults.mk in the middle of your Makefile which messed up
several build variables.

Another problem might have been the fact that you called autogen.sh
yourself which will cause host autoconf to be picked up which can
usually lead to troubles later on.

The configure script successfully detects argp-standalone:
   checking for library containing argp_parse... -largp

The resulting gcc command line looks fine too:
  x86_64-openwrt-linux-musl-gcc [...] -lnl-genl-3 -lnl-3 -largp

I had to fix up your build dependency spec to be processed correctly but
all in all your Makefile was already quite close to a working version.

~ Jo

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [Jool-list] It seems to me like the build system ignores EXTRA_FLAGS?

2016-12-01 Thread Alberto Leiva
> BTW my responses are not arriving at "leve-...@lists.infradead.org". Perhaps 
> they haven't received anything.

Oh, it's just because my e-mails are HTML. Except Gmail says they're not. Weird.

On Thu, Dec 1, 2016 at 9:34 AM, Alberto Leiva  wrote:
> Two cents:
>
> Not sure if "x86_64-openwrt-linux-musl-gcc" implies that you're using gcc,
> but at least in stock gcc, order matters. If you're going to force -largp,
> do so at the end, along with the other libraries.
>
> This is correct:
> gcc -Wall -O2 -I./../../include -I/usr/include/libnl3-g -O2   -o
> jool_siit ../../common/netlink/jool_siit-config.o
> ../../common/stateless/jool_siit-xlat.o ../common/jool_siit-cJSON.o
> ../common/jool_siit-dns.o ../common/jool_siit-file.o
> ../common/jool_siit-jool.o ../common/jool_siit-netlink2.o
> ../common/jool_siit-str_utils.o ../common/argp/jool_siit-options.o
> ../common/nl/jool_siit-buffer.o ../common/target/jool_siit-bib.o
> ../common/target/jool_siit-eam.o ../common/target/jool_siit-global.o
> ../common/target/jool_siit-instance.o ../common/target/jool_siit-joold.o
> ../common/target/jool_siit-json.o ../common/target/jool_siit-log_time.o
> ../common/target/jool_siit-pool.o ../common/target/jool_siit-pool4.o
> ../common/target/jool_siit-pool6.o ../common/target/jool_siit-session.o
> -lnl-genl-3 -lnl-3   -lpthread -lm
>
> This spits lots of "undefined reference" errors (all I did was move the
> "-l"s):
> gcc -Wall -O2 -lnl-genl-3 -lnl-3   -lpthread -lm  -I./../../include
> -I/usr/include/libnl3-g -O2   -o jool_siit
> ../../common/netlink/jool_siit-config.o
> ../../common/stateless/jool_siit-xlat.o ../common/jool_siit-cJSON.o
> ../common/jool_siit-dns.o ../common/jool_siit-file.o
> ../common/jool_siit-jool.o ../common/jool_siit-netlink2.o
> ../common/jool_siit-str_utils.o ../common/argp/jool_siit-options.o
> ../common/nl/jool_siit-buffer.o ../common/target/jool_siit-bib.o
> ../common/target/jool_siit-eam.o ../common/target/jool_siit-global.o
> ../common/target/jool_siit-instance.o ../common/target/jool_siit-joold.o
> ../common/target/jool_siit-json.o ../common/target/jool_siit-log_time.o
> ../common/target/jool_siit-pool.o ../common/target/jool_siit-pool4.o
> ../common/target/jool_siit-pool6.o ../common/target/jool_siit-session.o
>
> Here's a dicussion on this topic: http://stackoverflow.com/questions/45135
> Also, have you seen this? https://github.com/openwrt/packages/issues/1535
>
> BTW my responses are not arriving at "leve-...@lists.infradead.org". Perhaps
> they haven't received anything.
>
> On Thu, Dec 1, 2016 at 2:57 AM, Dan Lüdtke  wrote:
>>
>>
>> > AC_SEARCH_LIBS([argp_parse], [argp])
>>
>>
>> Result:
>> > checking for pow... no
>> > checking for library containing pow... -lm
>> > checking for library containing pthread_create... -lpthread
>> > checking for library containing argp_parse... none required <<<---
>> > checking pkg-config is at least version 0.9.0... yes
>> > checking for LIBNLGENL3... yes
>> > checking that generated files are newer than configure... done
>> > configure: creating ./config.status
>> > config.status: creating Makefile
>> > config.status: creating stateless/Makefile
>> > config.status: creating stateful/Makefile
>> > config.status: creating joold/Makefile
>> > config.status: executing depfiles commands
>>
>> Sigh. It checks for the lib but doesn't think it needs it. Shouldn't this
>> be running all under the same toolchain?
>>
>> I think it may be the LEDE build system that is screwing this one up. Or
>> my Makefile is totally nuts (possible, not very experienced in LEDE build
>> system).
>>
>> It get's worse. If I force -largp, the error stays the same:
>> > x86_64-openwrt-linux-musl-gcc -Wall -O2 -largp -I./../../include
>> > -I/home/danrl/lede/nat64/source/staging_dir/target-x86_64_musl-1.1.15/usr/include/libnl3
>> > -o jool ../../common/netlink/jool-config.o 
>> > ../../common/stateful/jool-xlat.o
>> > ../common/jool-cJSON.o ../common/jool-dns.o ../common/jool-file.o
>> > ../common/jool-jool.o ../common/jool-netlink2.o ../common/jool-str_utils.o
>> > ../common/argp/jool-options.o ../common/nl/jool-buffer.o
>> > ../common/target/jool-bib.o ../common/target/jool-eam.o
>> > ../common/target/jool-global.o ../common/target/jool-instance.o
>> > ../common/target/jool-joold.o ../common/target/jool-json.o
>> > ../common/target/jool-log_time.o ../common/target/jool-pool.o
>> > ../common/target/jool-pool4.o ../common/target/jool-pool6.o
>> > ../common/target/jool-session.o
>> > -L/home/danrl/lede/nat64/source/staging_dir/target-x86_64_musl-1.1.15/usr/lib
>> > -lnl-genl-3 -lnl-3 -lpthread -lm
>> > ../common/jool-jool.o: In function `main':
>> > jool.c:(.text.startup+0x89): undefined reference to `argp_parse'
>> > collect2: error: ld returned 1 exit status
>> > Makefile:504: recipe for target 'jool' failed
>> > make[6]: *** [jool] Error 1
>>
>>
>> However, if I force -largp-standalone (nonexistent) the linker exits
>> complaining about how it could not find the lib. This

Re: [LEDE-DEV] [Jool-list] It seems to me like the build system ignores EXTRA_FLAGS?

2016-12-01 Thread John Szakmeister
On Thu, Dec 1, 2016 at 3:57 AM, Dan Lüdtke  wrote:
[snip]
> It get's worse. If I force -largp, the error stays the same:
>> x86_64-openwrt-linux-musl-gcc -Wall -O2 -largp -I./../../include 
>> -I/home/danrl/lede/nat64/source/staging_dir/target-x86_64_musl-1.1.15/usr/include/libnl3
>>  -o jool ../../common/netlink/jool-config.o 
>> ../../common/stateful/jool-xlat.o ../common/jool-cJSON.o 
>> ../common/jool-dns.o ../common/jool-file.o ../common/jool-jool.o 
>> ../common/jool-netlink2.o ../common/jool-str_utils.o 
>> ../common/argp/jool-options.o ../common/nl/jool-buffer.o 
>> ../common/target/jool-bib.o ../common/target/jool-eam.o 
>> ../common/target/jool-global.o ../common/target/jool-instance.o 
>> ../common/target/jool-joold.o ../common/target/jool-json.o 
>> ../common/target/jool-log_time.o ../common/target/jool-pool.o 
>> ../common/target/jool-pool4.o ../common/target/jool-pool6.o 
>> ../common/target/jool-session.o 
>> -L/home/danrl/lede/nat64/source/staging_dir/target-x86_64_musl-1.1.15/usr/lib
>>  -lnl-genl-3 -lnl-3 -lpthread -lm
>> ../common/jool-jool.o: In function `main':
>> jool.c:(.text.startup+0x89): undefined reference to `argp_parse'
>> collect2: error: ld returned 1 exit status
>> Makefile:504: recipe for target 'jool' failed
>> make[6]: *** [jool] Error 1

I can't help you with the actual issues, but you don't have -largp in
the correct location.  It need probably needs to come before the last
few libraries, but after the jool-related ones (at the very least the
ones that depend on it).  Linkers link in the order given, so at the
point you've placed it, nothing depends on argp and therefore nothing
is used from it.

I'd try here:
../common/target/jool-pool6.o ../common/target/jool-session.o -largp ...

-John

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [Jool-list] It seems to me like the build system ignores EXTRA_FLAGS?

2016-12-01 Thread Jo-Philipp Wich
Hi Dan,

please provide
/home/danrl/lede/nat64/source/build_dir/target-x86_64_musl-1.1.15/jool*/config.log

~ Jo

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [Jool-list] It seems to me like the build system ignores EXTRA_FLAGS?

2016-12-01 Thread Dan Lüdtke

> AC_SEARCH_LIBS([argp_parse], [argp])


Result: 
> checking for pow... no
> checking for library containing pow... -lm
> checking for library containing pthread_create... -lpthread
> checking for library containing argp_parse... none required <<<---
> checking pkg-config is at least version 0.9.0... yes
> checking for LIBNLGENL3... yes
> checking that generated files are newer than configure... done
> configure: creating ./config.status
> config.status: creating Makefile
> config.status: creating stateless/Makefile
> config.status: creating stateful/Makefile
> config.status: creating joold/Makefile
> config.status: executing depfiles commands

Sigh. It checks for the lib but doesn't think it needs it. Shouldn't this be 
running all under the same toolchain?

I think it may be the LEDE build system that is screwing this one up. Or my 
Makefile is totally nuts (possible, not very experienced in LEDE build system).

It get's worse. If I force -largp, the error stays the same:
> x86_64-openwrt-linux-musl-gcc -Wall -O2 -largp -I./../../include 
> -I/home/danrl/lede/nat64/source/staging_dir/target-x86_64_musl-1.1.15/usr/include/libnl3
>  -o jool ../../common/netlink/jool-config.o 
> ../../common/stateful/jool-xlat.o ../common/jool-cJSON.o ../common/jool-dns.o 
> ../common/jool-file.o ../common/jool-jool.o ../common/jool-netlink2.o 
> ../common/jool-str_utils.o ../common/argp/jool-options.o 
> ../common/nl/jool-buffer.o ../common/target/jool-bib.o 
> ../common/target/jool-eam.o ../common/target/jool-global.o 
> ../common/target/jool-instance.o ../common/target/jool-joold.o 
> ../common/target/jool-json.o ../common/target/jool-log_time.o 
> ../common/target/jool-pool.o ../common/target/jool-pool4.o 
> ../common/target/jool-pool6.o ../common/target/jool-session.o 
> -L/home/danrl/lede/nat64/source/staging_dir/target-x86_64_musl-1.1.15/usr/lib 
> -lnl-genl-3 -lnl-3 -lpthread -lm 
> ../common/jool-jool.o: In function `main':
> jool.c:(.text.startup+0x89): undefined reference to `argp_parse'
> collect2: error: ld returned 1 exit status
> Makefile:504: recipe for target 'jool' failed
> make[6]: *** [jool] Error 1


However, if I force -largp-standalone (nonexistent) the linker exits 
complaining about how it could not find the lib. This means, in the previous 
command (with forced -largp) the linker found the lib but did not think it 
helps linking argp_parse. Why is that?


Maybe someone from LEDE can help explain this?



___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev